Skip to content

Commit 38a51ea

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add notify_end_states and notify_end_types options to downtime (#1445)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 24a094a commit 38a51ea

19 files changed

+344
-16
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": "2023-05-04 18:52:22.109705",
8-
"spec_repo_commit": "4706b973"
7+
"regenerated": "2023-05-04 19:21:05.351305",
8+
"spec_repo_commit": "c0cc4b41"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-05-04 18:52:22.122098",
13-
"spec_repo_commit": "4706b973"
12+
"regenerated": "2023-05-04 19:21:05.364430",
13+
"spec_repo_commit": "c0cc4b41"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,10 @@ components:
17441744
be muted.
17451745
example: false
17461746
type: boolean
1747+
notify_end_states:
1748+
$ref: '#/components/schemas/NotifyEndStates'
1749+
notify_end_types:
1750+
$ref: '#/components/schemas/NotifyEndTypes'
17471751
parent_id:
17481752
description: ID of the parent Downtime.
17491753
example: 123
@@ -1880,6 +1884,10 @@ components:
18801884
be muted.
18811885
example: false
18821886
type: boolean
1887+
notify_end_states:
1888+
$ref: '#/components/schemas/NotifyEndStates'
1889+
notify_end_types:
1890+
$ref: '#/components/schemas/NotifyEndTypes'
18831891
parent_id:
18841892
description: ID of the parent Downtime.
18851893
example: 123
@@ -8399,6 +8407,60 @@ components:
83998407
format: int64
84008408
type: integer
84018409
type: object
8410+
NotifyEndState:
8411+
description: A notification end state.
8412+
enum:
8413+
- alert
8414+
- no data
8415+
- warn
8416+
example: alert
8417+
type: string
8418+
x-enum-varnames:
8419+
- ALERT
8420+
- NO_DATA
8421+
- WARN
8422+
NotifyEndStates:
8423+
default:
8424+
- alert
8425+
- no data
8426+
- warn
8427+
description: States for which `notify_end_types` sends out notifications for.
8428+
example:
8429+
- alert
8430+
- no data
8431+
- warn
8432+
items:
8433+
$ref: '#/components/schemas/NotifyEndState'
8434+
type: array
8435+
NotifyEndType:
8436+
description: A notification end type.
8437+
enum:
8438+
- canceled
8439+
- expired
8440+
example: expired
8441+
type: string
8442+
x-enum-varnames:
8443+
- CANCELED
8444+
- EXPIRED
8445+
NotifyEndTypes:
8446+
default:
8447+
- expired
8448+
description: 'If set, notifies if a monitor is in an alert-worthy state (`ALERT`,
8449+
`WARNING`, or `NO DATA`)
8450+
8451+
when this downtime expires or is canceled. Applied to monitors that change
8452+
states during
8453+
8454+
the downtime (such as from `OK` to `ALERT`, `WARNING`, or `NO DATA`), and
8455+
to monitors that
8456+
8457+
already have an alert-worthy state when downtime begins.'
8458+
example:
8459+
- canceled
8460+
- expired
8461+
items:
8462+
$ref: '#/components/schemas/NotifyEndType'
8463+
type: array
84028464
OnMissingDataOption:
84038465
description: 'Controls how groups or monitors are treated if an evaluation does
84048466
not return any data points.

docs/datadog_api_client.v1.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,34 @@ notebooks\_response\_page
24442444
:members:
24452445
:show-inheritance:
24462446

2447+
notify\_end\_state
2448+
------------------
2449+
2450+
.. automodule:: datadog_api_client.v1.model.notify_end_state
2451+
:members:
2452+
:show-inheritance:
2453+
2454+
notify\_end\_states
2455+
-------------------
2456+
2457+
.. automodule:: datadog_api_client.v1.model.notify_end_states
2458+
:members:
2459+
:show-inheritance:
2460+
2461+
notify\_end\_type
2462+
-----------------
2463+
2464+
.. automodule:: datadog_api_client.v1.model.notify_end_type
2465+
:members:
2466+
:show-inheritance:
2467+
2468+
notify\_end\_types
2469+
------------------
2470+
2471+
.. automodule:: datadog_api_client.v1.model.notify_end_types
2472+
:members:
2473+
:show-inheritance:
2474+
24472475
on\_missing\_data\_option
24482476
-------------------------
24492477

examples/v1/downtimes/CreateDowntime_2908359488.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from datadog_api_client.v1.api.downtimes_api import DowntimesApi
99
from datadog_api_client.v1.model.downtime import Downtime
1010
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
11+
from datadog_api_client.v1.model.notify_end_state import NotifyEndState
12+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
13+
from datadog_api_client.v1.model.notify_end_type import NotifyEndType
14+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
1115

