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
153 changes: 152 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29382,6 +29382,25 @@ components:
data:
$ref: "#/components/schemas/ListDeploymentRuleResponseData"
type: object
DeploymentGatesEvaluationConfiguration:
description: |-
Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated
directly from this configuration instead of using the pre-configured gate rules.
At least one rule is required.
properties:
dry_run:
description: Gate-level dry run. When enabled, the rules are evaluated normally but the gate always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
rules:
description: The list of rules to evaluate. At least one rule is required.
items:
$ref: "#/components/schemas/DeploymentGatesEvaluationRule"
minItems: 1
type: array
required:
- rules
type: object
DeploymentGatesEvaluationRequest:
description: Request body for triggering a deployment gate evaluation.
properties:
Expand All @@ -29391,8 +29410,13 @@ components:
- data
type: object
DeploymentGatesEvaluationRequestAttributes:
description: Attributes for a deployment gate evaluation request.
description: |-
Attributes for a deployment gate evaluation request.
When `configuration` is provided, rules are evaluated inline from that configuration.
When omitted, rules are resolved from the pre-configured gate for the given service and environment.
properties:
configuration:
$ref: "#/components/schemas/DeploymentGatesEvaluationConfiguration"
env:
description: The environment of the deployment.
example: "staging"
Expand Down Expand Up @@ -29562,6 +29586,60 @@ components:
type: string
x-enum-varnames:
- DEPLOYMENT_GATES_EVALUATION_RESULT_RESPONSE
DeploymentGatesEvaluationRule:
description: A rule to evaluate as part of a deployment gate evaluation.
discriminator:
mapping:
faulty_deployment_detection: "#/components/schemas/DeploymentGatesFDDRule"
monitor: "#/components/schemas/DeploymentGatesMonitorRule"
propertyName: type
oneOf:
- $ref: "#/components/schemas/DeploymentGatesMonitorRule"
- $ref: "#/components/schemas/DeploymentGatesFDDRule"
DeploymentGatesFDDRule:
description: A faulty deployment detection rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "apm faulty deployment"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesFDDRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesFDDRuleType"
required:
- type
- name
type: object
DeploymentGatesFDDRuleOptions:
description: Options for a `faulty_deployment_detection` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 900
format: int64
maximum: 7200
type: integer
excluded_resources:
description: APM resource names to exclude from analysis.
example:
- "GET /healthcheck"
items:
type: string
type: array
type: object
DeploymentGatesFDDRuleType:
description: The type identifier for a faulty deployment detection rule.
enum:
- faulty_deployment_detection
example: faulty_deployment_detection
type: string
x-enum-varnames:
- FAULTY_DEPLOYMENT_DETECTION
DeploymentGatesListResponse:
description: Response containing a paginated list of deployment gates.
properties:
Expand Down Expand Up @@ -29596,6 +29674,49 @@ components:
minimum: 1
type: integer
type: object
DeploymentGatesMonitorRule:
description: A monitor rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "error rate monitors"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleType"
required:
- type
- name
type: object
DeploymentGatesMonitorRuleOptions:
description: Options for a `monitor` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 300
format: int64
maximum: 7200
type: integer
query:
description: Monitor search query.
example: "service:transaction-backend env:production"
type: string
required:
- query
type: object
DeploymentGatesMonitorRuleType:
description: The type identifier for a monitor rule.
enum:
- monitor
example: monitor
type: string
x-enum-varnames:
- MONITOR
DeploymentGatesRuleResponse:
description: The result of a single rule evaluation.
properties:
Expand Down Expand Up @@ -121740,12 +121861,17 @@ paths:
Triggers an asynchronous deployment gate evaluation for the given service and environment.
Returns an evaluation ID that can be used to poll for the result via the
`GET /api/v2/deployments/gates/evaluation/{id}` endpoint.

When the `configuration` attribute is provided, rules are evaluated inline from that configuration
and no pre-configured gate is required. When `configuration` is omitted, rules are resolved from the
gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.
operationId: TriggerDeploymentGatesEvaluation
requestBody:
content:
application/json:
examples:
default:
summary: Evaluate a pre-configured gate
value:
data:
attributes:
Expand All @@ -121755,6 +121881,31 @@ paths:
service: transaction-backend
version: v1.2.3
type: deployment_gates_evaluation_request
with-configuration:
summary: Evaluate with inline rule configuration
value:
data:
attributes:
configuration:
dry_run: false
rules:
- dry_run: false
name: error rate monitors
options:
duration: 300
query: "service:transaction-backend env:production"
type: monitor
- dry_run: false
name: apm faulty deployment
options:
duration: 900
excluded_resources:
- "GET /healthcheck"
type: faulty_deployment_detection
env: production
service: transaction-backend
version: 1.2.3
type: deployment_gates_evaluation_request
schema:
$ref: "#/components/schemas/DeploymentGatesEvaluationRequest"
required: true
Expand Down
56 changes: 56 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11421,6 +11421,13 @@ datadog\_api\_client.v2.model.deployment\_gate\_rules\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_evaluation\_configuration module
---------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_evaluation_configuration
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_evaluation\_request module
---------------------------------------------------------------------------

