Skip to content

Commit b4e7733

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1943b0b of spec repo
1 parent 27f9b78 commit b4e7733

File tree

9 files changed

+188
-0
lines changed

9 files changed

+188
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16644,6 +16644,14 @@ components:
1664416644
required:
1664516645
- id
1664616646
type: object
16647+
DeploymentGateRulesResponse:
16648+
description: Response for a deployment gate rules.
16649+
properties:
16650+
data:
16651+
items:
16652+
$ref: '#/components/schemas/DeploymentRuleResponseData'
16653+
type: array
16654+
type: object
1664716655
DeploymentMetadata:
1664816656
description: Metadata object containing the publication creation information.
1664916657
properties:
@@ -64391,6 +64399,50 @@ paths:
6439164399

6439264400
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439364401
/api/v2/deployment_gates/{gate_id}/rules:
64402+
get:
64403+
description: Endpoint to get rules for a deployment gate.
64404+
operationId: GetDeploymentGateRules
64405+
parameters:
64406+
- description: The ID of the deployment gate.
64407+
in: path
64408+
name: gate_id
64409+
required: true
64410+
schema:
64411+
type: string
64412+
responses:
64413+
'200':
64414+
content:
64415+
application/json:
64416+
schema:
64417+
$ref: '#/components/schemas/DeploymentGateRulesResponse'
64418+
description: OK
64419+
'400':
64420+
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
64421+
'401':
64422+
$ref: '#/components/responses/UnauthorizedResponse'
64423+
'403':
64424+
$ref: '#/components/responses/ForbiddenResponse'
64425+
'429':
64426+
$ref: '#/components/responses/TooManyRequestsResponse'
64427+
'500':
64428+
content:
64429+
application/json:
64430+
schema:
64431+
$ref: '#/components/schemas/HTTPCIAppErrors'
64432+
description: Internal Server Error
64433+
security:
64434+
- apiKeyAuth: []
64435+
appKeyAuth: []
64436+
summary: Get rules for a deployment gate
64437+
tags:
64438+
- Deployment Gates
64439+
x-permission:
64440+
operator: OR
64441+
permissions:
64442+
- deployment_gates_read
64443+
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
64444+
64445+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439464446
post:
6439564447
description: Endpoint to create a deployment rule. A gate for the rule must
6439664448
already exist.

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,6 +6605,13 @@ datadog\_api\_client.v2.model.deployment\_gate\_response\_data\_attributes\_upda
66056605
:members:
66066606
:show-inheritance:
66076607

6608+
datadog\_api\_client.v2.model.deployment\_gate\_rules\_response module
6609+
----------------------------------------------------------------------
6610+
6611+
.. automodule:: datadog_api_client.v2.model.deployment_gate_rules_response
6612+
:members:
6613+
:show-inheritance:
6614+
66086615
datadog\_api\_client.v2.model.deployment\_metadata module
66096616
---------------------------------------------------------
66106617

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
Get rules for a deployment gate returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi
8+
9+
# there is a valid "deployment_gate" in the system
10+
DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"]
11+
12+
configuration = Configuration()
13+
configuration.unstable_operations["get_deployment_gate_rules"] = True
14+
with ApiClient(configuration) as api_client:
15+
api_instance = DeploymentGatesApi(api_client)
16+
response = api_instance.get_deployment_gate_rules(
17+
gate_id=DEPLOYMENT_GATE_DATA_ID,
18+
)
19+
20+
print(response)

src/datadog_api_client/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ def __init__(
298298
"v2.delete_deployment_gate": False,
299299
"v2.delete_deployment_rule": False,
300300
"v2.get_deployment_gate": False,
301+
"v2.get_deployment_gate_rules": False,
301302
"v2.get_deployment_rule": False,
302303
"v2.update_deployment_gate": False,
303304
"v2.update_deployment_rule": False,

src/datadog_api_client/v2/api/deployment_gates_api.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from datadog_api_client.configuration import Configuration
1010
from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse
1111
from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams
12+
from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse
1213
from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse
1314
from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams
1415
from datadog_api_client.v2.model.update_deployment_rule_params import UpdateDeploymentRuleParams
@@ -146,6 +147,29 @@ def __init__(self, api_client=None):
146147
api_client=api_client,
147148
)
148149

