Skip to content

Commit 04a50bb

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add new endpoint for listing rules for a gate (#3038)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent f6a0ba3 commit 04a50bb

File tree

13 files changed

+613
-0
lines changed

13 files changed

+613
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17075,6 +17075,12 @@ components:
1707517075
required:
1707617076
- id
1707717077
type: object
17078+
DeploymentGateRulesResponse:
17079+
description: Response for a deployment gate rules.
17080+
properties:
17081+
data:
17082+
$ref: '#/components/schemas/ListDeploymentRuleResponseData'
17083+
type: object
1707817084
DeploymentMetadata:
1707917085
description: Metadata object containing the publication creation information.
1708017086
properties:
@@ -30199,6 +30205,37 @@ components:
3019930205
type: string
3020030206
x-enum-varnames:
3020130207
- LIST_CONNECTIONS_RESPONSE
30208+
ListDeploymentRuleResponseData:
30209+
description: Data for a list of deployment rules.
30210+
properties:
30211+
attributes:
30212+
$ref: '#/components/schemas/ListDeploymentRulesResponseDataAttributes'
30213+
id:
30214+
description: Unique identifier of the deployment rule.
30215+
example: 1111-2222-3333-4444-555566667777
30216+
type: string
30217+
type:
30218+
$ref: '#/components/schemas/ListDeploymentRulesDataType'
30219+
required:
30220+
- type
30221+
- attributes
30222+
- id
30223+
type: object
30224+
ListDeploymentRulesDataType:
30225+
description: List deployment rule resource type.
30226+
enum:
30227+
- list_deployment_rules
30228+
example: list_deployment_rules
30229+
type: string
30230+
x-enum-varnames:
30231+
- LIST_DEPLOYMENT_RULES
30232+
ListDeploymentRulesResponseDataAttributes:
30233+
properties:
30234+
rules:
30235+
items:
30236+
$ref: '#/components/schemas/DeploymentRuleResponseDataAttributes'
30237+
type: array
30238+
type: object
3020230239
ListDevicesResponse:
3020330240
description: List devices response.
3020430241
properties:
@@ -66236,6 +66273,50 @@ paths:
6623666273

6623766274
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6623866275
/api/v2/deployment_gates/{gate_id}/rules:
66276+
get:
66277+
description: Endpoint to get rules for a deployment gate.
66278+
operationId: GetDeploymentGateRules
66279+
parameters:
66280+
- description: The ID of the deployment gate.
66281+
in: path
66282+
name: gate_id
66283+
required: true
66284+
schema:
66285+
type: string
66286+
responses:
66287+
'200':
66288+
content:
66289+
application/json:
66290+
schema:
66291+
$ref: '#/components/schemas/DeploymentGateRulesResponse'
66292+
description: OK
66293+
'400':
66294+
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
66295+
'401':
66296+
$ref: '#/components/responses/UnauthorizedResponse'
66297+
'403':
66298+
$ref: '#/components/responses/ForbiddenResponse'
66299+
'429':
66300+
$ref: '#/components/responses/TooManyRequestsResponse'
66301+
'500':
66302+
content:
66303+
application/json:
66304+
schema:
66305+
$ref: '#/components/schemas/HTTPCIAppErrors'
66306+
description: Internal Server Error
66307+
security:
66308+
- apiKeyAuth: []
66309+
appKeyAuth: []
66310+
summary: Get rules for a deployment gate
66311+
tags:
66312+
- Deployment Gates
66313+
x-permission:
66314+
operator: OR
66315+
permissions:
66316+
- deployment_gates_read
66317+
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
66318+
66319+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6623966320
post:
6624066321
description: Endpoint to create a deployment rule. A gate for the rule must
6624166322
already exist.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-12-10T19:27:22.958Z"
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"log": {
3+
"_recordingName": "Deployment Gates/Get rules for a deployment gate returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "42cfce0685efeac3923b49c239f22198",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 189,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 570,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"dry_run\":false,\"env\":\"production\",\"identifier\":\"my-gate-testgetrulesforadeploymentgatereturnsokresponse1765394842\",\"service\":\"my-service\"},\"type\":\"deployment_gate\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/deployment_gates"
39+
},
40+
"response": {
41+
"bodySize": 573,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 573,
45+
"text": "{\"data\":{\"id\":\"718d7fb4-bbc4-4b69-8a1b-98dda014726d\",\"type\":\"deployment_gate\",\"attributes\":{\"created_at\":\"2025-12-10T19:27:24.004043Z\",\"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-testgetrulesforadeploymentgatereturnsokresponse1765394842\",\"service\":\"my-service\",\"updated_at\":\"2025-12-10T19:27:24.004043Z\",\"updated_by\":{\"id\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\"}}}}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 683,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2025-12-10T19:27:23.712Z",
61+
"time": 378
62+
},
63+
{
64+
"_id": "b5e8c70aad196d0736b7d54d5d8fb062",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 562,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "GET",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v2/deployment_gates/718d7fb4-bbc4-4b69-8a1b-98dda014726d/rules"
82+
},
83+
"response": {
84+
"bodySize": 111,
85+
"content": {
86+
"mimeType": "application/vnd.api+json",
87+
"size": 111,
88+
"text": "{\"data\":{\"id\":\"718d7fb4-bbc4-4b69-8a1b-98dda014726d\",\"type\":\"list_deployment_rules\",\"attributes\":{\"rules\":[]}}}"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/vnd.api+json"
95+
}
96+
],
97+
"headersSize": 681,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2025-12-10T19:27:24.098Z",
104+
"time": 340
105+
},
106+
{
107+
"_id": "b6dc9bafbd4972fbfe63acda919b9dd1",
108+
"_order": 0,
109+
"cache": {},
110+
"request": {
111+
"bodySize": 0,
112+
"cookies": [],
113+
"headers": [
114+
{
115+
"_fromType": "array",
116+
"name": "accept",
117+
"value": "*/*"
118+
}
119+
],
120+
"headersSize": 544,
121+
"httpVersion": "HTTP/1.1",
122+
"method": "DELETE",
123+
"queryString": [],
124+
"url": "https://api.datadoghq.com/api/v2/deployment_gates/718d7fb4-bbc4-4b69-8a1b-98dda014726d"
125+
},
126+
"response": {
127+
"bodySize": 0,
128+
"content": {
129+
"mimeType": "text/plain",
130+
"size": 0
131+
},
132+
"cookies": [],
133+
"headers": [],
134+
"headersSize": 623,
135+
"httpVersion": "HTTP/1.1",
136+
"redirectURL": "",
137+
"status": 204,
138+
"statusText": "No Content"
139+
},
140+
"startedDateTime": "2025-12-10T19:27:24.443Z",
141+
"time": 317
142+
}
143+
],
144+
"pages": [],
145+
"version": "1.2"
146+
}
147+
}

features/v2/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

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,12 @@
13351335
"type": "unsafe"
13361336
}
13371337
},
1338+
"GetDeploymentGateRules": {
1339+
"tag": "Deployment Gates",
1340+
"undo": {
1341+
"type": "safe"
1342+
}
1343+
},
13381344
"CreateDeploymentRule": {
13391345
"tag": "Deployment Gates",
13401346
"undo": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5407,6 +5407,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
54075407
},
54085408
operationResponseType: "DeploymentGateResponse",
54095409
},
5410+
"DeploymentGatesApi.V2.GetDeploymentGateRules": {
5411+
gateId: {
5412+
type: "string",
5413+
format: "",
5414+
},
5415+
operationResponseType: "DeploymentGateRulesResponse",
5416+
},
54105417
"DeploymentGatesApi.V2.CreateDeploymentRule": {
54115418
gateId: {
54125419
type: "string",

0 commit comments

Comments
 (0)