-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit d3111007 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Oct 4, 2023
1 parent
4c53cf6
commit cfa4f34
Showing
9 changed files
with
233 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
Create a metric monitor with a custom schedule returns "OK" response | ||
""" | ||
|
||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v1.api.monitors_api import MonitorsApi | ||
from datadog_api_client.v1.model.monitor import Monitor | ||
from datadog_api_client.v1.model.monitor_options import MonitorOptions | ||
from datadog_api_client.v1.model.monitor_options_custom_schedule import MonitorOptionsCustomSchedule | ||
from datadog_api_client.v1.model.monitor_options_custom_schedule_recurrence import ( | ||
MonitorOptionsCustomScheduleRecurrence, | ||
) | ||
from datadog_api_client.v1.model.monitor_options_scheduling_options import MonitorOptionsSchedulingOptions | ||
from datadog_api_client.v1.model.monitor_options_scheduling_options_evaluation_window import ( | ||
MonitorOptionsSchedulingOptionsEvaluationWindow, | ||
) | ||
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds | ||
from datadog_api_client.v1.model.monitor_type import MonitorType | ||
|
||
body = Monitor( | ||
name="Example-Monitor", | ||
type=MonitorType.METRIC_ALERT, | ||
query="avg(current_1mo):avg:system.load.5{*} > 0.5", | ||
message="some message Notify: @hipchat-channel", | ||
options=MonitorOptions( | ||
thresholds=MonitorThresholds( | ||
critical=0.5, | ||
), | ||
scheduling_options=MonitorOptionsSchedulingOptions( | ||
custom_schedule=MonitorOptionsCustomSchedule( | ||
recurrences=[ | ||
MonitorOptionsCustomScheduleRecurrence( | ||
rrule="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", | ||
start="2024-08-31T16:30:00", | ||
timezone="Europe/Paris", | ||
), | ||
], | ||
), | ||
evaluation_window=MonitorOptionsSchedulingOptionsEvaluationWindow( | ||
day_starts="04:00", | ||
hour_starts=0, | ||
month_starts=1, | ||
), | ||
), | ||
), | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = MonitorsApi(api_client) | ||
response = api_instance.create_monitor(body=body) | ||
|
||
print(response) |
46 changes: 46 additions & 0 deletions
46
src/datadog_api_client/v1/model/monitor_options_custom_schedule.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 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, | ||
unset, | ||
UnsetType, | ||
) | ||
|
||
|
||
if TYPE_CHECKING: | ||
from datadog_api_client.v1.model.monitor_options_custom_schedule_recurrence import ( | ||
MonitorOptionsCustomScheduleRecurrence, | ||
) | ||
|
||
|
||
class MonitorOptionsCustomSchedule(ModelNormal): | ||
@cached_property | ||
def openapi_types(_): | ||
from datadog_api_client.v1.model.monitor_options_custom_schedule_recurrence import ( | ||
MonitorOptionsCustomScheduleRecurrence, | ||
) | ||
|
||
return { | ||
"recurrences": ([MonitorOptionsCustomScheduleRecurrence],), | ||
} | ||
|
||
attribute_map = { | ||
"recurrences": "recurrences", | ||
} | ||
|
||
def __init__(self_, recurrences: Union[List[MonitorOptionsCustomScheduleRecurrence], UnsetType] = unset, **kwargs): | ||
""" | ||
Configuration options for the custom schedule. **This feature is in private beta.** | ||
:param recurrences: Array of custom schedule recurrences. | ||
:type recurrences: [MonitorOptionsCustomScheduleRecurrence], optional | ||
""" | ||
if recurrences is not unset: | ||
kwargs["recurrences"] = recurrences | ||
super().__init__(kwargs) |
56 changes: 56 additions & 0 deletions
56
src/datadog_api_client/v1/model/monitor_options_custom_schedule_recurrence.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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 Union | ||
|
||
from datadog_api_client.model_utils import ( | ||
ModelNormal, | ||
cached_property, | ||
unset, | ||
UnsetType, | ||
) | ||
|
||
|
||
class MonitorOptionsCustomScheduleRecurrence(ModelNormal): | ||
@cached_property | ||
def openapi_types(_): | ||
return { | ||
"rrule": (str,), | ||
"start": (str,), | ||
"timezone": (str,), | ||
} | ||
|
||
attribute_map = { | ||
"rrule": "rrule", | ||
"start": "start", | ||
"timezone": "timezone", | ||
} | ||
|
||
def __init__( | ||
self_, | ||
rrule: Union[str, UnsetType] = unset, | ||
start: Union[str, UnsetType] = unset, | ||
timezone: Union[str, UnsetType] = unset, | ||
**kwargs, | ||
): | ||
""" | ||
Configuration for a recurrence set on the monitor options for custom schedule. | ||
:param rrule: Defines the recurrence rule (RRULE) for a given schedule. | ||
:type rrule: str, optional | ||
:param start: Defines the start date and time of the recurring schedule. | ||
:type start: str, optional | ||
:param timezone: Defines the timezone the schedule runs on. | ||
:type timezone: str, optional | ||
""" | ||
if rrule is not unset: | ||
kwargs["rrule"] = rrule | ||
if start is not unset: | ||
kwargs["start"] = start | ||
if timezone is not unset: | ||
kwargs["timezone"] = timezone | ||
super().__init__(kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters