Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 422 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions examples/v2/fleet-automation/CancelFleetDeployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Cancel a deployment returns "Deployment successfully canceled." response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.cancelFleetDeployment"] = true;
const apiInstance = new v2.FleetAutomationApi(configuration);

const params: v2.FleetAutomationApiCancelFleetDeploymentRequest = {
deploymentId: "deployment_id",
};

apiInstance
.cancelFleetDeployment(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
40 changes: 40 additions & 0 deletions examples/v2/fleet-automation/CreateFleetDeploymentConfigure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Create a deployment returns "CREATED" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createFleetDeploymentConfigure"] = true;
const apiInstance = new v2.FleetAutomationApi(configuration);

const params: v2.FleetAutomationApiCreateFleetDeploymentConfigureRequest = {
body: {
data: {
attributes: {
configOperations: [
{
fileOp: "merge-patch",
filePath: "/datadog.yaml",
patch: {
apm_config: "{'enabled': True}",
log_level: "debug",
logs_enabled: "True",
},
},
],
filterQuery: "env:prod AND service:web",
},
type: "deployment",
},
},
};

apiInstance
.createFleetDeploymentConfigure(params)
.then((data: v2.FleetDeploymentResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
25 changes: 25 additions & 0 deletions examples/v2/fleet-automation/GetFleetDeployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Get a deployment by ID returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.getFleetDeployment"] = true;
const apiInstance = new v2.FleetAutomationApi(configuration);

// there is a valid "deployment" in the system
const DEPLOYMENT_ID = process.env.DEPLOYMENT_ID as string;

const params: v2.FleetAutomationApiGetFleetDeploymentRequest = {
deploymentId: DEPLOYMENT_ID,
};

apiInstance
.getFleetDeployment(params)
.then((data: v2.FleetDeploymentResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
18 changes: 18 additions & 0 deletions examples/v2/fleet-automation/ListFleetDeployments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* List all deployments returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listFleetDeployments"] = true;
const apiInstance = new v2.FleetAutomationApi(configuration);

apiInstance
.listFleetDeployments()
.then((data: v2.FleetDeploymentsResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
32 changes: 32 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,38 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
"v1.Validate": {
"operationResponseType": "AuthenticationValidationResponse",
},
"v2.ListFleetDeployments": {
"pageSize": {
"type": "number",
"format": "int64",
},
"pageOffset": {
"type": "number",
"format": "int64",
},
"operationResponseType": "FleetDeploymentsResponse",
},
"v2.CreateFleetDeploymentConfigure": {
"body": {
"type": "FleetDeploymentConfigureCreateRequest",
"format": "",
},
"operationResponseType": "FleetDeploymentResponse",
},
"v2.GetFleetDeployment": {
"deploymentId": {
"type": "string",
"format": "",
},
"operationResponseType": "FleetDeploymentResponse",
},
"v2.CancelFleetDeployment": {
"deploymentId": {
"type": "string",
"format": "",
},
"operationResponseType": "{}",
},
"v2.ListDatastores": {
"operationResponseType": "DatastoreArray",
},
Expand Down
89 changes: 89 additions & 0 deletions features/v2/fleet_automation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
@endpoint(fleet-automation) @endpoint(fleet-automation-v2)
Feature: Fleet Automation
Manage automated deployments across your fleet of hosts. Use these
endpoints to create, retrieve, and cancel deployments that apply
configuration changes to multiple hosts at once.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "FleetAutomation" API

@generated @skip @team:DataDog/fleet-automation
Scenario: Cancel a deployment returns "Bad Request" response
Given operation "CancelFleetDeployment" enabled
And new "CancelFleetDeployment" request
And request contains "deployment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/fleet-automation
Scenario: Cancel a deployment returns "Deployment successfully canceled." response
Given operation "CancelFleetDeployment" enabled
And new "CancelFleetDeployment" request
And request contains "deployment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 204 Deployment successfully canceled.

@generated @skip @team:DataDog/fleet-automation
Scenario: Cancel a deployment returns "Not Found" response
Given operation "CancelFleetDeployment" enabled
And new "CancelFleetDeployment" request
And request contains "deployment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/fleet-automation
Scenario: Create a deployment returns "Bad Request" response
Given operation "CreateFleetDeploymentConfigure" enabled
And new "CreateFleetDeploymentConfigure" request
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"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/fleet-automation
Scenario: Create a deployment returns "CREATED" response
Given operation "CreateFleetDeploymentConfigure" enabled
And new "CreateFleetDeploymentConfigure" request
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"}}
When the request is sent
Then the response status is 201 CREATED

@generated @skip @team:DataDog/fleet-automation
Scenario: Get a deployment by ID returns "Bad Request" response
Given operation "GetFleetDeployment" enabled
And new "GetFleetDeployment" request
And request contains "deployment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/fleet-automation
Scenario: Get a deployment by ID returns "Not Found" response
Given operation "GetFleetDeployment" enabled
And new "GetFleetDeployment" request
And request contains "deployment_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@skip @team:DataDog/fleet-automation
Scenario: Get a deployment by ID returns "OK" response
Given operation "GetFleetDeployment" enabled
And there is a valid "deployment" in the system
And new "GetFleetDeployment" request
And request contains "deployment_id" parameter from "deployment.id"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/fleet-automation
Scenario: List all deployments returns "Bad Request" response
Given operation "ListFleetDeployments" enabled
And new "ListFleetDeployments" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/fleet-automation
Scenario: List all deployments returns "OK" response
Given operation "ListFleetDeployments" enabled
And new "ListFleetDeployments" request
When the request is sent
Then the response status is 200 OK
13 changes: 13 additions & 0 deletions features/v2/given.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
[
{
"parameters": [
{
"name": "body",
"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}"
}
],
"source": "data",
"step": "there is a valid \"deployment\" in the system",
"key": "deployment",
"tag": "Fleet Automation",
"operationId": "CreateFleetDeploymentConfigure"
},
{
"parameters": [
{
Expand Down
31 changes: 31 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
{
"ListFleetDeployments": {
"tag": "Fleet Automation",
"undo": {
"type": "safe"
}
},
"CreateFleetDeploymentConfigure": {
"tag": "Fleet Automation",
"undo": {
"operationId": "CancelFleetDeployment",
"parameters": [
{
"name": "deployment_id",
"source": "data.id"
}
],
"type": "unsafe"
}
},
"GetFleetDeployment": {
"tag": "Fleet Automation",
"undo": {
"type": "safe"
}
},
"CancelFleetDeployment": {
"tag": "Fleet Automation",
"undo": {
"type": "idempotent"
}
},
"ListDatastores": {
"tag": "Actions Datastores",
"undo": {
Expand Down
4 changes: 4 additions & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ export function createConfiguration(
conf.backoffBase || 2,
conf.backoffMultiplier || 2,
{
"v2.cancelFleetDeployment": false,
"v2.createFleetDeploymentConfigure": false,
"v2.getFleetDeployment": false,
"v2.listFleetDeployments": false,
"v2.createOpenAPI": false,
"v2.deleteOpenAPI": false,
"v2.getOpenAPI": false,
Expand Down
Loading