From b4e77330d12dc4a782cdece4ef2726acff787e32 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 21 Nov 2025 12:24:36 +0000 Subject: [PATCH] Regenerate client from commit 1943b0b of spec repo --- .generator/schemas/v2/openapi.yaml | 52 +++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 7 +++ .../GetDeploymentGateRules.py | 20 +++++++ src/datadog_api_client/configuration.py | 1 + .../v2/api/deployment_gates_api.py | 41 +++++++++++++++ .../model/deployment_gate_rules_response.py | 42 +++++++++++++++ src/datadog_api_client/v2/models/__init__.py | 2 + tests/v2/features/deployment_gates.feature | 17 ++++++ tests/v2/features/undo.json | 6 +++ 9 files changed, 188 insertions(+) create mode 100644 examples/v2/deployment-gates/GetDeploymentGateRules.py create mode 100644 src/datadog_api_client/v2/model/deployment_gate_rules_response.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb71549..746ddbe0fc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16644,6 +16644,14 @@ components: required: - id type: object + DeploymentGateRulesResponse: + description: Response for a deployment gate rules. + properties: + data: + items: + $ref: '#/components/schemas/DeploymentRuleResponseData' + type: array + type: object DeploymentMetadata: description: Metadata object containing the publication creation information. properties: @@ -64391,6 +64399,50 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/deployment_gates/{gate_id}/rules: + get: + description: Endpoint to get rules for a deployment gate. + operationId: GetDeploymentGateRules + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentGateRulesResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get rules for a deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: description: Endpoint to create a deployment rule. A gate for the rule must already exist. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 60fdfd49e2..dd198b30b4 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6605,6 +6605,13 @@ datadog\_api\_client.v2.model.deployment\_gate\_response\_data\_attributes\_upda :members: :show-inheritance: +datadog\_api\_client.v2.model.deployment\_gate\_rules\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_rules_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.deployment\_metadata module --------------------------------------------------------- diff --git a/examples/v2/deployment-gates/GetDeploymentGateRules.py b/examples/v2/deployment-gates/GetDeploymentGateRules.py new file mode 100644 index 0000000000..5965500134 --- /dev/null +++ b/examples/v2/deployment-gates/GetDeploymentGateRules.py @@ -0,0 +1,20 @@ +""" +Get rules for a deployment gate 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 + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_deployment_gate_rules"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.get_deployment_gate_rules( + gate_id=DEPLOYMENT_GATE_DATA_ID, + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 665081694b..14ddc09226 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -298,6 +298,7 @@ def __init__( "v2.delete_deployment_gate": False, "v2.delete_deployment_rule": False, "v2.get_deployment_gate": False, + "v2.get_deployment_gate_rules": False, "v2.get_deployment_rule": False, "v2.update_deployment_gate": False, "v2.update_deployment_rule": False, diff --git a/src/datadog_api_client/v2/api/deployment_gates_api.py b/src/datadog_api_client/v2/api/deployment_gates_api.py index 84e3ea50b3..cec0823a93 100644 --- a/src/datadog_api_client/v2/api/deployment_gates_api.py +++ b/src/datadog_api_client/v2/api/deployment_gates_api.py @@ -9,6 +9,7 @@ from datadog_api_client.configuration import Configuration from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams +from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams from datadog_api_client.v2.model.update_deployment_rule_params import UpdateDeploymentRuleParams @@ -146,6 +147,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_deployment_gate_rules_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateRulesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules", + "operation_id": "get_deployment_gate_rules", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "gate_id": { + "required": True, + "openapi_types": (str,), + "attribute": "gate_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_deployment_rule_endpoint = _Endpoint( settings={ "response_type": (DeploymentRuleResponse,), @@ -326,6 +350,23 @@ def get_deployment_gate( return self._get_deployment_gate_endpoint.call_with_http_info(**kwargs) + def get_deployment_gate_rules( + self, + gate_id: str, + ) -> DeploymentGateRulesResponse: + """Get rules for a deployment gate. + + Endpoint to get rules for a deployment gate. + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + :rtype: DeploymentGateRulesResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["gate_id"] = gate_id + + return self._get_deployment_gate_rules_endpoint.call_with_http_info(**kwargs) + def get_deployment_rule( self, gate_id: str, diff --git a/src/datadog_api_client/v2/model/deployment_gate_rules_response.py b/src/datadog_api_client/v2/model/deployment_gate_rules_response.py new file mode 100644 index 0000000000..a0f79cccbc --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rules_response.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 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_response_data import DeploymentRuleResponseData + + +class DeploymentGateRulesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData + + return { + "data": ([DeploymentRuleResponseData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[DeploymentRuleResponseData], UnsetType] = unset, **kwargs): + """ + Response for a deployment gate rules. + + :param data: + :type data: [DeploymentRuleResponseData], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9cece11cff..f28c256289 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1334,6 +1334,7 @@ from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import ( DeploymentGateResponseDataAttributesUpdatedBy, ) +from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse from datadog_api_client.v2.model.deployment_metadata import DeploymentMetadata from datadog_api_client.v2.model.deployment_relationship import DeploymentRelationship from datadog_api_client.v2.model.deployment_relationship_data import DeploymentRelationshipData @@ -5916,6 +5917,7 @@ "DeploymentGateResponseDataAttributes", "DeploymentGateResponseDataAttributesCreatedBy", "DeploymentGateResponseDataAttributesUpdatedBy", + "DeploymentGateRulesResponse", "DeploymentMetadata", "DeploymentRelationship", "DeploymentRelationshipData", diff --git a/tests/v2/features/deployment_gates.feature b/tests/v2/features/deployment_gates.feature index e4023c5650..cb0c5a1262 100644 --- a/tests/v2/features/deployment_gates.feature +++ b/tests/v2/features/deployment_gates.feature @@ -207,6 +207,23 @@ Feature: Deployment Gates When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get rules for a deployment gate returns "Bad request." response + Given operation "GetDeploymentGateRules" enabled + And new "GetDeploymentGateRules" request + And request contains "gate_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @team:DataDog/ci-app-backend + Scenario: Get rules for a deployment gate returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "GetDeploymentGateRules" enabled + And new "GetDeploymentGateRules" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + When the request is sent + Then the response status is 200 OK + @team:DataDog/ci-app-backend Scenario: Update deployment gate returns "Bad Request" response Given operation "UpdateDeploymentGate" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3799e64e63..619834eec8 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1323,6 +1323,12 @@ "type": "unsafe" } }, + "GetDeploymentGateRules": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, "CreateDeploymentRule": { "tag": "Deployment Gates", "undo": {