Skip to content

Commit e2642e4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
[FA] Add fleet deployments/upgrade endpoint (#2967)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 45bbb0a commit e2642e4

39 files changed

+4248
-90
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 1062 additions & 18 deletions
Large diffs are not rendered by default.

features/v2/fleet_automation.feature

Lines changed: 195 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
@endpoint(fleet-automation) @endpoint(fleet-automation-v2)
22
Feature: Fleet Automation
3-
Manage automated deployments across your fleet of hosts. Use these
4-
endpoints to create, retrieve, and cancel deployments that apply
5-
configuration changes to multiple hosts at once.
3+
Manage automated deployments across your fleet of hosts. Fleet Automation
4+
provides two types of deployments: Configuration Deployments
5+
(`/configure`): - Apply configuration file changes to target hosts -
6+
Support merge-patch operations to update specific configuration fields -
7+
Support delete operations to remove configuration files - Useful for
8+
updating Datadog Agent settings, integration configs, and more Package
9+
Upgrade Deployments (`/upgrade`): - Upgrade the Datadog Agent to specific
10+
versions
611

712
Background:
813
Given a valid "apiKeyAuth" key in the system
@@ -34,37 +39,85 @@ Feature: Fleet Automation
3439
Then the response status is 404 Not Found
3540

3641
@generated @skip @team:DataDog/fleet-automation
37-
Scenario: Create a deployment returns "Bad Request" response
42+
Scenario: Create a configuration deployment returns "Bad Request" response
3843
Given operation "CreateFleetDeploymentConfigure" enabled
3944
And new "CreateFleetDeploymentConfigure" request
4045
And body with value {"data": {"attributes": {"config_operations": [{"file_op": "merge-patch", "file_path": "/datadog.yaml", "patch": {"apm_config": {"enabled": true}, "log_level": "debug", "logs_enabled": true}}], "filter_query": "env:prod AND service:web"}, "type": "deployment"}}
4146
When the request is sent
4247
Then the response status is 400 Bad Request
4348

4449
@generated @skip @team:DataDog/fleet-automation
45-
Scenario: Create a deployment returns "CREATED" response
50+
Scenario: Create a configuration deployment returns "CREATED" response
4651
Given operation "CreateFleetDeploymentConfigure" enabled
4752
And new "CreateFleetDeploymentConfigure" request
4853
And body with value {"data": {"attributes": {"config_operations": [{"file_op": "merge-patch", "file_path": "/datadog.yaml", "patch": {"apm_config": {"enabled": true}, "log_level": "debug", "logs_enabled": true}}], "filter_query": "env:prod AND service:web"}, "type": "deployment"}}
4954
When the request is sent
5055
Then the response status is 201 CREATED
5156

5257
@generated @skip @team:DataDog/fleet-automation
53-
Scenario: Get a deployment by ID returns "Bad Request" response
58+
Scenario: Create a schedule returns "Bad Request" response
59+
Given operation "CreateFleetSchedule" enabled
60+
And new "CreateFleetSchedule" request
61+
And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}}
62+
When the request is sent
63+
Then the response status is 400 Bad Request
64+
65+
@generated @skip @team:DataDog/fleet-automation
66+
Scenario: Create a schedule returns "CREATED" response
67+
Given operation "CreateFleetSchedule" enabled
68+
And new "CreateFleetSchedule" request
69+
And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}}
70+
When the request is sent
71+
Then the response status is 201 CREATED
72+
73+
@generated @skip @team:DataDog/fleet-automation
74+
Scenario: Delete a schedule returns "Bad Request" response
75+
Given operation "DeleteFleetSchedule" enabled
76+
And new "DeleteFleetSchedule" request
77+
And request contains "id" parameter from "REPLACE.ME"
78+
When the request is sent
79+
Then the response status is 400 Bad Request
80+
81+
@generated @skip @team:DataDog/fleet-automation
82+
Scenario: Delete a schedule returns "Not Found" response
83+
Given operation "DeleteFleetSchedule" enabled
84+
And new "DeleteFleetSchedule" request
85+
And request contains "id" parameter from "REPLACE.ME"
86+
When the request is sent
87+
Then the response status is 404 Not Found
88+
89+
@generated @skip @team:DataDog/fleet-automation
90+
Scenario: Delete a schedule returns "Schedule successfully deleted." response
91+
Given operation "DeleteFleetSchedule" enabled
92+
And new "DeleteFleetSchedule" request
93+
And request contains "id" parameter from "REPLACE.ME"
94+
When the request is sent
95+
Then the response status is 204 Schedule successfully deleted.
96+
97+
@generated @skip @team:DataDog/fleet-automation
98+
Scenario: Get a configuration deployment by ID returns "Bad Request" response
5499
Given operation "GetFleetDeployment" enabled
55100
And new "GetFleetDeployment" request
56101
And request contains "deployment_id" parameter from "REPLACE.ME"
57102
When the request is sent
58103
Then the response status is 400 Bad Request
59104

