Skip to content

Commit af38cc1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update API spec to allow primary timeframe, target, and warning (#1280)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 2c8617a commit af38cc1

12 files changed

+203
-19
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2022-12-23 16:48:50.519098",
8-
"spec_repo_commit": "1e3acf42"
7+
"regenerated": "2022-12-28 16:11:06.259973",
8+
"spec_repo_commit": "b2d7d94f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-12-23 16:48:50.534381",
13-
"spec_repo_commit": "1e3acf42"
12+
"regenerated": "2022-12-28 16:11:06.274362",
13+
"spec_repo_commit": "b2d7d94f"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9710,6 +9710,14 @@ components:
97109710
description: A tag to apply to your SLO.
97119711
type: string
97129712
type: array
9713+
target_threshold:
9714+
description: 'The target threshold such that when the service level indicator
9715+
is above this
9716+
9717+
threshold over the given timeframe, the objective is being met.'
9718+
example: 99.9
9719+
format: double
9720+
type: number
97139721
thresholds:
97149722
description: 'The thresholds (timeframes and associated targets) for this
97159723
service level
@@ -9724,8 +9732,24 @@ components:
97249732
items:
97259733
$ref: '#/components/schemas/SLOThreshold'
97269734
type: array
9735+
timeframe:
9736+
$ref: '#/components/schemas/SLOTimeframe'
97279737
type:
97289738
$ref: '#/components/schemas/SLOType'
9739+
warning_threshold:
9740+
description: 'The optional warning threshold such that when the service
9741+
level indicator is
9742+
9743+
below this value for the given threshold, but above the target threshold,
9744+
the
9745+
9746+
objective appears in a "warning" state. This value must be greater than
9747+
the target
9748+
9749+
threshold.'
9750+
example: 99.95
9751+
format: double
9752+
type: number
97299753
type: object
97309754
SLOThreshold:
97319755
description: SLO thresholds (target and optionally warning) for a single time
@@ -10609,6 +10633,14 @@ components:
1060910633
description: A tag to apply to your SLO.
1061010634
type: string
1061110635
type: array
10636+
target_threshold:
10637+
description: 'The target threshold such that when the service level indicator
10638+
is above this
10639+
10640+
threshold over the given timeframe, the objective is being met.'
10641+
example: 99.9
10642+
format: double
10643+
type: number
1061210644
thresholds:
1061310645
description: 'The thresholds (timeframes and associated targets) for this
1061410646
service level
@@ -10623,8 +10655,24 @@ components:
1062310655
items:
1062410656
$ref: '#/components/schemas/SLOThreshold'
1062510657
type: array
10658+
timeframe:
10659+
$ref: '#/components/schemas/SLOTimeframe'
1062610660
type:
1062710661
$ref: '#/components/schemas/SLOType'
10662+
warning_threshold:
10663+
description: 'The optional warning threshold such that when the service
10664+
level indicator is
10665+
10666+
below this value for the given threshold, but above the target threshold,
10667+
the
10668+
10669+
objective appears in a "warning" state. This value must be greater than
10670+
the target
10671+
10672+
threshold.'
10673+
example: 99.95
10674+
format: double
10675+
type: number
1062810676
required:
1062910677
- name
1063010678
- thresholds
@@ -10713,6 +10761,14 @@ components:
1071310761
description: A tag to apply to your SLO.
1071410762
type: string
1071510763
type: array
10764+
target_threshold:
10765+
description: 'The target threshold such that when the service level indicator
10766+
is above this
10767+
10768+
threshold over the given timeframe, the objective is being met.'
10769+
example: 99.9
10770+
format: double
10771+
type: number
1071610772
thresholds:
1071710773
description: 'The thresholds (timeframes and associated targets) for this
1071810774
service level
@@ -10727,8 +10783,24 @@ components:
1072710783
items:
1072810784
$ref: '#/components/schemas/SLOThreshold'
1072910785
type: array
10786+
timeframe:
10787+
$ref: '#/components/schemas/SLOTimeframe'
1073010788
type:
1073110789
$ref: '#/components/schemas/SLOType'
10790+
warning_threshold:
10791+
description: 'The optional warning threshold such that when the service
10792+
level indicator is
10793+
10794+
below this value for the given threshold, but above the target threshold,
10795+
the
10796+
10797+
objective appears in a "warning" state. This value must be greater than
10798+
the target
10799+
10800+
threshold.'
10801+
example: 99.95
10802+
format: double
10803+
type: number
1073210804
required:
1073310805
- name
1073410806
- thresholds

examples/v1/service-level-objectives/CreateSLO.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
warning_display="98.0",
3737
),
3838
],
39+
timeframe=SLOTimeframe.SEVEN_DAYS,
40+
target_threshold=97.0,
41+
warning_threshold=98.0,
3942
)
4043