Expand Down Expand Up @@ -11512,6 +11519,34 @@ datadog\_api\_client.v2.model.deployment\_gates\_evaluation\_result\_response\_d
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_evaluation\_rule module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_evaluation_rule
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_fdd\_rule module
-----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_fdd_rule
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_fdd\_rule\_options module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_fdd_rule_options
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_fdd\_rule\_type module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_fdd_rule_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_list\_response module
----------------------------------------------------------------------

Expand All @@ -11533,6 +11568,27 @@ datadog\_api\_client.v2.model.deployment\_gates\_list\_response\_meta\_page modu
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_monitor\_rule module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_monitor_rule
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_monitor\_rule\_options module
------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_monitor_rule_options
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_monitor\_rule\_type module
---------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.deployment_gates_monitor_rule_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.deployment\_gates\_rule\_response module
----------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi
from datadog_api_client.v2.model.deployment_gates_evaluation_configuration import DeploymentGatesEvaluationConfiguration
from datadog_api_client.v2.model.deployment_gates_evaluation_request import DeploymentGatesEvaluationRequest
from datadog_api_client.v2.model.deployment_gates_evaluation_request_attributes import (
DeploymentGatesEvaluationRequestAttributes,
Expand All @@ -12,10 +13,27 @@
from datadog_api_client.v2.model.deployment_gates_evaluation_request_data_type import (
DeploymentGatesEvaluationRequestDataType,
)
from datadog_api_client.v2.model.deployment_gates_monitor_rule import DeploymentGatesMonitorRule
from datadog_api_client.v2.model.deployment_gates_monitor_rule_options import DeploymentGatesMonitorRuleOptions
from datadog_api_client.v2.model.deployment_gates_monitor_rule_type import DeploymentGatesMonitorRuleType

body = DeploymentGatesEvaluationRequest(
data=DeploymentGatesEvaluationRequestData(
attributes=DeploymentGatesEvaluationRequestAttributes(
configuration=DeploymentGatesEvaluationConfiguration(
dry_run=False,
rules=[
DeploymentGatesMonitorRule(
dry_run=False,
name="error rate monitors",
options=DeploymentGatesMonitorRuleOptions(
duration=300,
query="service:transaction-backend env:production",
),
type=DeploymentGatesMonitorRuleType.MONITOR,
),
],
),
env="staging",
identifier="pre-deploy",
primary_tag="region:us-east-1",
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/api/deployment_gates_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ def trigger_deployment_gates_evaluation(
Returns an evaluation ID that can be used to poll for the result via the
``GET /api/v2/deployments/gates/evaluation/{id}`` endpoint.

When the ``configuration`` attribute is provided, rules are evaluated inline from that configuration
and no pre-configured gate is required. When ``configuration`` is omitted, rules are resolved from the
gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.

:type body: DeploymentGatesEvaluationRequest
:rtype: DeploymentGatesEvaluationResponse
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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_gates_evaluation_rule import DeploymentGatesEvaluationRule
from datadog_api_client.v2.model.deployment_gates_monitor_rule import DeploymentGatesMonitorRule
from datadog_api_client.v2.model.deployment_gates_fdd_rule import DeploymentGatesFDDRule


class DeploymentGatesEvaluationConfiguration(ModelNormal):
validations = {
"rules": {
"min_items": 1,
},
}

@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.deployment_gates_evaluation_rule import DeploymentGatesEvaluationRule

return {
"dry_run": (bool,),
"rules": ([DeploymentGatesEvaluationRule],),
}

attribute_map = {
"dry_run": "dry_run",
"rules": "rules",
}

def __init__(
self_,
rules: List[Union[DeploymentGatesEvaluationRule, DeploymentGatesMonitorRule, DeploymentGatesFDDRule]],
dry_run: Union[bool, UnsetType] = unset,
**kwargs,
):
"""
Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated
directly from this configuration instead of using the pre-configured gate rules.
At least one rule is required.

:param dry_run: Gate-level dry run. When enabled, the rules are evaluated normally but the gate always returns ``pass``. The real result is visible in the Datadog UI.
:type dry_run: bool, optional

:param rules: The list of rules to evaluate. At least one rule is required.
:type rules: [DeploymentGatesEvaluationRule]
"""
if dry_run is not unset:
kwargs["dry_run"] = dry_run
super().__init__(kwargs)

self_.rules = rules
Loading
Loading