diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 809d974e93..e3f87c2ba8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -32282,7 +32282,7 @@ components: options: $ref: "#/components/schemas/DeploymentRulesOptions" type: - description: The type of the deployment rule (faulty_deployment_detection or monitor). + description: The type of the deployment rule (`faulty_deployment_detection`, `monitor`, or `bits_deployment_analysis`). example: "faulty_deployment_detection" type: string required: @@ -43367,10 +43367,10 @@ components: x-enum-varnames: [DEPLOYMENT_GATE_RULE_EVALUATION] DeploymentGateRuleEvaluationType: description: Type of deployment gate rule. - enum: [monitor, faulty_deployment_detection] + enum: [monitor, faulty_deployment_detection, bits_deployment_analysis] example: faulty_deployment_detection type: string - x-enum-varnames: [MONITOR, FAULTY_DEPLOYMENT_DETECTION] + x-enum-varnames: [MONITOR, FAULTY_DEPLOYMENT_DETECTION, BITS_DEPLOYMENT_ANALYSIS] DeploymentGateRuleEvaluationsResponse: description: Paginated deployment gate rule evaluations. properties: @@ -43438,6 +43438,43 @@ components: data: $ref: "#/components/schemas/ListDeploymentRuleResponseData" type: object + DeploymentGatesBitsDeploymentAnalysisRule: + description: A Bits Deployment Analysis rule to evaluate as part of a deployment gate evaluation. + properties: + dry_run: + description: Rule-level dry run. When enabled, Datadog evaluates the rule normally, but the rule always returns `pass`. The real result appears in the Datadog UI. + example: false + type: boolean + name: + description: Human-readable name for this rule. + example: "bits deployment analysis" + type: string + options: + $ref: "#/components/schemas/DeploymentGatesBitsDeploymentAnalysisRuleOptions" + type: + $ref: "#/components/schemas/DeploymentGatesBitsDeploymentAnalysisRuleType" + required: + - type + - name + type: object + DeploymentGatesBitsDeploymentAnalysisRuleOptions: + description: Options for a `bits_deployment_analysis` rule. + properties: + duration: + description: Evaluation window in seconds. Maximum 7200 (2 hours). + example: 900 + format: int64 + maximum: 7200 + type: integer + type: object + DeploymentGatesBitsDeploymentAnalysisRuleType: + description: The type identifier for a Bits Deployment Analysis rule. + enum: + - bits_deployment_analysis + example: bits_deployment_analysis + type: string + x-enum-varnames: + - BITS_DEPLOYMENT_ANALYSIS DeploymentGatesEvaluationConfiguration: description: |- Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated @@ -43647,6 +43684,7 @@ components: oneOf: - $ref: "#/components/schemas/DeploymentGatesMonitorRule" - $ref: "#/components/schemas/DeploymentGatesFDDRule" + - $ref: "#/components/schemas/DeploymentGatesBitsDeploymentAnalysisRule" DeploymentGatesFDDRule: description: A faulty deployment detection rule to evaluate as part of a deployment gate evaluation. properties: @@ -44043,11 +44081,13 @@ components: enum: - faulty_deployment_detection - monitor + - bits_deployment_analysis example: faulty_deployment_detection type: string x-enum-varnames: - FAULTY_DEPLOYMENT_DETECTION - MONITOR + - BITS_DEPLOYMENT_ANALYSIS DeploymentRuleResponseDataAttributesUpdatedBy: description: Information about the user who updated the deployment rule. properties: @@ -44067,7 +44107,9 @@ components: - id type: object DeploymentRulesOptions: - description: Options for deployment rule response representing either faulty deployment detection or monitor options. + description: |- + Options for deployment rule response representing either faulty deployment detection or monitor options. + Bits Deployment Analysis rules use the faulty deployment detection options shape and accept only `duration`. oneOf: - $ref: "#/components/schemas/DeploymentRuleOptionsFaultyDeploymentDetection" - $ref: "#/components/schemas/DeploymentRuleOptionsMonitor" diff --git a/examples/v2/deployment-gates/CreateDeploymentRule_2546866693.py b/examples/v2/deployment-gates/CreateDeploymentRule_2546866693.py new file mode 100644 index 0000000000..767c3a3c38 --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentRule_2546866693.py @@ -0,0 +1,42 @@ +""" +Create bits deployment analysis deployment rule 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_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, +) + +# 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="Bits deployment analysis rule", + options=DeploymentRuleOptionsFaultyDeploymentDetection( + duration=900, + ), + type="bits_deployment_analysis", + ), + type=DeploymentRuleDataType.DEPLOYMENT_RULE, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +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) diff --git a/examples/v2/deployment-gates/TriggerDeploymentGatesEvaluation_17574267.py b/examples/v2/deployment-gates/TriggerDeploymentGatesEvaluation_17574267.py new file mode 100644 index 0000000000..1a375c25ae --- /dev/null +++ b/examples/v2/deployment-gates/TriggerDeploymentGatesEvaluation_17574267.py @@ -0,0 +1,61 @@ +""" +Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns "Accepted" 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.deployment_gates_bits_deployment_analysis_rule import ( + DeploymentGatesBitsDeploymentAnalysisRule, +) +from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_options import ( + DeploymentGatesBitsDeploymentAnalysisRuleOptions, +) +from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_type import ( + DeploymentGatesBitsDeploymentAnalysisRuleType, +) +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, +) +from datadog_api_client.v2.model.deployment_gates_evaluation_request_data import DeploymentGatesEvaluationRequestData +from datadog_api_client.v2.model.deployment_gates_evaluation_request_data_type import ( + DeploymentGatesEvaluationRequestDataType, +) + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ATTRIBUTES_IDENTIFIER = environ["DEPLOYMENT_GATE_DATA_ATTRIBUTES_IDENTIFIER"] + +body = DeploymentGatesEvaluationRequest( + data=DeploymentGatesEvaluationRequestData( + attributes=DeploymentGatesEvaluationRequestAttributes( + configuration=DeploymentGatesEvaluationConfiguration( + dry_run=False, + rules=[ + DeploymentGatesBitsDeploymentAnalysisRule( + dry_run=False, + name="bits deployment analysis", + options=DeploymentGatesBitsDeploymentAnalysisRuleOptions( + duration=900, + ), + type=DeploymentGatesBitsDeploymentAnalysisRuleType.BITS_DEPLOYMENT_ANALYSIS, + ), + ], + ), + env="production", + identifier=DEPLOYMENT_GATE_DATA_ATTRIBUTES_IDENTIFIER, + service="my-service", + ), + type=DeploymentGatesEvaluationRequestDataType.DEPLOYMENT_GATES_EVALUATION_REQUEST, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["trigger_deployment_gates_evaluation"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.trigger_deployment_gates_evaluation(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py b/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py index 7c9356c145..40baf98f26 100644 --- a/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py +++ b/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py @@ -64,9 +64,10 @@ def __init__( :type name: str :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + Bits Deployment Analysis rules use the faulty deployment detection options shape and accept only ``duration``. :type options: DeploymentRulesOptions - :param type: The type of the deployment rule (faulty_deployment_detection or monitor). + :param type: The type of the deployment rule ( ``faulty_deployment_detection`` , ``monitor`` , or ``bits_deployment_analysis`` ). :type type: str """ if dry_run is not unset: diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py index 4b52656a3b..4b5c07b97e 100644 --- a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py @@ -16,16 +16,18 @@ class DeploymentGateRuleEvaluationType(ModelSimple): """ Type of deployment gate rule. - :param value: Must be one of ["monitor", "faulty_deployment_detection"]. + :param value: Must be one of ["monitor", "faulty_deployment_detection", "bits_deployment_analysis"]. :type value: str """ allowed_values = { "monitor", "faulty_deployment_detection", + "bits_deployment_analysis", } MONITOR: ClassVar["DeploymentGateRuleEvaluationType"] FAULTY_DEPLOYMENT_DETECTION: ClassVar["DeploymentGateRuleEvaluationType"] + BITS_DEPLOYMENT_ANALYSIS: ClassVar["DeploymentGateRuleEvaluationType"] @cached_property def openapi_types(_): @@ -38,3 +40,4 @@ def openapi_types(_): DeploymentGateRuleEvaluationType.FAULTY_DEPLOYMENT_DETECTION = DeploymentGateRuleEvaluationType( "faulty_deployment_detection" ) +DeploymentGateRuleEvaluationType.BITS_DEPLOYMENT_ANALYSIS = DeploymentGateRuleEvaluationType("bits_deployment_analysis") diff --git a/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule.py b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule.py new file mode 100644 index 0000000000..1014dfcbe7 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule.py @@ -0,0 +1,79 @@ +# 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, 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_bits_deployment_analysis_rule_options import ( + DeploymentGatesBitsDeploymentAnalysisRuleOptions, + ) + from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_type import ( + DeploymentGatesBitsDeploymentAnalysisRuleType, + ) + + +class DeploymentGatesBitsDeploymentAnalysisRule(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_options import ( + DeploymentGatesBitsDeploymentAnalysisRuleOptions, + ) + from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_type import ( + DeploymentGatesBitsDeploymentAnalysisRuleType, + ) + + return { + "dry_run": (bool,), + "name": (str,), + "options": (DeploymentGatesBitsDeploymentAnalysisRuleOptions,), + "type": (DeploymentGatesBitsDeploymentAnalysisRuleType,), + } + + attribute_map = { + "dry_run": "dry_run", + "name": "name", + "options": "options", + "type": "type", + } + + def __init__( + self_, + name: str, + type: DeploymentGatesBitsDeploymentAnalysisRuleType, + dry_run: Union[bool, UnsetType] = unset, + options: Union[DeploymentGatesBitsDeploymentAnalysisRuleOptions, UnsetType] = unset, + **kwargs, + ): + """ + A Bits Deployment Analysis rule to evaluate as part of a deployment gate evaluation. + + :param dry_run: Rule-level dry run. When enabled, Datadog evaluates the rule normally, but the rule always returns ``pass``. The real result appears in the Datadog UI. + :type dry_run: bool, optional + + :param name: Human-readable name for this rule. + :type name: str + + :param options: Options for a ``bits_deployment_analysis`` rule. + :type options: DeploymentGatesBitsDeploymentAnalysisRuleOptions, optional + + :param type: The type identifier for a Bits Deployment Analysis rule. + :type type: DeploymentGatesBitsDeploymentAnalysisRuleType + """ + if dry_run is not unset: + kwargs["dry_run"] = dry_run + if options is not unset: + kwargs["options"] = options + super().__init__(kwargs) + + self_.name = name + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_options.py b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_options.py new file mode 100644 index 0000000000..1f4f75d5fb --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_options.py @@ -0,0 +1,42 @@ +# 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 DeploymentGatesBitsDeploymentAnalysisRuleOptions(ModelNormal): + validations = { + "duration": { + "inclusive_maximum": 7200, + }, + } + + @cached_property + def openapi_types(_): + return { + "duration": (int,), + } + + attribute_map = { + "duration": "duration", + } + + def __init__(self_, duration: Union[int, UnsetType] = unset, **kwargs): + """ + Options for a ``bits_deployment_analysis`` rule. + + :param duration: Evaluation window in seconds. Maximum 7200 (2 hours). + :type duration: int, optional + """ + if duration is not unset: + kwargs["duration"] = duration + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_type.py b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_type.py new file mode 100644 index 0000000000..57400fb7ec --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gates_bits_deployment_analysis_rule_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentGatesBitsDeploymentAnalysisRuleType(ModelSimple): + """ + The type identifier for a Bits Deployment Analysis rule. + + :param value: If omitted defaults to "bits_deployment_analysis". Must be one of ["bits_deployment_analysis"]. + :type value: str + """ + + allowed_values = { + "bits_deployment_analysis", + } + BITS_DEPLOYMENT_ANALYSIS: ClassVar["DeploymentGatesBitsDeploymentAnalysisRuleType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentGatesBitsDeploymentAnalysisRuleType.BITS_DEPLOYMENT_ANALYSIS = DeploymentGatesBitsDeploymentAnalysisRuleType( + "bits_deployment_analysis" +) diff --git a/src/datadog_api_client/v2/model/deployment_gates_evaluation_configuration.py b/src/datadog_api_client/v2/model/deployment_gates_evaluation_configuration.py index 4c819664f7..e3c9847726 100644 --- a/src/datadog_api_client/v2/model/deployment_gates_evaluation_configuration.py +++ b/src/datadog_api_client/v2/model/deployment_gates_evaluation_configuration.py @@ -17,6 +17,9 @@ 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 + from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule import ( + DeploymentGatesBitsDeploymentAnalysisRule, + ) class DeploymentGatesEvaluationConfiguration(ModelNormal): @@ -42,7 +45,14 @@ def openapi_types(_): def __init__( self_, - rules: List[Union[DeploymentGatesEvaluationRule, DeploymentGatesMonitorRule, DeploymentGatesFDDRule]], + rules: List[ + Union[ + DeploymentGatesEvaluationRule, + DeploymentGatesMonitorRule, + DeploymentGatesFDDRule, + DeploymentGatesBitsDeploymentAnalysisRule, + ] + ], dry_run: Union[bool, UnsetType] = unset, **kwargs, ): diff --git a/src/datadog_api_client/v2/model/deployment_gates_evaluation_rule.py b/src/datadog_api_client/v2/model/deployment_gates_evaluation_rule.py index 20be32422a..5c836a9482 100644 --- a/src/datadog_api_client/v2/model/deployment_gates_evaluation_rule.py +++ b/src/datadog_api_client/v2/model/deployment_gates_evaluation_rule.py @@ -40,10 +40,14 @@ def _composed_schemas(_): # loading from datadog_api_client.v2.model.deployment_gates_monitor_rule import DeploymentGatesMonitorRule from datadog_api_client.v2.model.deployment_gates_fdd_rule import DeploymentGatesFDDRule + from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule import ( + DeploymentGatesBitsDeploymentAnalysisRule, + ) return { "oneOf": [ DeploymentGatesMonitorRule, DeploymentGatesFDDRule, + DeploymentGatesBitsDeploymentAnalysisRule, ], } diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py index c3996169ab..a021ff0a9e 100644 --- a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py @@ -107,6 +107,7 @@ def __init__( :type name: str :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + Bits Deployment Analysis rules use the faulty deployment detection options shape and accept only ``duration``. :type options: DeploymentRulesOptions :param type: The type of the deployment rule. diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py index bce3d06f20..a6a48132ec 100644 --- a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py @@ -16,16 +16,18 @@ class DeploymentRuleResponseDataAttributesType(ModelSimple): """ The type of the deployment rule. - :param value: Must be one of ["faulty_deployment_detection", "monitor"]. + :param value: Must be one of ["faulty_deployment_detection", "monitor", "bits_deployment_analysis"]. :type value: str """ allowed_values = { "faulty_deployment_detection", "monitor", + "bits_deployment_analysis", } FAULTY_DEPLOYMENT_DETECTION: ClassVar["DeploymentRuleResponseDataAttributesType"] MONITOR: ClassVar["DeploymentRuleResponseDataAttributesType"] + BITS_DEPLOYMENT_ANALYSIS: ClassVar["DeploymentRuleResponseDataAttributesType"] @cached_property def openapi_types(_): @@ -38,3 +40,6 @@ def openapi_types(_): "faulty_deployment_detection" ) DeploymentRuleResponseDataAttributesType.MONITOR = DeploymentRuleResponseDataAttributesType("monitor") +DeploymentRuleResponseDataAttributesType.BITS_DEPLOYMENT_ANALYSIS = DeploymentRuleResponseDataAttributesType( + "bits_deployment_analysis" +) diff --git a/src/datadog_api_client/v2/model/deployment_rules_options.py b/src/datadog_api_client/v2/model/deployment_rules_options.py index 72c4cad60c..7f42981a8f 100644 --- a/src/datadog_api_client/v2/model/deployment_rules_options.py +++ b/src/datadog_api_client/v2/model/deployment_rules_options.py @@ -14,6 +14,7 @@ class DeploymentRulesOptions(ModelComposed): def __init__(self, **kwargs): """ Options for deployment rule response representing either faulty deployment detection or monitor options. + Bits Deployment Analysis rules use the faulty deployment detection options shape and accept only ``duration``. :param allowed_resources: Resources to include in faulty deployment detection. Mutually exclusive with `excluded_resources`. :type allowed_resources: [str], optional diff --git a/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py b/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py index e218e18666..1dc791259d 100644 --- a/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py +++ b/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py @@ -59,6 +59,7 @@ def __init__( :type name: str :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + Bits Deployment Analysis rules use the faulty deployment detection options shape and accept only ``duration``. :type options: DeploymentRulesOptions """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8b3adfdfbc..b06ea880a6 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3238,6 +3238,15 @@ from datadog_api_client.v2.model.deployment_gate_rule_failure_narrative import DeploymentGateRuleFailureNarrative from datadog_api_client.v2.model.deployment_gate_rule_failures import DeploymentGateRuleFailures from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse +from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule import ( + DeploymentGatesBitsDeploymentAnalysisRule, +) +from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_options import ( + DeploymentGatesBitsDeploymentAnalysisRuleOptions, +) +from datadog_api_client.v2.model.deployment_gates_bits_deployment_analysis_rule_type import ( + DeploymentGatesBitsDeploymentAnalysisRuleType, +) 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 ( @@ -16384,6 +16393,9 @@ "DeploymentGateRuleFailureNarrative", "DeploymentGateRuleFailures", "DeploymentGateRulesResponse", + "DeploymentGatesBitsDeploymentAnalysisRule", + "DeploymentGatesBitsDeploymentAnalysisRuleOptions", + "DeploymentGatesBitsDeploymentAnalysisRuleType", "DeploymentGatesEvaluationConfiguration", "DeploymentGatesEvaluationRequest", "DeploymentGatesEvaluationRequestAttributes", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 4f0bdf135b..f3f021a319 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -5334,6 +5334,13 @@ "scenario": "Send a failure event returns \"OK\" response", "version": "v2" }, + { + "feature": "Deployment Gates", + "feature_file": "../../v2/features/deployment_gates.feature", + "file": "v2/deployment-gates/create-bits-deployment-analysis-deployment-rule-returns-ok-response.json", + "scenario": "Create bits deployment analysis deployment rule returns \"OK\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "feature_file": "../../v2/features/deployment_gates.feature", @@ -5516,6 +5523,13 @@ "scenario": "Trigger a deployment gates evaluation returns \"Deployment gate not found.\" response", "version": "v2" }, + { + "feature": "Deployment Gates", + "feature_file": "../../v2/features/deployment_gates.feature", + "file": "v2/deployment-gates/trigger-a-deployment-gates-evaluation-with-an-inline-bits-deployment-analysis-rule-returns-accepted-response.json", + "scenario": "Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "feature_file": "../../v2/features/deployment_gates.feature", diff --git a/tests/generated-test/test-runner-data/v2/deployment-gates/create-bits-deployment-analysis-deployment-rule-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/deployment-gates/create-bits-deployment-analysis-deployment-rule-returns-ok-response.json new file mode 100644 index 0000000000..87372ce0b8 --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/deployment-gates/create-bits-deployment-analysis-deployment-rule-returns-ok-response.json @@ -0,0 +1,55 @@ +{ + "api": "DeploymentGates", + "expected_status": 200, + "feature": "Deployment Gates", + "id": "v2/Deployment Gates/Create bits deployment analysis deployment rule returns \"OK\" response", + "operation_id": "CreateDeploymentRule", + "request": { + "body": { + "schema": { + "format": null, + "ref": "CreateDeploymentRuleParams", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Bits deployment analysis rule", + "options": { + "duration": 900 + }, + "type": "bits_deployment_analysis" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "gate_id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "path": "deployment_gate.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/deployment_gates/{gate_id}/rules" + }, + "scenario": "Create bits deployment analysis deployment rule returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-runner-data/v2/deployment-gates/trigger-a-deployment-gates-evaluation-with-an-inline-bits-deployment-analysis-rule-returns-accepted-response.json b/tests/generated-test/test-runner-data/v2/deployment-gates/trigger-a-deployment-gates-evaluation-with-an-inline-bits-deployment-analysis-rule-returns-accepted-response.json new file mode 100644 index 0000000000..8a8ecf04cc --- /dev/null +++ b/tests/generated-test/test-runner-data/v2/deployment-gates/trigger-a-deployment-gates-evaluation-with-an-inline-bits-deployment-analysis-rule-returns-accepted-response.json @@ -0,0 +1,48 @@ +{ + "api": "DeploymentGates", + "expected_status": 202, + "feature": "Deployment Gates", + "id": "v2/Deployment Gates/Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns \"Accepted\" response", + "operation_id": "TriggerDeploymentGatesEvaluation", + "request": { + "body": { + "schema": { + "format": null, + "ref": "DeploymentGatesEvaluationRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "configuration": { + "dry_run": false, + "rules": [ + { + "dry_run": false, + "name": "bits deployment analysis", + "options": { + "duration": 900 + }, + "type": "bits_deployment_analysis" + } + ] + }, + "env": "production", + "identifier": "{{ deployment_gate.data.attributes.identifier }}", + "service": "my-service" + }, + "type": "deployment_gates_evaluation_request" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/deployments/gates/evaluation" + }, + "scenario": "Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns \"Accepted\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/tests/generated-test/test-server-data/v2/deployment-gates.json b/tests/generated-test/test-server-data/v2/deployment-gates.json index 3d2525996a..be4298816d 100644 --- a/tests/generated-test/test-server-data/v2/deployment-gates.json +++ b/tests/generated-test/test-server-data/v2/deployment-gates.json @@ -1,6 +1,124 @@ { "feature": "Deployment Gates", "recordings": [ + { + "feature": "Deployment Gates", + "frozen_at": "2026-11-13T14:16:52.599Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "env": "production", + "identifier": "my-gate-testcreatebitsdeploymentanalysisdeploymentrulereturnsokresponse1794579412", + "service": "my-service" + }, + "type": "deployment_gate" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"33fe177b-ec9e-46a0-bf75-1e338fb930b6\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2026-11-13T14:16:53.738322Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testcreatebitsdeploymentanalysisdeploymentrulereturnsokresponse1794579412\",\"service\":\"my-service\",\"updated_at\":\"2026-11-13T14:16:53.738322Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "name": "Bits deployment analysis rule", + "options": { + "duration": 900 + }, + "type": "bits_deployment_analysis" + }, + "type": "deployment_rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates/33fe177b-ec9e-46a0-bf75-1e338fb930b6/rules", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"3c9bd129-87b5-4d87-9de9-ce09321997b4\",\"type\":\"deployment_rule\",\"attributes\":{\"created_at\":\"2026-11-13T14:16:54.335953Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"gate_id\":\"33fe177b-ec9e-46a0-bf75-1e338fb930b6\",\"name\":\"Bits deployment analysis rule\",\"options\":{\"duration\":900},\"type\":\"bits_deployment_analysis\",\"updated_at\":\"2026-11-13T14:16:54.335953Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/33fe177b-ec9e-46a0-bf75-1e338fb930b6/rules/3c9bd129-87b5-4d87-9de9-ce09321997b4", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/33fe177b-ec9e-46a0-bf75-1e338fb930b6", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create bits deployment analysis deployment rule returns \"OK\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "frozen_at": "2025-10-28T14:03:25.410Z", @@ -2393,6 +2511,113 @@ "scenario": "Trigger a deployment gates evaluation returns \"Deployment gate not found.\" response", "version": "v2" }, + { + "feature": "Deployment Gates", + "frozen_at": "2026-11-13T14:16:54.911Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "dry_run": false, + "env": "production", + "identifier": "my-gate-testtriggeradeploymentgatesevaluationwithaninlinebitsdeploymentanalysisrulereturnsaccepted1794579414", + "service": "my-service" + }, + "type": "deployment_gate" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployment_gates", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"7f16604d-5a13-4eb1-9e72-7df75de58af7\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2026-11-13T14:16:55.09619Z\",\"created_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"},\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testtriggeradeploymentgatesevaluationwithaninlinebitsdeploymentanalysisrulereturnsaccepted1794579414\",\"service\":\"my-service\",\"updated_at\":\"2026-11-13T14:16:55.09619Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "configuration": { + "dry_run": false, + "rules": [ + { + "dry_run": false, + "name": "bits deployment analysis", + "options": { + "duration": 900 + }, + "type": "bits_deployment_analysis" + } + ] + }, + "env": "production", + "identifier": "my-gate-testtriggeradeploymentgatesevaluationwithaninlinebitsdeploymentanalysisrulereturnsaccepted1794579414", + "service": "my-service" + }, + "type": "deployment_gates_evaluation_request" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/deployments/gates/evaluation", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"a194edb1-cf31-41b2-9544-821054a377e7\",\"type\":\"deployment_gates_evaluation_response\",\"attributes\":{\"evaluation_id\":\"a194edb1-cf31-41b2-9544-821054a377e7\"}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/deployment_gates/7f16604d-5a13-4eb1-9e72-7df75de58af7", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Deployment Gates", "frozen_at": "2025-10-28T14:03:35.734Z", diff --git a/tests/v2/features/deployment_gates.feature b/tests/v2/features/deployment_gates.feature index 90df4cad68..7d78cbaf47 100644 --- a/tests/v2/features/deployment_gates.feature +++ b/tests/v2/features/deployment_gates.feature @@ -10,6 +10,17 @@ Feature: Deployment Gates And a valid "appKeyAuth" key in the system And an instance of "DeploymentGates" API + @team:ddoghq/ci-app-backend + Scenario: Create bits deployment analysis deployment rule returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Bits deployment analysis rule", "options": {"duration": 900}, "type": "bits_deployment_analysis"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.type" is equal to "bits_deployment_analysis" + @team:ddoghq/ci-app-backend Scenario: Create deployment gate returns "Bad Request" response Given operation "CreateDeploymentGate" enabled @@ -406,6 +417,16 @@ Feature: Deployment Gates When the request is sent Then the response status is 404 Deployment gate not found. + @team:ddoghq/ci-app-backend + Scenario: Trigger a deployment gates evaluation with an inline bits deployment analysis rule returns "Accepted" response + Given operation "TriggerDeploymentGatesEvaluation" enabled + And there is a valid "deployment_gate" in the system + And new "TriggerDeploymentGatesEvaluation" request + And body with value {"data": {"attributes": {"configuration": {"dry_run": false, "rules": [{"dry_run": false, "name": "bits deployment analysis", "options": {"duration": 900}, "type": "bits_deployment_analysis"}]}, "env": "production", "identifier": "{{ deployment_gate.data.attributes.identifier }}", "service": "my-service"}, "type": "deployment_gates_evaluation_request"}} + When the request is sent + Then the response status is 202 Accepted + And the response "data.type" is equal to "deployment_gates_evaluation_response" + @team:ddoghq/ci-app-backend Scenario: Update deployment gate returns "Bad Request" response Given operation "UpdateDeploymentGate" enabled