1216
body = Downtime(
1317
message="Example-Downtime",
@@ -33,6 +37,16 @@
3337
monitor_tags=[
3438
"tag0",
3539
],
40+
notify_end_states=NotifyEndStates(
41+
[
42+
NotifyEndState.ALERT,
43+
]
44+
),
45+
notify_end_types=NotifyEndTypes(
46+
[
47+
NotifyEndType.CANCELED,
48+
]
49+
),
3650
)
3751

3852
configuration = Configuration()

examples/v1/downtimes/CreateDowntime_3059354445.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from datadog_api_client.v1.api.downtimes_api import DowntimesApi
99
from datadog_api_client.v1.model.downtime import Downtime
1010
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
11+
from datadog_api_client.v1.model.notify_end_state import NotifyEndState
12+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
13+
from datadog_api_client.v1.model.notify_end_type import NotifyEndType
14+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
1115

1216
body = Downtime(
1317
message="Example-Downtime",
@@ -25,6 +29,17 @@
2529
monitor_tags=[
2630
"tag0",
2731
],
32+
notify_end_states=NotifyEndStates(
33+
[
34+
NotifyEndState.ALERT,
35+
NotifyEndState.WARN,
36+
]
37+
),
38+
notify_end_types=NotifyEndTypes(
39+
[
40+
NotifyEndType.EXPIRED,
41+
]
42+
),
2843
)
2944

3045
configuration = Configuration()

src/datadog_api_client/v1/model/downtime.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
if TYPE_CHECKING:
1818
from datadog_api_client.v1.model.downtime_child import DowntimeChild
19+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
20+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
1921
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
2022

2123

@@ -35,6 +37,8 @@ class Downtime(ModelNormal):
3537
@cached_property
3638
def openapi_types(_):
3739
from datadog_api_client.v1.model.downtime_child import DowntimeChild
40+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
41+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
3842
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
3943