4144
configuration = Configuration()

examples/v1/service-level-objectives/UpdateSLO.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
warning=98.0,
2626
),
2727
],
28+
timeframe=SLOTimeframe.SEVEN_DAYS,
29+
target_threshold=97.0,
30+
warning_threshold=98.0,
2831
query=ServiceLevelObjectiveQuery(
2932
numerator="sum:httpservice.hits{code:2xx}.as_count()",
3033
denominator="sum:httpservice.hits{!code:3xx}.as_count()",

src/datadog_api_client/v1/model/service_level_objective.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from datadog_api_client.v1.model.creator import Creator
1919
from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery
2020
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
21+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2122
from datadog_api_client.v1.model.slo_type import SLOType
2223

2324

@@ -27,6 +28,7 @@ def openapi_types(_):
2728
from datadog_api_client.v1.model.creator import Creator
2829
from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery
2930
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
31+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
3032
from datadog_api_client.v1.model.slo_type import SLOType
3133

3234
return {
@@ -41,8 +43,11 @@ def openapi_types(_):
4143
"name": (str,),
4244
"query": (ServiceLevelObjectiveQuery,),
4345
"tags": ([str],),
46+
"target_threshold": (float,),
4447
"thresholds": ([SLOThreshold],),
48+
"timeframe": (SLOTimeframe,),
4549
"type": (SLOType,),
50+
"warning_threshold": (float,),
4651
}
4752

4853
attribute_map = {
@@ -57,8 +62,11 @@ def openapi_types(_):
5762
"name": "name",
5863
"query": "query",
5964
"tags": "tags",
65+
"target_threshold": "target_threshold",
6066
"thresholds": "thresholds",
67+
"timeframe": "timeframe",
6168
"type": "type",
69+
"warning_threshold": "warning_threshold",
6270
}
6371
read_only_vars = {
6472
"created_at",
@@ -82,6 +90,9 @@ def __init__(
8290
monitor_tags: Union[List[str], UnsetType] = unset,
8391
query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset,
8492
tags: Union[List[str], UnsetType] = unset,
93+
target_threshold: Union[float, UnsetType] = unset,
94+
timeframe: Union[SLOTimeframe, UnsetType] = unset,
95+
warning_threshold: Union[float, UnsetType] = unset,
8596
**kwargs,
8697
):
8798
"""
@@ -144,12 +155,25 @@ def __init__(
144155
Optional in create/update requests.
145156
:type tags: [str], optional
146157
158+
:param target_threshold: The target threshold such that when the service level indicator is above this
159+
threshold over the given timeframe, the objective is being met.
160+
:type target_threshold: float, optional
161+
147162
:param thresholds: The thresholds (timeframes and associated targets) for this service level
148163
objective object.
149164
:type thresholds: [SLOThreshold]
150165
166+
:param timeframe: The SLO time window options.
167+
:type timeframe: SLOTimeframe, optional
168+
151169
:param type: The type of the service level objective.
152170
:type type: SLOType
171+
172+
:param warning_threshold: The optional warning threshold such that when the service level indicator is
173+
below this value for the given threshold, but above the target threshold, the
174+
objective appears in a "warning" state. This value must be greater than the target
175+
threshold.
176+
:type warning_threshold: float, optional
153177
"""
154178
if created_at is not unset:
155179
kwargs["created_at"] = created_at
@@ -171,6 +195,12 @@ def __init__(
171195
kwargs["query"] = query
172196
if tags is not unset:
173197
kwargs["tags"] = tags
198+
if target_threshold is not unset:
199+
kwargs["target_threshold"] = target_threshold
200+
if timeframe is not unset:
201+
kwargs["timeframe"] = timeframe
202+
if warning_threshold is not unset:
203+
kwargs["warning_threshold"] = warning_threshold
174204
super().__init__(kwargs)
175205

176206
self_.name = name

src/datadog_api_client/v1/model/service_level_objective_request.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
if TYPE_CHECKING:
1818
from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery
1919
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
20+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2021
from datadog_api_client.v1.model.slo_type import SLOType
2122

2223

@@ -25,6 +26,7 @@ class ServiceLevelObjectiveRequest(ModelNormal):
2526
def openapi_types(_):
2627
from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery
2728
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
29+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2830
from datadog_api_client.v1.model.slo_type import SLOType
2931

3032
return {
@@ -34,8 +36,11 @@ def openapi_types(_):
3436
"name": (str,),
3537
"query": (ServiceLevelObjectiveQuery,),
3638
"tags": ([str],),
39+
"target_threshold": (float,),
3740
"thresholds": ([SLOThreshold],),
41+
"timeframe": (SLOTimeframe,),
3842
"type": (SLOType,),
43+
"warning_threshold": (float,),
3944
}
4045

4146
attribute_map = {
@@ -45,8 +50,11 @@ def openapi_types(_):
4550
"name": "name",
4651
"query": "query",
4752
"tags": "tags",
53+
"target_threshold": "target_threshold",
4854
"thresholds": "thresholds",
55+
"timeframe": "timeframe",
4956
"type": "type",
57+
"warning_threshold": "warning_threshold",
5058
}
5159

5260
def __init__(
@@ -59,6 +67,9 @@ def __init__(
5967
monitor_ids: Union[List[int], UnsetType] = unset,
6068
query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset,
6169
tags: Union[List[str], UnsetType] = unset,
70+
target_threshold: Union[float, UnsetType] = unset,
71+
timeframe: Union[SLOTimeframe, UnsetType] = unset,
72+
warning_threshold: Union[float, UnsetType] = unset,
6273
**kwargs,
6374
):
6475
"""
@@ -95,12 +106,25 @@ def __init__(
95106
Optional in create/update requests.
96107
:type tags: [str], optional
97108
109+
:param target_threshold: The target threshold such that when the service level indicator is above this
110+
threshold over the given timeframe, the objective is being met.
111+
:type target_threshold: float, optional
112+
98113
:param thresholds: The thresholds (timeframes and associated targets) for this service level
99114
objective object.
100115
:type thresholds: [SLOThreshold]
101116
117+
:param timeframe: The SLO time window options.
118+
:type timeframe: SLOTimeframe, optional
119+
102120
:param type: The type of the service level objective.
103121
:type type: SLOType
122+
123+
:param warning_threshold: The optional warning threshold such that when the service level indicator is
124+
below this value for the given threshold, but above the target threshold, the
125+
objective appears in a "warning" state. This value must be greater than the target
126+
threshold.
127+
:type warning_threshold: float, optional
104128
"""
105129
if description is not unset:
106130
kwargs["description"] = description
@@ -112,6 +136,12 @@ def __init__(
112136
kwargs["query"] = query
113137
if tags is not unset:
114138
kwargs["tags"] = tags
139+
if target_threshold is not unset:
140+
kwargs["target_threshold"] = target_threshold
141+
if timeframe is not unset:
142+
kwargs["timeframe"] = timeframe
143+
if warning_threshold is not unset:
144+
kwargs["warning_threshold"] = warning_threshold
115145
super().__init__(kwargs)
116146

117147
self_.name = name

0 commit comments

Comments
 (0)