Skip to content

Commit f315158

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
[FA] Add fleet automation config update endpoint (#2911)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 6c1846e commit f315158

28 files changed

+2057
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
@endpoint(fleet-automation) @endpoint(fleet-automation-v2)
2+
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.
6+
7+
Background:
8+
Given a valid "apiKeyAuth" key in the system
9+
And a valid "appKeyAuth" key in the system
10+
And an instance of "FleetAutomation" API
11+
12+
@generated @skip @team:DataDog/fleet-automation
13+
Scenario: Cancel a deployment returns "Bad Request" response
14+
Given operation "CancelFleetDeployment" enabled
15+
And new "CancelFleetDeployment" request
16+
And request contains "deployment_id" parameter from "REPLACE.ME"
17+
When the request is sent
18+
Then the response status is 400 Bad Request
19+
20+
@generated @skip @team:DataDog/fleet-automation
21+
Scenario: Cancel a deployment returns "Deployment successfully canceled." response
22+
Given operation "CancelFleetDeployment" enabled
23+
And new "CancelFleetDeployment" request
24+
And request contains "deployment_id" parameter from "REPLACE.ME"
25+
When the request is sent
26+
Then the response status is 204 Deployment successfully canceled.
27+
28+
@generated @skip @team:DataDog/fleet-automation
29+
Scenario: Cancel a deployment returns "Not Found" response
30+
Given operation "CancelFleetDeployment" enabled
31+
And new "CancelFleetDeployment" request
32+
And request contains "deployment_id" parameter from "REPLACE.ME"
33+
When the request is sent
34+
Then the response status is 404 Not Found
35+
36+
@generated @skip @team:DataDog/fleet-automation
37+
Scenario: Create a deployment returns "Bad Request" response
38+
Given operation "CreateFleetDeploymentConfigure" enabled
39+
And new "CreateFleetDeploymentConfigure" request
40+
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"}}
41+
When the request is sent
42+
Then the response status is 400 Bad Request
43+
44+
@generated @skip @team:DataDog/fleet-automation
45+
Scenario: Create a deployment returns "CREATED" response
46+
Given operation "CreateFleetDeploymentConfigure" enabled
47+
And new "CreateFleetDeploymentConfigure" request
48+
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"}}
49+
When the request is sent
50+
Then the response status is 201 CREATED
51+
52+
@generated @skip @team:DataDog/fleet-automation
53+
Scenario: Get a deployment by ID returns "Bad Request" response
54+
Given operation "GetFleetDeployment" enabled
55+
And new "GetFleetDeployment" request
56+
And request contains "deployment_id" parameter from "REPLACE.ME"
57+
When the request is sent
58+
Then the response status is 400 Bad Request
59+
60+
@generated @skip @team:DataDog/fleet-automation
61+
Scenario: Get a deployment by ID returns "Not Found" response
62+
Given operation "GetFleetDeployment" enabled
63+
And new "GetFleetDeployment" request
64+
And request contains "deployment_id" parameter from "REPLACE.ME"
65+
When the request is sent
66+
Then the response status is 404 Not Found
67+
68+
@skip @team:DataDog/fleet-automation
69+
Scenario: Get a deployment by ID returns "OK" response
70+
Given operation "GetFleetDeployment" enabled
71+
And there is a valid "deployment" in the system
72+
And new "GetFleetDeployment" request
73+
And request contains "deployment_id" parameter from "deployment.id"
74+
When the request is sent
75+
Then the response status is 200 OK
76+
77+
@generated @skip @team:DataDog/fleet-automation
78+
Scenario: List all deployments returns "Bad Request" response
79+
Given operation "ListFleetDeployments" enabled
80+
And new "ListFleetDeployments" request
81+
When the request is sent
82+
Then the response status is 400 Bad Request
83+
84+
@generated @skip @team:DataDog/fleet-automation
85+
Scenario: List all deployments returns "OK" response
86+
Given operation "ListFleetDeployments" enabled
87+
And new "ListFleetDeployments" request
88+
When the request is sent
89+
Then the response status is 200 OK

features/v2/given.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
[
2+
{
3+
"parameters": [
4+
{
5+
"name": "body",
6+
"value": "{\n \"data\": {\n \"type\": \"deployment\",\n \"attributes\": {\n \"filter_query\": \"env:prod AND service:{{ unique_lower }}\",\n \"config_operations\": [\n {\n \"file_op\": \"merge-patch\",\n \"file_path\": \"/datadog.yaml\",\n \"patch\": {\n \"log_level\": \"info\"\n }\n }\n ]\n }\n }\n}"
7+
}
8+
],
9+
"source": "data",
10+
"step": "there is a valid \"deployment\" in the system",
11+
"key": "deployment",
12+
"tag": "Fleet Automation",
13+
"operationId": "CreateFleetDeploymentConfigure"
14+
},
215
{
316
"parameters": [
417
{

features/v2/undo.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
11
{
2+
"ListFleetDeployments": {
3+
"tag": "Fleet Automation",
4+
"undo": {
5+
"type": "safe"
6+
}
7+
},
8+
"CreateFleetDeploymentConfigure": {
9+
"tag": "Fleet Automation",
10+
"undo": {
11+
"operationId": "CancelFleetDeployment",
12+
"parameters": [
13+
{
14+
"name": "deployment_id",
15+
"source": "data.id"
16+
}
17+
],
18+
"type": "unsafe"
19+
}
20+
},
21+
"GetFleetDeployment": {
22+
"tag": "Fleet Automation",
23+
"undo": {
24+
"type": "safe"
25+
}
26+
},
27+
"CancelFleetDeployment": {
28+
"tag": "Fleet Automation",
29+
"undo": {
30+
"type": "idempotent"
31+
}
32+
},
233
"ListDatastores": {
334
"tag": "Actions Datastores",
435
"undo": {

packages/datadog-api-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ apiInstance
383383
| Error Tracking | @datadog/datadog-api-client-error-tracking | [README.md](../../services/error-tracking/README.md) |
384384
| Events | @datadog/datadog-api-client-events | [README.md](../../services/events/README.md) |
385385
| Fastly Integration | @datadog/datadog-api-client-fastly-integration | [README.md](../../services/fastly-integration/README.md) |
386+
| Fleet Automation | @datadog/datadog-api-client-fleet-automation | [README.md](../../services/fleet-automation/README.md) |
386387
| GCP Integration | @datadog/datadog-api-client-gcp-integration | [README.md](../../services/gcp-integration/README.md) |
387388
| Hosts | @datadog/datadog-api-client-hosts | [README.md](../../services/hosts/README.md) |
388389
| Incident Services | @datadog/datadog-api-client-incident-services | [README.md](../../services/incident-services/README.md) |

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,6 +2350,38 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
23502350
"AuthenticationApi.V1.Validate": {
23512351
operationResponseType: "AuthenticationValidationResponse",
23522352
},
2353+
"FleetAutomationApi.V2.ListFleetDeployments": {
2354+
pageSize: {
2355+
type: "number",
2356+
format: "int64",
2357+
},
2358+
pageOffset: {
2359+
type: "number",
2360+
format: "int64",
2361+
},
2362+
operationResponseType: "FleetDeploymentsResponse",
2363+
},
2364+
"FleetAutomationApi.V2.CreateFleetDeploymentConfigure": {
2365+
body: {
2366+
type: "FleetDeploymentConfigureCreateRequest",
2367+
format: "",
2368+
},
2369+
operationResponseType: "FleetDeploymentResponse",
2370+
},
2371+
"FleetAutomationApi.V2.GetFleetDeployment": {
2372+
deploymentId: {
2373+
type: "string",
2374+
format: "",
2375+
},
2376+
operationResponseType: "FleetDeploymentResponse",
2377+
},
2378+
"FleetAutomationApi.V2.CancelFleetDeployment": {
2379+
deploymentId: {
2380+
type: "string",
2381+
format: "",
2382+
},
2383+
operationResponseType: "{}",
2384+
},
23532385
"ActionsDatastoresApi.V2.ListDatastores": {
23542386
operationResponseType: "DatastoreArray",
23552387
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# @datadog/datadog-api-client-fleet-automation
2+
3+
## Description
4+
5+
Manage automated deployments across your fleet of hosts.
6+
Use these endpoints to create, retrieve, and cancel deployments
7+
that apply configuration changes to multiple hosts at once.
8+
9+
## Navigation
10+
11+
- [Installation](#installation)
12+
- [Getting Started](#getting-started)
13+
14+
## Installation
15+
16+
```sh
17+
# NPM
18+
npm install @datadog/datadog-api-client-fleet-automation
19+
# Yarn
20+
yarn add @datadog/datadog-api-client-fleet-automation
21+
```
22+
23+
## Getting Started
24+
```ts
25+
import { createConfiguration } from "@datadog/datadog-api-client";
26+
import { FleetAutomationApiV2 } from "@datadog/datadog-api-client-fleet-automation";
27+
import { v2 } from "@datadog/datadog-api-client-fleet-automation";
28+
29+
const configuration = createConfiguration();
30+
// Enable unstable operations
31+
const configurationOpts = {
32+
unstableOperations: {
33+
"FleetAutomationApi.v2.listFleetDeployments": true
34+
}
35+
}
36+
37+
const configuration = createConfiguration(configurationOpts);
38+
const apiInstance = new FleetAutomationApiV2(configuration);
39+
const params = {/* parameters */};
40+
41+
apiInstance.listFleetDeployments(params).then((data) => {
42+
console.log("API called successfully. Returned data: " + JSON.stringify(data));
43+
}).catch((error) => {
44+
console.error("Error calling API: " + error);
45+
});
46+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@datadog/datadog-api-client-fleet-automation",
3+
"description": "",
4+
"author": "",
5+
"keywords": [
6+
"api",
7+
"fetch",
8+
"typescript"
9+
],
10+
"license": "Apache-2.0",
11+
"licenses": [
12+
{
13+
"type": "Apache-2.0",
14+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
15+
}
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
20+
"directory": "services/fleet-automation"
21+
},
22+
"files": [
23+
"dist/**/*"
24+
],
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"scripts": {
28+
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
29+
"build": "yarn generate-version-files && tsc",
30+
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
31+
},
32+
"dependencies": {
33+
"@datadog/datadog-api-client": "^2.0.0-beta.0"
34+
},
35+
"devDependencies": {
36+
"typescript": "5.8.3"
37+
},
38+
"engines": {
39+
"node": ">=18.0.0"
40+
},
41+
"version": "0.0.1",
42+
"packageManager": "[email protected]"
43+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * as v2 from "./v2";
2+
3+
export { FleetAutomationApi as FleetAutomationApiV2 } from "./v2/FleetAutomationApi";

0 commit comments

Comments
 (0)