60105
@generated @skip @team:DataDog/fleet-automation
61-
Scenario: Get a deployment by ID returns "Not Found" response
106+
Scenario: Get a configuration deployment by ID returns "Not Found" response
62107
Given operation "GetFleetDeployment" enabled
63108
And new "GetFleetDeployment" request
64109
And request contains "deployment_id" parameter from "REPLACE.ME"
65110
When the request is sent
66111
Then the response status is 404 Not Found
67112

113+
@generated @skip @team:DataDog/fleet-automation
114+
Scenario: Get a configuration deployment by ID returns "OK" response
115+
Given operation "GetFleetDeployment" enabled
116+
And new "GetFleetDeployment" request
117+
And request contains "deployment_id" parameter from "REPLACE.ME"
118+
When the request is sent
119+
Then the response status is 200 OK
120+
68121
@skip @team:DataDog/fleet-automation
69122
Scenario: Get a deployment by ID returns "OK" response
70123
Given operation "GetFleetDeployment" enabled
@@ -74,6 +127,52 @@ Feature: Fleet Automation
74127
When the request is sent
75128
Then the response status is 200 OK
76129

130+
@generated @skip @team:DataDog/fleet-automation
131+
Scenario: Get a schedule by ID returns "Bad Request" response
132+
Given operation "GetFleetSchedule" enabled
133+
And new "GetFleetSchedule" request
134+
And request contains "id" parameter from "REPLACE.ME"
135+
When the request is sent
136+
Then the response status is 400 Bad Request
137+
138+
@generated @skip @team:DataDog/fleet-automation
139+
Scenario: Get a schedule by ID returns "Not Found" response
140+
Given operation "GetFleetSchedule" enabled
141+
And new "GetFleetSchedule" request
142+
And request contains "id" parameter from "REPLACE.ME"
143+
When the request is sent
144+
Then the response status is 404 Not Found
145+
146+
@skip @team:DataDog/fleet-automation
147+
Scenario: Get a schedule by ID returns "OK" response
148+
Given operation "GetFleetSchedule" enabled
149+
And there is a valid "fleet_schedule" in the system
150+
And new "GetFleetSchedule" request
151+
And request contains "id" parameter from "REPLACE.ME"
152+
When the request is sent
153+
Then the response status is 200 OK
154+
155+
@generated @skip @team:DataDog/fleet-automation
156+
Scenario: List all available Agent versions returns "Bad Request" response
157+
Given operation "ListFleetAgentVersions" enabled
158+
And new "ListFleetAgentVersions" request
159+
When the request is sent
160+
Then the response status is 400 Bad Request
161+
162+
@generated @skip @team:DataDog/fleet-automation
163+
Scenario: List all available Agent versions returns "Not Found" response
164+
Given operation "ListFleetAgentVersions" enabled
165+
And new "ListFleetAgentVersions" request
166+
When the request is sent
167+
Then the response status is 404 Not Found
168+
169+
@generated @skip @team:DataDog/fleet-automation
170+
Scenario: List all available Agent versions returns "OK" response
171+
Given operation "ListFleetAgentVersions" enabled
172+
And new "ListFleetAgentVersions" request
173+
When the request is sent
174+
Then the response status is 200 OK
175+
77176
@generated @skip @team:DataDog/fleet-automation
78177
Scenario: List all deployments returns "Bad Request" response
79178
Given operation "ListFleetDeployments" enabled
@@ -87,3 +186,92 @@ Feature: Fleet Automation
87186
And new "ListFleetDeployments" request
88187
When the request is sent
89188
Then the response status is 200 OK
189+
190+
@generated @skip @team:DataDog/fleet-automation
191+
Scenario: List all schedules returns "Bad Request" response
192+
Given operation "ListFleetSchedules" enabled
193+
And new "ListFleetSchedules" request
194+
When the request is sent
195+
Then the response status is 400 Bad Request
196+
197+
@generated @skip @team:DataDog/fleet-automation
198+
Scenario: List all schedules returns "OK" response
199+
Given operation "ListFleetSchedules" enabled
200+
And new "ListFleetSchedules" request
201+
When the request is sent
202+
Then the response status is 200 OK
203+
204+
@generated @skip @team:DataDog/fleet-automation
205+
Scenario: Trigger a schedule deployment returns "Bad Request" response
206+
Given operation "TriggerFleetSchedule" enabled
207+
And new "TriggerFleetSchedule" request
208+
And request contains "id" parameter from "REPLACE.ME"
209+
When the request is sent
210+
Then the response status is 400 Bad Request
211+
212+
@generated @skip @team:DataDog/fleet-automation
213+
Scenario: Trigger a schedule deployment returns "CREATED - Deployment successfully created and started." response
214+
Given operation "TriggerFleetSchedule" enabled
215+
And new "TriggerFleetSchedule" request
216+
And request contains "id" parameter from "REPLACE.ME"
217+
When the request is sent
218+
Then the response status is 201 CREATED - Deployment successfully created and started.
219+
220+
@generated @skip @team:DataDog/fleet-automation
221+
Scenario: Trigger a schedule deployment returns "Not Found" response
222+
Given operation "TriggerFleetSchedule" enabled
223+
And new "TriggerFleetSchedule" request
224+
And request contains "id" parameter from "REPLACE.ME"
225+
When the request is sent
226+
Then the response status is 404 Not Found
227+
228+
@generated @skip @team:DataDog/fleet-automation
229+
Scenario: Update a schedule returns "Bad Request" response
230+
Given operation "UpdateFleetSchedule" enabled
231+
And new "UpdateFleetSchedule" request
232+
And request contains "id" parameter from "REPLACE.ME"
233+
And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}}
234+
When the request is sent
235+
Then the response status is 400 Bad Request
236+
237+
@generated @skip @team:DataDog/fleet-automation
238+
Scenario: Update a schedule returns "Not Found" response
239+
Given operation "UpdateFleetSchedule" enabled
240+
And new "UpdateFleetSchedule" request
241+
And request contains "id" parameter from "REPLACE.ME"
242+
And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}}
243+
When the request is sent
244+
Then the response status is 404 Not Found
245+
246+
@generated @skip @team:DataDog/fleet-automation
247+
Scenario: Update a schedule returns "OK" response
248+
Given operation "UpdateFleetSchedule" enabled
249+
And new "UpdateFleetSchedule" request
250+
And request contains "id" parameter from "REPLACE.ME"
251+
And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}}
252+
When the request is sent
253+
Then the response status is 200 OK
254+
255+
@generated @skip @team:DataDog/fleet-automation
256+
Scenario: Upgrade hosts returns "Bad Request" response
257+
Given operation "CreateFleetDeploymentUpgrade" enabled
258+
And new "CreateFleetDeploymentUpgrade" request
259+
And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}}
260+
When the request is sent
261+
Then the response status is 400 Bad Request
262+
263+
@generated @skip @team:DataDog/fleet-automation
264+
Scenario: Upgrade hosts returns "CREATED" response
265+
Given operation "CreateFleetDeploymentUpgrade" enabled
266+
And new "CreateFleetDeploymentUpgrade" request
267+
And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}}
268+
When the request is sent
269+
Then the response status is 201 CREATED
270+
271+
@generated @skip @team:DataDog/fleet-automation
272+
Scenario: Upgrade hosts returns "Not Found" response
273+
Given operation "CreateFleetDeploymentUpgrade" enabled
274+
And new "CreateFleetDeploymentUpgrade" request
275+
And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}}
276+
When the request is sent
277+
Then the response status is 404 Not Found