150+
self._get_deployment_gate_rules_endpoint = _Endpoint(
151+
settings={
152+
"response_type": (DeploymentGateRulesResponse,),
153+
"auth": ["apiKeyAuth", "appKeyAuth"],
154+
"endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules",
155+
"operation_id": "get_deployment_gate_rules",
156+
"http_method": "GET",
157+
"version": "v2",
158+
},
159+
params_map={
160+
"gate_id": {
161+
"required": True,
162+
"openapi_types": (str,),
163+
"attribute": "gate_id",
164+
"location": "path",
165+
},
166+
},
167+
headers_map={
168+
"accept": ["application/json"],
169+
},
170+
api_client=api_client,
171+
)
172+
149173
self._get_deployment_rule_endpoint = _Endpoint(
150174
settings={
151175
"response_type": (DeploymentRuleResponse,),
@@ -326,6 +350,23 @@ def get_deployment_gate(
326350

327351
return self._get_deployment_gate_endpoint.call_with_http_info(**kwargs)
328352

353+
def get_deployment_gate_rules(
354+
self,
355+
gate_id: str,
356+
) -> DeploymentGateRulesResponse:
357+
"""Get rules for a deployment gate.
358+
359+
Endpoint to get rules for a deployment gate.
360+
361+
:param gate_id: The ID of the deployment gate.
362+
:type gate_id: str
363+
:rtype: DeploymentGateRulesResponse
364+
"""
365+
kwargs: Dict[str, Any] = {}
366+
kwargs["gate_id"] = gate_id
367+
368+
return self._get_deployment_gate_rules_endpoint.call_with_http_info(**kwargs)
369+
329370
def get_deployment_rule(
330371
self,
331372
gate_id: str,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import List, Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData
18+
19+
20+
class DeploymentGateRulesResponse(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData
24+
25+
return {
26+
"data": ([DeploymentRuleResponseData],),
27+
}
28+
29+
attribute_map = {
30+
"data": "data",
31+
}
32+
33+
def __init__(self_, data: Union[List[DeploymentRuleResponseData], UnsetType] = unset, **kwargs):
34+
"""
35+
Response for a deployment gate rules.
36+
37+
:param data:
38+
:type data: [DeploymentRuleResponseData], optional
39+
"""
40+
if data is not unset:
41+
kwargs["data"] = data
42+
super().__init__(kwargs)

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,7 @@
13341334
from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import (
13351335
DeploymentGateResponseDataAttributesUpdatedBy,
13361336
)
1337+
from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse
13371338
from datadog_api_client.v2.model.deployment_metadata import DeploymentMetadata
13381339
from datadog_api_client.v2.model.deployment_relationship import DeploymentRelationship
13391340
from datadog_api_client.v2.model.deployment_relationship_data import DeploymentRelationshipData
@@ -5916,6 +5917,7 @@
59165917
"DeploymentGateResponseDataAttributes",
59175918
"DeploymentGateResponseDataAttributesCreatedBy",
59185919
"DeploymentGateResponseDataAttributesUpdatedBy",
5920+
"DeploymentGateRulesResponse",
59195921
"DeploymentMetadata",
59205922
"DeploymentRelationship",
59215923
"DeploymentRelationshipData",

tests/v2/features/deployment_gates.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,23 @@ Feature: Deployment Gates
207207
When the request is sent
208208
Then the response status is 200 OK
209209

210+
@generated @skip @team:DataDog/ci-app-backend
211+
Scenario: Get rules for a deployment gate returns "Bad request." response
212+
Given operation "GetDeploymentGateRules" enabled
213+
And new "GetDeploymentGateRules" request
214+
And request contains "gate_id" parameter from "REPLACE.ME"
215+
When the request is sent
216+
Then the response status is 400 Bad request.
217+
218+
@team:DataDog/ci-app-backend
219+
Scenario: Get rules for a deployment gate returns "OK" response
220+
Given there is a valid "deployment_gate" in the system
221+
And operation "GetDeploymentGateRules" enabled
222+
And new "GetDeploymentGateRules" request
223+
And request contains "gate_id" parameter from "deployment_gate.data.id"
224+
When the request is sent
225+
Then the response status is 200 OK
226+
210227
@team:DataDog/ci-app-backend
211228
Scenario: Update deployment gate returns "Bad Request" response
212229
Given operation "UpdateDeploymentGate" enabled

tests/v2/features/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,12 @@
13231323
"type": "unsafe"
13241324
}
13251325
},
1326+
"GetDeploymentGateRules": {
1327+
"tag": "Deployment Gates",
1328+
"undo": {
1329+
"type": "safe"
1330+
}
1331+
},
13261332
"CreateDeploymentRule": {
13271333
"tag": "Deployment Gates",
13281334
"undo": {

0 commit comments

Comments
 (0)