4044
return {
@@ -50,6 +54,8 @@ def openapi_types(_):
5054
"monitor_id": (int, none_type),
5155
"monitor_tags": ([str],),
5256
"mute_first_recovery_notification": (bool,),
57+
"notify_end_states": (NotifyEndStates,),
58+
"notify_end_types": (NotifyEndTypes,),
5359
"parent_id": (int, none_type),
5460
"recurrence": (DowntimeRecurrence,),
5561
"scope": ([str],),
@@ -71,6 +77,8 @@ def openapi_types(_):
7177
"monitor_id": "monitor_id",
7278
"monitor_tags": "monitor_tags",
7379
"mute_first_recovery_notification": "mute_first_recovery_notification",
80+
"notify_end_states": "notify_end_states",
81+
"notify_end_types": "notify_end_types",
7482
"parent_id": "parent_id",
7583
"recurrence": "recurrence",
7684
"scope": "scope",
@@ -102,6 +110,8 @@ def __init__(
102110
monitor_id: Union[int, none_type, UnsetType] = unset,
103111
monitor_tags: Union[List[str], UnsetType] = unset,
104112
mute_first_recovery_notification: Union[bool, UnsetType] = unset,
113+
notify_end_states: Union[NotifyEndStates, UnsetType] = unset,
114+
notify_end_types: Union[NotifyEndTypes, UnsetType] = unset,
105115
parent_id: Union[int, none_type, UnsetType] = unset,
106116
recurrence: Union[DowntimeRecurrence, none_type, UnsetType] = unset,
107117
scope: Union[List[str], UnsetType] = unset,
@@ -161,6 +171,15 @@ def __init__(
161171
:param mute_first_recovery_notification: If the first recovery notification during a downtime should be muted.
162172
:type mute_first_recovery_notification: bool, optional
163173
174+
:param notify_end_states: States for which ``notify_end_types`` sends out notifications for.
175+
:type notify_end_states: NotifyEndStates, optional
176+
177+
:param notify_end_types: If set, notifies if a monitor is in an alert-worthy state ( ``ALERT`` , ``WARNING`` , or ``NO DATA`` )
178+
when this downtime expires or is canceled. Applied to monitors that change states during
179+
the downtime (such as from ``OK`` to ``ALERT`` , ``WARNING`` , or ``NO DATA`` ), and to monitors that
180+
already have an alert-worthy state when downtime begins.
181+
:type notify_end_types: NotifyEndTypes, optional
182+
164183
:param parent_id: ID of the parent Downtime.
165184
:type parent_id: int, none_type, optional
166185
@@ -206,6 +225,10 @@ def __init__(
206225
kwargs["monitor_tags"] = monitor_tags
207226
if mute_first_recovery_notification is not unset:
208227
kwargs["mute_first_recovery_notification"] = mute_first_recovery_notification
228+
if notify_end_states is not unset:
229+
kwargs["notify_end_states"] = notify_end_states
230+
if notify_end_types is not unset:
231+
kwargs["notify_end_types"] = notify_end_types
209232
if parent_id is not unset:
210233
kwargs["parent_id"] = parent_id
211234
if recurrence is not unset:

src/datadog_api_client/v1/model/downtime_child.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616

1717
if TYPE_CHECKING:
18+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
19+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
1820
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
1921

2022

@@ -34,6 +36,8 @@ class DowntimeChild(ModelNormal):
3436

3537
@cached_property
3638
def openapi_types(_):
39+
from datadog_api_client.v1.model.notify_end_states import NotifyEndStates
40+
from datadog_api_client.v1.model.notify_end_types import NotifyEndTypes
3741
from datadog_api_client.v1.model.downtime_recurrence import DowntimeRecurrence
3842

3943
return {
@@ -48,6 +52,8 @@ def openapi_types(_):
4852
"monitor_id": (int, none_type),
4953
"monitor_tags": ([str],),
5054
"mute_first_recovery_notification": (bool,),
55+
"notify_end_states": (NotifyEndStates,),
56+
"notify_end_types": (NotifyEndTypes,),
5157
"parent_id": (int, none_type),
5258
"recurrence": (DowntimeRecurrence,),
5359
"scope": ([str],),
@@ -68,6 +74,8 @@ def openapi_types(_):
6874
"monitor_id": "monitor_id",
6975
"monitor_tags": "monitor_tags",
7076
"mute_first_recovery_notification": "mute_first_recovery_notification",
77+
"notify_end_states": "notify_end_states",
78+
"notify_end_types": "notify_end_types",
7179
"parent_id": "parent_id",
7280
"recurrence": "recurrence",
7381
"scope": "scope",
@@ -97,6 +105,8 @@ def __init__(
97105
monitor_id: Union[int, none_type, UnsetType] = unset,
98106
monitor_tags: Union[List[str], UnsetType] = unset,
99107
mute_first_recovery_notification: Union[bool, UnsetType] = unset,
108+
notify_end_states: Union[NotifyEndStates, UnsetType] = unset,
109+
notify_end_types: Union[NotifyEndTypes, UnsetType] = unset,
100110
parent_id: Union[int, none_type, UnsetType] = unset,
101111
recurrence: Union[DowntimeRecurrence, none_type, UnsetType] = unset,
102112
scope: Union[List[str], UnsetType] = unset,
@@ -150,6 +160,15 @@ def __init__(
150160
:param mute_first_recovery_notification: If the first recovery notification during a downtime should be muted.
151161
:type mute_first_recovery_notification: bool, optional
152162
163+
:param notify_end_states: States for which ``notify_end_types`` sends out notifications for.
164+
:type notify_end_states: NotifyEndStates, optional
165+
166+
:param notify_end_types: If set, notifies if a monitor is in an alert-worthy state ( ``ALERT`` , ``WARNING`` , or ``NO DATA`` )
167+
when this downtime expires or is canceled. Applied to monitors that change states during
168+
the downtime (such as from ``OK`` to ``ALERT`` , ``WARNING`` , or ``NO DATA`` ), and to monitors that
169+
already have an alert-worthy state when downtime begins.
170+
:type notify_end_types: NotifyEndTypes, optional
171+
153172
:param parent_id: ID of the parent Downtime.
154173
:type parent_id: int, none_type, optional
155174
@@ -193,6 +212,10 @@ def __init__(
193212
kwargs["monitor_tags"] = monitor_tags
194213
if mute_first_recovery_notification is not unset:
195214
kwargs["mute_first_recovery_notification"] = mute_first_recovery_notification
215+
if notify_end_states is not unset:
216+
kwargs["notify_end_states"] = notify_end_states
217+
if notify_end_types is not unset:
218+
kwargs["notify_end_types"] = notify_end_types
196219
if parent_id is not unset:
197220
kwargs["parent_id"] = parent_id
198221
if recurrence is not unset:
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class NotifyEndState(ModelSimple):
16+
"""
17+
A notification end state.
18+
19+
:param value: Must be one of ["alert", "no data", "warn"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"alert",
25+
"no data",
26+
"warn",
27+
}
28+
ALERT: ClassVar["NotifyEndState"]
29+
NO_DATA: ClassVar["NotifyEndState"]
30+
WARN: ClassVar["NotifyEndState"]
31+
32+
@cached_property
33+
def openapi_types(_):
34+
return {
35+
"value": (str,),
36+
}
37+
38+
39+
NotifyEndState.ALERT = NotifyEndState("alert")
40+
NotifyEndState.NO_DATA = NotifyEndState("no data")
41+
NotifyEndState.WARN = NotifyEndState("warn")

0 commit comments

Comments
 (0)