-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmonitor.py
204 lines (176 loc) · 7.88 KB
/
monitor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations
from typing import List, Union, TYPE_CHECKING
from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
datetime,
none_type,
unset,
UnsetType,
)
if TYPE_CHECKING:
from datadog_api_client.v1.model.creator import Creator
from datadog_api_client.v1.model.matching_downtime import MatchingDowntime
from datadog_api_client.v1.model.monitor_options import MonitorOptions
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
from datadog_api_client.v1.model.monitor_state import MonitorState
from datadog_api_client.v1.model.monitor_type import MonitorType
class Monitor(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.creator import Creator
from datadog_api_client.v1.model.matching_downtime import MatchingDowntime
from datadog_api_client.v1.model.monitor_options import MonitorOptions
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
from datadog_api_client.v1.model.monitor_state import MonitorState
from datadog_api_client.v1.model.monitor_type import MonitorType
return {
"classification": (str,),
"created": (datetime,),
"creator": (Creator,),
"deleted": (datetime, none_type),
"id": (int,),
"matching_downtimes": ([MatchingDowntime],),
"message": (str,),
"modified": (datetime,),
"multi": (bool,),
"name": (str,),
"options": (MonitorOptions,),
"overall_state": (MonitorOverallStates,),
"priority": (int, none_type),
"query": (str,),
"restricted_roles": ([str], none_type),
"state": (MonitorState,),
"tags": ([str],),
"type": (MonitorType,),
}
attribute_map = {
"classification": "classification",
"created": "created",
"creator": "creator",
"deleted": "deleted",
"id": "id",
"matching_downtimes": "matching_downtimes",
"message": "message",
"modified": "modified",
"multi": "multi",
"name": "name",
"options": "options",
"overall_state": "overall_state",
"priority": "priority",
"query": "query",
"restricted_roles": "restricted_roles",
"state": "state",
"tags": "tags",
"type": "type",
}
read_only_vars = {
"classification",
"created",
"creator",
"deleted",
"id",
"modified",
"multi",
"overall_state",
"state",
}
def __init__(
self_,
query: str,
type: MonitorType,
classification: Union[str, UnsetType] = unset,
created: Union[datetime, UnsetType] = unset,
creator: Union[Creator, UnsetType] = unset,
deleted: Union[datetime, none_type, UnsetType] = unset,
id: Union[int, UnsetType] = unset,
matching_downtimes: Union[List[MatchingDowntime], UnsetType] = unset,
message: Union[str, UnsetType] = unset,
modified: Union[datetime, UnsetType] = unset,
multi: Union[bool, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
options: Union[MonitorOptions, UnsetType] = unset,
overall_state: Union[MonitorOverallStates, UnsetType] = unset,
priority: Union[int, none_type, UnsetType] = unset,
restricted_roles: Union[List[str], none_type, UnsetType] = unset,
state: Union[MonitorState, UnsetType] = unset,
tags: Union[List[str], UnsetType] = unset,
**kwargs,
):
"""
Object describing a monitor.
:param classification: The classification of the monitor.
:type classification: str, optional
:param created: Timestamp of the monitor creation.
:type created: datetime, optional
:param creator: Object describing the creator of the shared element.
:type creator: Creator, optional
:param deleted: Whether or not the monitor is deleted. (Always ``null`` )
:type deleted: datetime, none_type, optional
:param id: ID of this monitor.
:type id: int, optional
:param matching_downtimes: A list of active v1 downtimes that match this monitor.
:type matching_downtimes: [MatchingDowntime], optional
:param message: A message to include with notifications for this monitor.
:type message: str, optional
:param modified: Last timestamp when the monitor was edited.
:type modified: datetime, optional
:param multi: Whether or not the monitor is broken down on different groups.
:type multi: bool, optional
:param name: The monitor name.
:type name: str, optional
:param options: List of options associated with your monitor.
:type options: MonitorOptions, optional
:param overall_state: The different states your monitor can be in.
:type overall_state: MonitorOverallStates, optional
:param priority: Integer from 1 (high) to 5 (low) indicating alert severity.
:type priority: int, none_type, optional
:param query: The monitor query.
:type query: str
:param restricted_roles: A list of unique role identifiers to define which roles are allowed to edit the monitor. The unique identifiers for all roles can be pulled from the `Roles API <https://docs.datadoghq.com/api/latest/roles/#list-roles>`_ and are located in the ``data.id`` field. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. You can use the `Restriction Policies API <https://docs.datadoghq.com/api/latest/restriction-policies/>`_ to manage write authorization for individual monitors by teams and users, in addition to roles.
:type restricted_roles: [str], none_type, optional
:param state: Wrapper object with the different monitor states.
:type state: MonitorState, optional
:param tags: Tags associated to your monitor.
:type tags: [str], optional
:param type: The type of the monitor. For more information about ``type`` , see the `monitor options <https://docs.datadoghq.com/monitors/guide/monitor_api_options/>`_ docs.
:type type: MonitorType
"""
if classification is not unset:
kwargs["classification"] = classification
if created is not unset:
kwargs["created"] = created
if creator is not unset:
kwargs["creator"] = creator
if deleted is not unset:
kwargs["deleted"] = deleted
if id is not unset:
kwargs["id"] = id
if matching_downtimes is not unset:
kwargs["matching_downtimes"] = matching_downtimes
if message is not unset:
kwargs["message"] = message
if modified is not unset:
kwargs["modified"] = modified
if multi is not unset:
kwargs["multi"] = multi
if name is not unset:
kwargs["name"] = name
if options is not unset:
kwargs["options"] = options
if overall_state is not unset:
kwargs["overall_state"] = overall_state
if priority is not unset:
kwargs["priority"] = priority
if restricted_roles is not unset:
kwargs["restricted_roles"] = restricted_roles
if state is not unset:
kwargs["state"] = state
if tags is not unset:
kwargs["tags"] = tags
super().__init__(kwargs)
self_.query = query
self_.type = type