Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,892 changes: 2,446 additions & 2,446 deletions .generator/schemas/v1/openapi.yaml

Large diffs are not rendered by default.

26,331 changes: 13,196 additions & 13,135 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions examples/v2/deployment-gates/CreateDeploymentRule_2423265690.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
Create monitor deployment rule with monitor IDs returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi
from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams
from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData
from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import (
CreateDeploymentRuleParamsDataAttributes,
)
from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType
from datadog_api_client.v2.model.deployment_rule_options_monitor_id import DeploymentRuleOptionsMonitorId
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds

# there is a valid "deployment_gate" in the system
DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"]

# there is a valid "monitor" in the system
MONITOR_ID = environ["MONITOR_ID"]

body = CreateDeploymentRuleParams(
data=CreateDeploymentRuleParamsData(
attributes=CreateDeploymentRuleParamsDataAttributes(
dry_run=False,
name="Specific monitor deployment rule",
options=DeploymentRuleOptionsMonitorIds(
monitor_ids=[
DeploymentRuleOptionsMonitorId(
id="7",
groups=[],
),
],
),
type="monitor",
),
type=DeploymentRuleDataType.DEPLOYMENT_RULE,
),
)

configuration = Configuration()
configuration.unstable_operations["create_deployment_rule"] = True
with ApiClient(configuration) as api_client:
api_instance = DeploymentGatesApi(api_client)
response = api_instance.create_deployment_rule(gate_id=DEPLOYMENT_GATE_DATA_ID, body=body)

print(response)
39 changes: 39 additions & 0 deletions examples/v2/deployment-gates/CreateDeploymentRule_4286388136.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
Create monitor deployment rule with query returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi
from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams
from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData
from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import (
CreateDeploymentRuleParamsDataAttributes,
)
from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor

# there is a valid "deployment_gate" in the system
DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"]

body = CreateDeploymentRuleParams(
data=CreateDeploymentRuleParamsData(
attributes=CreateDeploymentRuleParamsDataAttributes(
dry_run=False,
name="Query monitor deployment rule",
options=DeploymentRuleOptionsMonitor(
query="service:transaction-backend env:production",
),
type="monitor",
),
type=DeploymentRuleDataType.DEPLOYMENT_RULE,
),
)

configuration = Configuration()
configuration.unstable_operations["create_deployment_rule"] = True
with ApiClient(configuration) as api_client:
api_instance = DeploymentGatesApi(api_client)
response = api_instance.create_deployment_rule(gate_id=DEPLOYMENT_GATE_DATA_ID, body=body)

print(response)
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
DeploymentRuleOptionsFaultyDeploymentDetection,
)
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds


class CreateDeploymentRuleParamsDataAttributes(ModelNormal):
Expand All @@ -44,7 +45,10 @@ def __init__(
self_,
name: str,
options: Union[
DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor
DeploymentRulesOptions,
DeploymentRuleOptionsFaultyDeploymentDetection,
DeploymentRuleOptionsMonitor,
DeploymentRuleOptionsMonitorIds,
],
type: str,
dry_run: Union[bool, UnsetType] = unset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
**kwargs,
):
"""
Monitor options for deployment rules.
Monitor query options for deployment rules.

:param duration: Seconds the monitor needs to stay in OK status for the rule to pass.
:type duration: int, optional
Expand All @@ -63,7 +63,7 @@ def __init__(
:param fail_on_no_groups_found: Whether the rule should fail if no monitor groups are found for the query.
:type fail_on_no_groups_found: bool, optional

:param query: Monitors that match this query are evaluated.
:param query: A query that selects the monitors to evaluate.
:type query: str

:param warmup: Seconds to wait after a deployment starts before evaluating the monitor's status.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class DeploymentRuleOptionsMonitorId(ModelNormal):
validations = {
"id": {},
}

@cached_property
def additional_properties_type(_):
return None

@cached_property
def openapi_types(_):
return {
"groups": ([str],),
"id": (str,),
}

attribute_map = {
"groups": "groups",
"id": "id",
}

def __init__(self_, groups: List[str], id: str, **kwargs):
"""
A specific monitor and the groups to evaluate for it.

:param groups: The exact monitor group names to evaluate. An empty array evaluates all groups.
:type groups: [str]

:param id: The monitor's decimal ID.
:type id: str
"""
super().__init__(kwargs)

self_.groups = groups
self_.id = id
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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.v2.model.deployment_rule_options_monitor_id import DeploymentRuleOptionsMonitorId


class DeploymentRuleOptionsMonitorIds(ModelNormal):
validations = {
"monitor_ids": {
"min_items": 1,
},
"warmup": {
"inclusive_minimum": 0,
},
}

@cached_property
def additional_properties_type(_):
return None

@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.deployment_rule_options_monitor_id import DeploymentRuleOptionsMonitorId

return {
"duration": (int,),
"fail_on_no_data": (bool,),
"fail_on_no_groups_found": (bool,),
"monitor_ids": ([DeploymentRuleOptionsMonitorId],),
"warmup": (int,),
}

attribute_map = {
"duration": "duration",
"fail_on_no_data": "fail_on_no_data",
"fail_on_no_groups_found": "fail_on_no_groups_found",
"monitor_ids": "monitor_ids",
"warmup": "warmup",
}

def __init__(
self_,
monitor_ids: List[DeploymentRuleOptionsMonitorId],
duration: Union[int, UnsetType] = unset,
fail_on_no_data: Union[bool, UnsetType] = unset,
fail_on_no_groups_found: Union[bool, UnsetType] = unset,
warmup: Union[int, UnsetType] = unset,
**kwargs,
):
"""
Specific monitor options for deployment rules.

