Zum Inhalt
HALOWERK

Finopswerk

ec2 billable session clock

From supplied original state changes and reboot markers derive running/hibernation-stopping duration, closed billable sessions and 60second minimum per start. Reboot never restarts the minimum. Pending/stopped/shutting-down/terminated are unbilled; ordinary stopping unbilled. Missing stopping kind and open final bills remain unknown; known early conflicts remain negative. No cloud operation, provider data/bill/price/RI/EBS certification. A schema-valid unknown is a successful result at the.

POST https://finops.halowerk.com/v1/ec2-billable-session-clock

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
eventsarrayJa
horizonintegerJa
reportobjectJa
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "at": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "state": {
            "enum": [
              "pending",
              "running",
              "stopping",
              "stopped",
              "shutting-down",
              "terminated",
              "reboot"
            ]
          },
          "stop_kind": {
            "enum": [
              "normal",
              "hibernate",
              null
            ]
          }
        },
        "required": [
          "at",
          "state",
          "stop_kind"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 12
    },
    "horizon": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000
    },
    "report": {
      "type": "object",
      "properties": {
        "sessions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "start": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "closed": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "observed_seconds": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "minimum_due_seconds": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "final_billable_seconds": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "start",
              "closed",
              "observed_seconds",
              "minimum_due_seconds",
              "final_billable_seconds"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 6
        },
        "running_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            },
            {
              "type": "null"
            }
          ]
        },
        "hibernation_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            },
            {
              "type": "null"
            }
          ]
        },
        "final_billable_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "sessions",
        "running_seconds",
        "hibernation_seconds",
        "final_billable_seconds"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "events",
    "horizon",
    "report"
  ],
  "additionalProperties": false
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "events": [
    {
      "at": 0,
      "state": "pending",
      "stop_kind": null
    },
    {
      "at": 1,
      "state": "running",
      "stop_kind": null
    },
    {
      "at": 5,
      "state": "reboot",
      "stop_kind": null
    },
    {
      "at": 21,
      "state": "stopping",
      "stop_kind": "normal"
    },
    {
      "at": 31,
      "state": "stopped",
      "stop_kind": null
    },
    {
      "at": 120,
      "state": "pending",
      "stop_kind": null
    },
    {
      "at": 121,
      "state": "running",
      "stop_kind": null
    },
    {
      "at": 140,
      "state": "stopping",
      "stop_kind": "normal"
    },
    {
      "at": 150,
      "state": "stopped",
      "stop_kind": null
    }
  ],
  "horizon": 160,
  "report": {
    "sessions": [
      {
        "start": 1,
        "closed": true,
        "observed_seconds": 20,
        "minimum_due_seconds": 60,
        "final_billable_seconds": 60
      },
      {
        "start": 121,
        "closed": true,
        "observed_seconds": 19,
        "minimum_due_seconds": 60,
        "final_billable_seconds": 60
      }
    ],
    "running_seconds": 39,
    "hibernation_seconds": 0,
    "final_billable_seconds": 120
  }
}

Ergebnis & Dokumentation

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-07, 02:42 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →