Skip to content

Commit 4db84c2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Create OpenAPI for SLO status endpoint (#3093)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4adb160 commit 4db84c2

File tree

13 files changed

+595
-1
lines changed

13 files changed

+595
-1
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,16 @@ components:
346346
required: true
347347
schema:
348348
type: string
349+
DisableCorrections:
350+
description: Whether to exclude correction windows from the SLO status calculation.
351+
Defaults to false.
352+
in: query
353+
name: disable_corrections
354+
required: false
355+
schema:
356+
default: false
357+
example: false
358+
type: boolean
349359
EntityID:
350360
description: UUID or Entity Ref.
351361
in: path
@@ -457,6 +467,15 @@ components:
457467
required: false
458468
schema:
459469
$ref: '#/components/schemas/RelationType'
470+
FromTimestamp:
471+
description: The starting timestamp for the SLO status query in epoch seconds.
472+
in: query
473+
name: from_ts
474+
required: true
475+
schema:
476+
example: 1690901870
477+
format: int64
478+
type: integer
460479
GCPSTSServiceAccountID:
461480
description: Your GCP STS enabled service account's unique ID.
462481
in: path
@@ -1104,6 +1123,14 @@ components:
11041123
required: false
11051124
schema:
11061125
type: boolean
1126+
SloID:
1127+
description: The ID of the SLO.
1128+
in: path
1129+
name: slo_id
1130+
required: true
1131+
schema:
1132+
example: 00000000-0000-0000-0000-000000000000
1133+
type: string
11071134
SpansMetricIDParameter:
11081135
description: The name of the span-based metric.
11091136
in: path
@@ -1125,6 +1152,15 @@ components:
11251152
required: true
11261153
schema:
11271154
type: string
1155+
ToTimestamp:
1156+
description: The ending timestamp for the SLO status query in epoch seconds.
1157+
in: query
1158+
name: to_ts
1159+
required: true
1160+
schema:
1161+
example: 1706803070
1162+
format: int64
1163+
type: integer
11281164
UserID:
11291165
description: The ID of the user.
11301166
in: path
@@ -46850,6 +46886,22 @@ components:
4685046886
from the other indexes
4685146887
type: string
4685246888
type: object
46889+
RawErrorBudgetRemaining:
46890+
description: The raw error budget remaining for the SLO.
46891+
properties:
46892+
unit:
46893+
description: The unit of the error budget (for example, `seconds`, `requests`).
46894+
example: seconds
46895+
type: string
46896+
value:
46897+
description: The numeric value of the remaining error budget.
46898+
example: 86400.5
46899+
format: double
46900+
type: number
46901+
required:
46902+
- value
46903+
- unit
46904+
type: object
4685346905
ReadinessGate:
4685446906
description: Used to merge multiple branches into a single branch.
4685546907
properties:
@@ -57827,6 +57879,70 @@ components:
5782757879
required:
5782857880
- attributes
5782957881
type: object
57882+
SloStatusData:
57883+
description: The data portion of the SLO status response.
57884+
properties:
57885+
attributes:
57886+
$ref: '#/components/schemas/SloStatusDataAttributes'
57887+
id:
57888+
description: The ID of the SLO.
57889+
example: 00000000-0000-0000-0000-000000000000
57890+
type: string
57891+
type:
57892+
$ref: '#/components/schemas/SloStatusType'
57893+
required:
57894+
- id
57895+
- type
57896+
- attributes
57897+
type: object
57898+
SloStatusDataAttributes:
57899+
description: The attributes of the SLO status.
57900+
properties:
57901+
error_budget_remaining:
57902+
description: The percentage of error budget remaining.
57903+
example: 99.5
57904+
format: double
57905+
type: number
57906+
raw_error_budget_remaining:
57907+
$ref: '#/components/schemas/RawErrorBudgetRemaining'
57908+
sli:
57909+
description: The current Service Level Indicator (SLI) value as a percentage.
57910+
example: 99.95
57911+
format: double
57912+
type: number
57913+
span_precision:
57914+
description: The precision of the time span in seconds.
57915+
example: 2
57916+
format: int64
57917+
type: integer
57918+
state:
57919+
description: The current state of the SLO (for example, `breached`, `warning`,
57920+
`ok`).
57921+
example: ok
57922+
type: string
57923+
required:
57924+
- sli
57925+
- error_budget_remaining
57926+
- raw_error_budget_remaining
57927+
- state
57928+
- span_precision
57929+
type: object
57930+
SloStatusResponse:
57931+
description: The SLO status response.
57932+
properties:
57933+
data:
57934+
$ref: '#/components/schemas/SloStatusData'
57935+
required:
57936+
- data
57937+
type: object
57938+
SloStatusType:
57939+
description: The type of the SLO status resource.
57940+
enum:
57941+
- slo_status
57942+
example: slo_status
57943+
type: string
57944+
x-enum-varnames:
57945+
- SLO_STATUS
5783057946
SoftwareCatalogTriggerWrapper:
5783157947
description: Schema for a Software Catalog-based trigger.
5783257948
properties:
@@ -94439,6 +94555,63 @@ paths:
9443994555
x-unstable: '**Note**: This feature is in private beta. To request access, use
9444094556
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
9444194557
docs.'
94558+
/api/v2/slo/{slo_id}/status:
94559+
get:
94560+
description: 'Get the status of a Service Level Objective (SLO) for a given
94561+
time period.
94562+
94563+
94564+
This endpoint returns the current SLI value, error budget remaining, and other
94565+
status information for the specified SLO.'
94566+
operationId: GetSloStatus
94567+
parameters:
94568+
- $ref: '#/components/parameters/SloID'
94569+
- $ref: '#/components/parameters/FromTimestamp'
94570+
- $ref: '#/components/parameters/ToTimestamp'
94571+
- $ref: '#/components/parameters/DisableCorrections'
94572+
responses:
94573+
'200':
94574+
content:
94575+
application/json:
94576+
schema:
94577+
$ref: '#/components/schemas/SloStatusResponse'
94578+
description: OK
94579+
'400':
94580+
content:
94581+
application/json:
94582+
schema:
94583+
$ref: '#/components/schemas/JSONAPIErrorResponse'
94584+
description: Bad Request
94585+
'403':
94586+
content:
94587+
application/json:
94588+
schema:
94589+
$ref: '#/components/schemas/JSONAPIErrorResponse'
94590+
description: Forbidden
94591+
'404':
94592+
content:
94593+
application/json:
94594+
schema:
94595+
$ref: '#/components/schemas/JSONAPIErrorResponse'
94596+
description: Not Found
94597+
'429':
94598+
$ref: '#/components/responses/TooManyRequestsResponse'
94599+
security:
94600+
- apiKeyAuth: []
94601+
appKeyAuth: []
94602+
- AuthZ:
94603+
- slos_read
94604+
summary: Get SLO status
94605+
tags:
94606+
- Service Level Objectives
94607+
x-permission:
94608+
operator: OR
94609+
permissions:
94610+
- slos_read
94611+
x-unstable: '**Note**: This endpoint is in public beta and it''s subject to
94612+
change.
94613+
94614+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
9444294615
/api/v2/spa/recommendations/{service}:
9444394616
get:
9444494617
description: This endpoint is currently experimental and restricted to Datadog

docs/datadog_api_client.v2.model.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20087,6 +20087,13 @@ datadog\_api\_client.v2.model.query\_users\_request\_data\_type module
2008720087
:members:
2008820088
:show-inheritance:
2008920089

20090+
datadog\_api\_client.v2.model.raw\_error\_budget\_remaining module
20091+
------------------------------------------------------------------
20092+
20093+
.. automodule:: datadog_api_client.v2.model.raw_error_budget_remaining
20094+
:members:
20095+
:show-inheritance:
20096+
2009020097
datadog\_api\_client.v2.model.readiness\_gate module
2009120098
----------------------------------------------------
2009220099

@@ -25316,6 +25323,34 @@ datadog\_api\_client.v2.model.slo\_report\_status\_get\_response\_data module
2531625323
:members:
2531725324
:show-inheritance:
2531825325

25326+
datadog\_api\_client.v2.model.slo\_status\_data module
25327+
------------------------------------------------------
25328+
25329+
.. automodule:: datadog_api_client.v2.model.slo_status_data
25330+
:members:
25331+
:show-inheritance:
25332+
25333+
datadog\_api\_client.v2.model.slo\_status\_data\_attributes module
25334+
------------------------------------------------------------------
25335+
25336+
.. automodule:: datadog_api_client.v2.model.slo_status_data_attributes
25337+
:members:
25338+
:show-inheritance:
25339+
25340+
datadog\_api\_client.v2.model.slo\_status\_response module
25341+
----------------------------------------------------------
25342+
25343+
.. automodule:: datadog_api_client.v2.model.slo_status_response
25344+
:members:
25345+
:show-inheritance:
25346+
25347+
datadog\_api\_client.v2.model.slo\_status\_type module
25348+
------------------------------------------------------
25349+
25350+
.. automodule:: datadog_api_client.v2.model.slo_status_type
25351+
:members:
25352+
:show-inheritance:
25353+
2531925354
datadog\_api\_client.v2.model.software\_catalog\_trigger\_wrapper module
2532025355
------------------------------------------------------------------------
2532125356

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Get SLO status returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.service_level_objectives_api import ServiceLevelObjectivesApi
7+
8+
configuration = Configuration()
9+
configuration.unstable_operations["get_slo_status"] = True
10+
with ApiClient(configuration) as api_client:
11+
api_instance = ServiceLevelObjectivesApi(api_client)
12+
response = api_instance.get_slo_status(
13+
slo_id="00000000-0000-0000-0000-000000000000",
14+
from_ts=1690901870,
15+
to_ts=1706803070,
16+
)
17+
18+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ def __init__(
407407
"v2.create_slo_report_job": False,
408408
"v2.get_slo_report": False,
409409
"v2.get_slo_report_job_status": False,
410+
"v2.get_slo_status": False,
410411
"v2.get_spa_recommendations": False,
411412
"v2.get_spa_recommendations_with_shard": False,
412413
"v2.create_custom_rule": False,

0 commit comments

Comments
 (0)