:param duration: Seconds the monitors need to stay in OK status for the rule to pass.
:type duration: int, optional

:param fail_on_no_data: Whether the rule should fail if a selected monitor group is in a NO DATA state.
:type fail_on_no_data: bool, optional

:param fail_on_no_groups_found: Whether the rule should fail if no monitor groups are found for the selected monitors.
:type fail_on_no_groups_found: bool, optional

:param monitor_ids: A non-empty list of specific monitors to evaluate.
:type monitor_ids: [DeploymentRuleOptionsMonitorId]

:param warmup: Seconds to wait after a deployment starts before evaluating the monitors' statuses.
:type warmup: int, optional
"""
if duration is not unset:
kwargs["duration"] = duration
if fail_on_no_data is not unset:
kwargs["fail_on_no_data"] = fail_on_no_data
if fail_on_no_groups_found is not unset:
kwargs["fail_on_no_groups_found"] = fail_on_no_groups_found
if warmup is not unset:
kwargs["warmup"] = warmup
super().__init__(kwargs)

self_.monitor_ids = monitor_ids
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
DeploymentRuleOptionsFaultyDeploymentDetection,
)
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds


class DeploymentRuleResponseDataAttributes(ModelNormal):
Expand Down Expand Up @@ -77,7 +78,10 @@ def __init__(
gate_id: str,
name: str,
options: Union[
DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor
DeploymentRulesOptions,
DeploymentRuleOptionsFaultyDeploymentDetection,
DeploymentRuleOptionsMonitor,
DeploymentRuleOptionsMonitorIds,
],
type: DeploymentRuleResponseDataAttributesType,
updated_at: Union[datetime, UnsetType] = unset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ def __init__(self, **kwargs):
:param fail_on_no_groups_found: Whether the rule should fail if no monitor groups are found for the query.
:type fail_on_no_groups_found: bool, optional

:param query: Monitors that match this query are evaluated.
:param query: A query that selects the monitors to evaluate.
:type query: str

:param warmup: Seconds to wait after a deployment starts before evaluating the monitor's status.
:type warmup: int, optional

:param monitor_ids: A non-empty list of specific monitors to evaluate.
:type monitor_ids: [DeploymentRuleOptionsMonitorId]
"""
super().__init__(kwargs)

Expand All @@ -51,10 +54,12 @@ def _composed_schemas(_):
DeploymentRuleOptionsFaultyDeploymentDetection,
)
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds

return {
"oneOf": [
DeploymentRuleOptionsFaultyDeploymentDetection,
DeploymentRuleOptionsMonitor,
DeploymentRuleOptionsMonitorIds,
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
DeploymentRuleOptionsFaultyDeploymentDetection,
)
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds


class UpdateDeploymentRuleParamsDataAttributes(ModelNormal):
Expand All @@ -41,7 +42,10 @@ def __init__(
dry_run: bool,
name: str,
options: Union[
DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor
DeploymentRulesOptions,
DeploymentRuleOptionsFaultyDeploymentDetection,
DeploymentRuleOptionsMonitor,
DeploymentRuleOptionsMonitorIds,
],
**kwargs,
):
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,8 @@
DeploymentRuleOptionsFaultyDeploymentDetection,
)
from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor
from datadog_api_client.v2.model.deployment_rule_options_monitor_id import DeploymentRuleOptionsMonitorId
from datadog_api_client.v2.model.deployment_rule_options_monitor_ids import DeploymentRuleOptionsMonitorIds
from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse
from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData
from datadog_api_client.v2.model.deployment_rule_response_data_attributes import DeploymentRuleResponseDataAttributes
Expand Down Expand Up @@ -13236,6 +13238,8 @@
"DeploymentRuleDataType",
"DeploymentRuleOptionsFaultyDeploymentDetection",
"DeploymentRuleOptionsMonitor",
"DeploymentRuleOptionsMonitorId",
"DeploymentRuleOptionsMonitorIds",
"DeploymentRuleResponse",
"DeploymentRuleResponseData",
"DeploymentRuleResponseDataAttributes",
Expand Down
21 changes: 21 additions & 0 deletions tests/generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4893,6 +4893,27 @@
"scenario": "Create deployment rule returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/features/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json",
"scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/features/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json",
"scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/features/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json",
"scenario": "Create monitor deployment rule with query returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/features/deployment_gates.feature",
Expand Down
Loading
Loading