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.

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
1 change: 1 addition & 0 deletions packages/datadog-api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ apiInstance
| Error Tracking | @datadog/datadog-api-client-error-tracking | [README.md](../../services/error-tracking/README.md) |
| Events | @datadog/datadog-api-client-events | [README.md](../../services/events/README.md) |
| Fastly Integration | @datadog/datadog-api-client-fastly-integration | [README.md](../../services/fastly-integration/README.md) |
| Fleet Automation | @datadog/datadog-api-client-fleet-automation | [README.md](../../services/fleet-automation/README.md) |
| GCP Integration | @datadog/datadog-api-client-gcp-integration | [README.md](../../services/gcp-integration/README.md) |
| Hosts | @datadog/datadog-api-client-hosts | [README.md](../../services/hosts/README.md) |
| Incident Services | @datadog/datadog-api-client-incident-services | [README.md](../../services/incident-services/README.md) |
Expand Down
32 changes: 32 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,38 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
"AuthenticationApi.V1.Validate": {
operationResponseType: "AuthenticationValidationResponse",
},
"FleetAutomationApi.V2.ListFleetDeployments": {
pageSize: {
type: "number",
format: "int64",
},
pageOffset: {
type: "number",
format: "int64",
},
operationResponseType: "FleetDeploymentsResponse",
},
"FleetAutomationApi.V2.CreateFleetDeploymentConfigure": {
body: {
type: "FleetDeploymentConfigureCreateRequest",
format: "",
},
operationResponseType: "FleetDeploymentResponse",
},
"FleetAutomationApi.V2.GetFleetDeployment": {
deploymentId: {
type: "string",
format: "",
},
operationResponseType: "FleetDeploymentResponse",
},
"FleetAutomationApi.V2.CancelFleetDeployment": {
deploymentId: {
type: "string",
format: "",
},
operationResponseType: "{}",
},
"ActionsDatastoresApi.V2.ListDatastores": {
operationResponseType: "DatastoreArray",
},
Expand Down
1 change: 1 addition & 0 deletions services/fleet_automation/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
46 changes: 46 additions & 0 deletions services/fleet_automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# @datadog/datadog-api-client-fleet-automation

## Description

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.

## Navigation

- [Installation](#installation)
- [Getting Started](#getting-started)

## Installation

```sh
# NPM
npm install @datadog/datadog-api-client-fleet-automation
# Yarn
yarn add @datadog/datadog-api-client-fleet-automation
```

## Getting Started
```ts
import { createConfiguration } from "@datadog/datadog-api-client";
import { FleetAutomationApiV2 } from "@datadog/datadog-api-client-fleet-automation";
import { v2 } from "@datadog/datadog-api-client-fleet-automation";

const configuration = createConfiguration();
// Enable unstable operations
const configurationOpts = {
unstableOperations: {
"FleetAutomationApi.v2.listFleetDeployments": true
}
}

const configuration = createConfiguration(configurationOpts);
const apiInstance = new FleetAutomationApiV2(configuration);
const params = {/* parameters */};

apiInstance.listFleetDeployments(params).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}).catch((error) => {
console.error("Error calling API: " + error);
});
```
43 changes: 43 additions & 0 deletions services/fleet_automation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@datadog/datadog-api-client-fleet-automation",
"description": "",
"author": "",
"keywords": [
"api",
"fetch",
"typescript"
],
"license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"repository": {
"type": "git",
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
"directory": "services/fleet-automation"
},
"files": [
"dist/**/*"
],
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
"build": "yarn generate-version-files && tsc",
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
},
"dependencies": {
"@datadog/datadog-api-client": "^2.0.0-beta.0"
},
"devDependencies": {
"typescript": "5.8.3"
},
"engines": {
"node": ">=18.0.0"
},
"version": "0.0.1",
"packageManager": "yarn@4.9.1"
}
3 changes: 3 additions & 0 deletions services/fleet_automation/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as v2 from "./v2";

export { FleetAutomationApi as FleetAutomationApiV2 } from "./v2/FleetAutomationApi";
Loading