features/v2/given.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,32 @@
1212
"tag": "Fleet Automation",
1313
"operationId": "CreateFleetDeploymentConfigure"
1414
},
15+
{
16+
"parameters": [
17+
{
18+
"name": "body",
19+
"value": "{\n \"data\": {\n \"type\": \"deployment\",\n \"attributes\": {\n \"filter_query\": \"env:prod AND service:{{ unique_lower }}\",\n \"target_packages\": [\n {\n \"name\": \"datadog-agent\",\n \"version\": \"7.52.0\"\n }\n ]\n }\n }\n}"
20+
}
21+
],
22+
"source": "data",
23+
"step": "there is a valid \"package_deployment\" in the system",
24+
"key": "package_deployment",
25+
"tag": "Fleet Automation",
26+
"operationId": "CreateFleetDeploymentUpgrade"
27+
},
28+
{
29+
"parameters": [
30+
{
31+
"name": "body",
32+
"value": "{\n \"data\": {\n \"type\": \"schedule\",\n \"attributes\": {\n \"name\": \"Weekly {{ unique }} Updates\",\n \"query\": \"env:prod AND service:{{ unique_lower }}\",\n \"status\": \"active\",\n \"version_to_latest\": 0,\n \"rule\": {\n \"days_of_week\": [\"Mon\"],\n \"start_maintenance_window\": \"02:00\",\n \"maintenance_window_duration\": 120,\n \"timezone\": \"America/New_York\"\n }\n }\n }\n}"
33+
}
34+
],
35+
"source": "data",
36+
"step": "there is a valid \"fleet_schedule\" in the system",
37+
"key": "schedule",
38+
"tag": "Fleet Automation",
39+
"operationId": "CreateFleetSchedule"
40+
},
1541
{
1642
"parameters": [
1743
{

features/v2/undo.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"ListFleetAgentVersions": {
3+
"tag": "Fleet Automation",
4+
"undo": {
5+
"type": "safe"
6+
}
7+
},
28
"ListFleetDeployments": {
39
"tag": "Fleet Automation",
410
"undo": {
@@ -18,6 +24,19 @@
1824
"type": "unsafe"
1925
}
2026
},
27+
"CreateFleetDeploymentUpgrade": {
28+
"tag": "Fleet Automation",
29+
"undo": {
30+
"operationId": "CancelFleetDeployment",
31+
"parameters": [
32+
{
33+
"name": "deployment_id",
34+
"source": "data.id"
35+
}
36+
],
37+
"type": "unsafe"
38+
}
39+
},
2140
"GetFleetDeployment": {
2241
"tag": "Fleet Automation",
2342
"undo": {
@@ -30,6 +49,56 @@
3049
"type": "idempotent"
3150
}
3251
},
52+
"ListFleetSchedules": {
53+
"tag": "Fleet Automation",
54+
"undo": {
55+
"type": "safe"
56+
}
57+
},
58+
"CreateFleetSchedule": {
59+
"tag": "Fleet Automation",
60+
"undo": {
61+
"operationId": "DeleteFleetSchedule",
62+
"parameters": [
63+
{
64+
"name": "id",
65+
"source": "data.id"
66+
}
67+
],
68+
"type": "unsafe"
69+
}
70+
},
71+
"DeleteFleetSchedule": {
72+
"tag": "Fleet Automation",
73+
"undo": {
74+
"type": "unsafe"
75+
}
76+
},
77+
"GetFleetSchedule": {
78+
"tag": "Fleet Automation",
79+
"undo": {
80+
"type": "safe"
81+
}
82+
},
83+
"UpdateFleetSchedule": {
84+
"tag": "Fleet Automation",
85+
"undo": {
86+
"type": "idempotent"
87+
}
88+
},
89+
"TriggerFleetSchedule": {
90+
"tag": "Fleet Automation",
91+
"undo": {
92+
"operationId": "CancelFleetDeployment",
93+
"parameters": [
94+
{
95+
"name": "deployment_id",
96+
"source": "data.id"
97+
}
98+
],
99+
"type": "unsafe"
100+
}
101+
},
33102
"ListDatastores": {
34103
"tag": "Actions Datastores",
35104
"undo": {

0 commit comments

Comments
 (0)