From 621abb990c1492e6469c698a39aff81d484022ca Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 23 Oct 2025 11:33:35 +0000 Subject: [PATCH] Regenerate client from commit e118b2e of spec repo --- .generator/schemas/v2/openapi.yaml | 422 ++++++++++++ features/v2/fleet_automation.feature | 89 +++ features/v2/given.json | 13 + features/v2/undo.json | 31 + packages/datadog-api-client/README.md | 1 + .../src/support/scenarios_model_mapping.ts | 32 + services/fleet_automation/.yarnrc.yml | 1 + services/fleet_automation/README.md | 46 ++ services/fleet_automation/package.json | 43 ++ services/fleet_automation/src/index.ts | 3 + .../src/v2/FleetAutomationApi.ts | 648 ++++++++++++++++++ services/fleet_automation/src/v2/index.ts | 21 + .../src/v2/models/APIErrorResponse.ts | 45 ++ .../src/v2/models/FleetDeployment.ts | 66 ++ .../v2/models/FleetDeploymentAttributes.ts | 80 +++ .../FleetDeploymentConfigureAttributes.ts | 55 ++ .../models/FleetDeploymentConfigureCreate.ts | 57 ++ .../FleetDeploymentConfigureCreateRequest.ts | 47 ++ .../src/v2/models/FleetDeploymentFileOp.ts | 14 + .../src/v2/models/FleetDeploymentOperation.ts | 71 ++ .../v2/models/FleetDeploymentResourceType.ts | 7 + .../src/v2/models/FleetDeploymentResponse.ts | 46 ++ .../src/v2/models/FleetDeploymentsPage.ts | 45 ++ .../src/v2/models/FleetDeploymentsResponse.ts | 56 ++ .../v2/models/FleetDeploymentsResponseMeta.ts | 46 ++ .../src/v2/models/TypingInfo.ts | 35 + services/fleet_automation/tsconfig.json | 28 + yarn.lock | 9 + 28 files changed, 2057 insertions(+) create mode 100644 features/v2/fleet_automation.feature create mode 100644 services/fleet_automation/.yarnrc.yml create mode 100644 services/fleet_automation/README.md create mode 100644 services/fleet_automation/package.json create mode 100644 services/fleet_automation/src/index.ts create mode 100644 services/fleet_automation/src/v2/FleetAutomationApi.ts create mode 100644 services/fleet_automation/src/v2/index.ts create mode 100644 services/fleet_automation/src/v2/models/APIErrorResponse.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeployment.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentAttributes.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentConfigureAttributes.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreate.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreateRequest.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentFileOp.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentOperation.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentResourceType.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentResponse.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentsPage.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentsResponse.ts create mode 100644 services/fleet_automation/src/v2/models/FleetDeploymentsResponseMeta.ts create mode 100644 services/fleet_automation/src/v2/models/TypingInfo.ts create mode 100644 services/fleet_automation/tsconfig.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 364018c47d51..f35df77478f2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -20093,6 +20093,179 @@ components: - PIPELINES_FAILED_DESCENDING - PIPELINES_DURATION_LOST_ASCENDING - PIPELINES_DURATION_LOST_DESCENDING + FleetDeployment: + description: A deployment that defines automated configuration changes for a + fleet of hosts. + properties: + attributes: + $ref: '#/components/schemas/FleetDeploymentAttributes' + id: + description: Unique identifier for the deployment. + example: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/FleetDeploymentResourceType' + required: + - id + - type + - attributes + type: object + FleetDeploymentAttributes: + description: Attributes of a deployment in the response. + properties: + config_operations: + description: Ordered list of configuration file operations to perform on + the target hosts. + items: + $ref: '#/components/schemas/FleetDeploymentOperation' + type: array + estimated_end_time_unix: + description: Estimated completion time of the deployment as a Unix timestamp + (seconds since epoch). + example: 1699999999 + format: int64 + type: integer + filter_query: + description: Query used to filter and select target hosts for the deployment. + Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + high_level_status: + description: Current high-level status of the deployment (for example, "pending", + "running", "completed", "failed"). + example: pending + type: string + total_hosts: + description: Total number of hosts targeted by this deployment. + example: 42 + format: int64 + type: integer + type: object + FleetDeploymentConfigureAttributes: + description: Attributes for creating a new configuration deployment. + properties: + config_operations: + description: Ordered list of configuration file operations to perform on + the target hosts. + items: + $ref: '#/components/schemas/FleetDeploymentOperation' + type: array + filter_query: + description: Query used to filter and select target hosts for the deployment. + Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + required: + - config_operations + type: object + FleetDeploymentConfigureCreate: + description: Data for creating a new deployment. + properties: + attributes: + $ref: '#/components/schemas/FleetDeploymentConfigureAttributes' + type: + $ref: '#/components/schemas/FleetDeploymentResourceType' + required: + - type + - attributes + type: object + FleetDeploymentConfigureCreateRequest: + description: Request payload for creating a new deployment. + properties: + data: + $ref: '#/components/schemas/FleetDeploymentConfigureCreate' + required: + - data + type: object + FleetDeploymentFileOp: + description: "Type of file operation to perform on the target configuration + file.\n- `merge-patch`: Merges the provided patch data with the existing configuration + file.\n Creates the file if it doesn't exist.\n- `delete`: Removes the specified + configuration file from the target hosts." + enum: + - merge-patch + - delete + example: merge-patch + type: string + x-enum-varnames: + - MERGE_PATCH + - DELETE + FleetDeploymentOperation: + description: A single configuration file operation to perform on the target + hosts. + properties: + file_op: + $ref: '#/components/schemas/FleetDeploymentFileOp' + file_path: + description: Absolute path to the target configuration file on the host. + example: /datadog.yaml + type: string + patch: + additionalProperties: {} + description: 'Patch data in JSON format to apply to the configuration file. + + When using `merge-patch`, this object is merged with the existing configuration, + + allowing you to add, update, or override specific fields without replacing + the entire file. + + The structure must match the target configuration file format (for example, + YAML structure for Datadog Agent config). + + Not applicable when using the `delete` operation.' + example: + apm_config: + enabled: true + log_level: debug + logs_enabled: true + type: object + required: + - file_op + - file_path + type: object + FleetDeploymentResourceType: + default: deployment + description: The type of deployment resource. + enum: + - deployment + example: deployment + type: string + x-enum-varnames: + - DEPLOYMENT + FleetDeploymentResponse: + description: Response containing a single deployment. + properties: + data: + $ref: '#/components/schemas/FleetDeployment' + type: object + FleetDeploymentsPage: + description: Pagination details for the list of deployments. + properties: + total_count: + description: Total number of deployments available across all pages. + example: 25 + format: int64 + type: integer + type: object + FleetDeploymentsResponse: + description: Response containing a paginated list of deployments. + properties: + data: + description: Array of deployments matching the query criteria. + items: + $ref: '#/components/schemas/FleetDeployment' + type: array + meta: + $ref: '#/components/schemas/FleetDeploymentsResponseMeta' + required: + - data + type: object + FleetDeploymentsResponseMeta: + description: Metadata for the list of deployments, including pagination information. + properties: + page: + $ref: '#/components/schemas/FleetDeploymentsPage' + type: object FormulaLimit: description: 'Message for specifying limits to the number of values returned by a query. @@ -53094,6 +53267,249 @@ info: version: '1.0' openapi: 3.0.0 paths: + /api/unstable/fleet/deployments: + get: + description: 'Retrieve a list of all deployments for fleet automation. + + Use the `page_size` and `page_offset` parameters to paginate results.' + operationId: ListFleetDeployments + parameters: + - description: Number of deployments to return per page. Maximum value is 100. + in: query + name: page_size + required: false + schema: + default: 10 + format: int64 + maximum: 100 + type: integer + - description: Index of the first deployment to return. Use this with `page_size` + to paginate through results. + in: query + name: page_offset + required: false + schema: + default: 0 + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetDeploymentsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List all deployments + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - hosts_read + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/deployments/configure: + post: + description: 'Create a new deployment to apply configuration changes + + to a fleet of hosts matching the specified filter query.' + operationId: CreateFleetDeploymentConfigure + requestBody: + content: + application/json: + examples: + add_log_integration: + summary: Add log integrations for multiple services + value: + data: + attributes: + config_operations: + - file_op: merge-patch + file_path: /conf.d/postgres.d/logs.yaml + patch: + logs: + - path: /var/log/postgres.log + service: postgres1 + source: postgres + type: file + - file_op: merge-patch + file_path: /conf.d/kafka.d/logs.yaml + patch: + logs: + - path: /var/log/kafka.log + service: kafka1 + source: kafka + type: file + filter_query: env:prod + type: deployment + delete_config_file: + summary: Delete a configuration file + value: + data: + attributes: + config_operations: + - file_op: delete + file_path: /conf.d/old-integration.yaml + filter_query: env:dev + type: deployment + enable_apm_and_logs: + summary: Enable APM and Logs products + 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 + simple_log_level: + summary: Set log level to info + value: + data: + attributes: + config_operations: + - file_op: merge-patch + file_path: /datadog.yaml + patch: + log_level: info + filter_query: env:staging + type: deployment + schema: + $ref: '#/components/schemas/FleetDeploymentConfigureCreateRequest' + description: Request payload containing the deployment details. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetDeploymentResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a deployment + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + - fleet_policies_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/deployments/{deployment_id}: + get: + description: Retrieve the details of a specific deployment using its unique + identifier. + operationId: GetFleetDeployment + parameters: + - description: The unique identifier of the deployment to retrieve. + example: abc-def-ghi + in: path + name: deployment_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetDeploymentResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a deployment by ID + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - hosts_read + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/deployments/{deployment_id}/cancel: + post: + description: 'Cancel this deployment and stop all associated operations. + + If a workflow is currently running for this deployment, it is canceled immediately. + + Changes already applied to hosts are not rolled back.' + operationId: CancelFleetDeployment + parameters: + - description: The unique identifier of the deployment to cancel. + example: abc-def-ghi + in: path + name: deployment_id + required: true + schema: + type: string + responses: + '204': + description: Deployment successfully canceled. + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Cancel a deployment + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + - fleet_policies_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/actions-datastores: get: description: Lists all datastores for the organization. @@ -79828,6 +80244,12 @@ tags: through the Datadog API. See the [Fastly integration page](https://docs.datadoghq.com/integrations/fastly/) for more information. name: Fastly Integration +- 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.' + name: Fleet Automation - description: 'Configure your Datadog-Google Cloud Platform (GCP) integration directly through the Datadog API. Read more about the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google_cloud_platform).' diff --git a/features/v2/fleet_automation.feature b/features/v2/fleet_automation.feature new file mode 100644 index 000000000000..2e91b6e0a852 --- /dev/null +++ b/features/v2/fleet_automation.feature @@ -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 diff --git a/features/v2/given.json b/features/v2/given.json index 23b1000e2cdf..a4ab9c24bd17 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -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": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 6c74e264b654..bb35cea36c2e 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -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": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index 7d28edab2fb0..53168562fce1 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -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) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 38cd15f0a573..309f089d4609 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -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", }, diff --git a/services/fleet_automation/.yarnrc.yml b/services/fleet_automation/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/fleet_automation/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/fleet_automation/README.md b/services/fleet_automation/README.md new file mode 100644 index 000000000000..25a3fce5205a --- /dev/null +++ b/services/fleet_automation/README.md @@ -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); +}); +``` \ No newline at end of file diff --git a/services/fleet_automation/package.json b/services/fleet_automation/package.json new file mode 100644 index 000000000000..8fba7b39f4fd --- /dev/null +++ b/services/fleet_automation/package.json @@ -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" +} diff --git a/services/fleet_automation/src/index.ts b/services/fleet_automation/src/index.ts new file mode 100644 index 000000000000..e017b1efd3b1 --- /dev/null +++ b/services/fleet_automation/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { FleetAutomationApi as FleetAutomationApiV2 } from "./v2/FleetAutomationApi"; diff --git a/services/fleet_automation/src/v2/FleetAutomationApi.ts b/services/fleet_automation/src/v2/FleetAutomationApi.ts new file mode 100644 index 000000000000..81b1022b6021 --- /dev/null +++ b/services/fleet_automation/src/v2/FleetAutomationApi.ts @@ -0,0 +1,648 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { FleetDeploymentConfigureCreateRequest } from "./models/FleetDeploymentConfigureCreateRequest"; +import { FleetDeploymentResponse } from "./models/FleetDeploymentResponse"; +import { FleetDeploymentsResponse } from "./models/FleetDeploymentsResponse"; +import { version } from "../version"; + +export class FleetAutomationApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("fleet-automation", version); + } + } + public async cancelFleetDeployment( + deploymentId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["FleetAutomationApi.v2.cancelFleetDeployment"] + ) { + throw new Error( + "Unstable operation 'cancelFleetDeployment' is disabled. Enable it by setting `configuration.unstableOperations['FleetAutomationApi.v2.cancelFleetDeployment'] = true`", + ); + } + + // verify required parameter 'deploymentId' is not null or undefined + if (deploymentId === null || deploymentId === undefined) { + throw new RequiredError("deploymentId", "cancelFleetDeployment"); + } + + // Path Params + const localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}/cancel".replace( + "{deployment_id}", + encodeURIComponent(String(deploymentId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "FleetAutomationApi.v2.cancelFleetDeployment", + FleetAutomationApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async createFleetDeploymentConfigure( + body: FleetDeploymentConfigureCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "FleetAutomationApi.v2.createFleetDeploymentConfigure" + ] + ) { + throw new Error( + "Unstable operation 'createFleetDeploymentConfigure' is disabled. Enable it by setting `configuration.unstableOperations['FleetAutomationApi.v2.createFleetDeploymentConfigure'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createFleetDeploymentConfigure"); + } + + // Path Params + const localVarPath = "/api/unstable/fleet/deployments/configure"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "FleetAutomationApi.v2.createFleetDeploymentConfigure", + FleetAutomationApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "FleetDeploymentConfigureCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getFleetDeployment( + deploymentId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["FleetAutomationApi.v2.getFleetDeployment"] + ) { + throw new Error( + "Unstable operation 'getFleetDeployment' is disabled. Enable it by setting `configuration.unstableOperations['FleetAutomationApi.v2.getFleetDeployment'] = true`", + ); + } + + // verify required parameter 'deploymentId' is not null or undefined + if (deploymentId === null || deploymentId === undefined) { + throw new RequiredError("deploymentId", "getFleetDeployment"); + } + + // Path Params + const localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}".replace( + "{deployment_id}", + encodeURIComponent(String(deploymentId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "FleetAutomationApi.v2.getFleetDeployment", + FleetAutomationApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listFleetDeployments( + pageSize?: number, + pageOffset?: number, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["FleetAutomationApi.v2.listFleetDeployments"] + ) { + throw new Error( + "Unstable operation 'listFleetDeployments' is disabled. Enable it by setting `configuration.unstableOperations['FleetAutomationApi.v2.listFleetDeployments'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/unstable/fleet/deployments"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "FleetAutomationApi.v2.listFleetDeployments", + FleetAutomationApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page_size", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page_offset", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class FleetAutomationApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to cancelFleetDeployment + * @throws ApiException if the response code was not in [200, 299] + */ + public async cancelFleetDeployment(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createFleetDeploymentConfigure + * @throws ApiException if the response code was not in [200, 299] + */ + public async createFleetDeploymentConfigure( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: FleetDeploymentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentResponse", + ) as FleetDeploymentResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FleetDeploymentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentResponse", + "", + ) as FleetDeploymentResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getFleetDeployment + * @throws ApiException if the response code was not in [200, 299] + */ + public async getFleetDeployment( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: FleetDeploymentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentResponse", + ) as FleetDeploymentResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FleetDeploymentResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentResponse", + "", + ) as FleetDeploymentResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listFleetDeployments + * @throws ApiException if the response code was not in [200, 299] + */ + public async listFleetDeployments( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: FleetDeploymentsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentsResponse", + ) as FleetDeploymentsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FleetDeploymentsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "FleetDeploymentsResponse", + "", + ) as FleetDeploymentsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface FleetAutomationApiCancelFleetDeploymentRequest { + /** + * The unique identifier of the deployment to cancel. + * @type string + */ + deploymentId: string; +} + +export interface FleetAutomationApiCreateFleetDeploymentConfigureRequest { + /** + * Request payload containing the deployment details. + * @type FleetDeploymentConfigureCreateRequest + */ + body: FleetDeploymentConfigureCreateRequest; +} + +export interface FleetAutomationApiGetFleetDeploymentRequest { + /** + * The unique identifier of the deployment to retrieve. + * @type string + */ + deploymentId: string; +} + +export interface FleetAutomationApiListFleetDeploymentsRequest { + /** + * Number of deployments to return per page. Maximum value is 100. + * @type number + */ + pageSize?: number; + /** + * Index of the first deployment to return. Use this with `page_size` to paginate through results. + * @type number + */ + pageOffset?: number; +} + +export class FleetAutomationApi { + private requestFactory: FleetAutomationApiRequestFactory; + private responseProcessor: FleetAutomationApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: FleetAutomationApiRequestFactory, + responseProcessor?: FleetAutomationApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || + new FleetAutomationApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new FleetAutomationApiResponseProcessor(); + } + + /** + * Cancel this deployment and stop all associated operations. + * If a workflow is currently running for this deployment, it is canceled immediately. + * Changes already applied to hosts are not rolled back. + * @param param The request object + */ + public cancelFleetDeployment( + param: FleetAutomationApiCancelFleetDeploymentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.cancelFleetDeployment( + param.deploymentId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.cancelFleetDeployment(responseContext); + }); + }); + } + + /** + * Create a new deployment to apply configuration changes + * to a fleet of hosts matching the specified filter query. + * @param param The request object + */ + public createFleetDeploymentConfigure( + param: FleetAutomationApiCreateFleetDeploymentConfigureRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.createFleetDeploymentConfigure(param.body, options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createFleetDeploymentConfigure( + responseContext, + ); + }); + }); + } + + /** + * Retrieve the details of a specific deployment using its unique identifier. + * @param param The request object + */ + public getFleetDeployment( + param: FleetAutomationApiGetFleetDeploymentRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getFleetDeployment( + param.deploymentId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getFleetDeployment(responseContext); + }); + }); + } + + /** + * Retrieve a list of all deployments for fleet automation. + * Use the `page_size` and `page_offset` parameters to paginate results. + * @param param The request object + */ + public listFleetDeployments( + param: FleetAutomationApiListFleetDeploymentsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listFleetDeployments( + param.pageSize, + param.pageOffset, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listFleetDeployments(responseContext); + }); + }); + } +} diff --git a/services/fleet_automation/src/v2/index.ts b/services/fleet_automation/src/v2/index.ts new file mode 100644 index 000000000000..3305627dce8b --- /dev/null +++ b/services/fleet_automation/src/v2/index.ts @@ -0,0 +1,21 @@ +export { + FleetAutomationApiCancelFleetDeploymentRequest, + FleetAutomationApiCreateFleetDeploymentConfigureRequest, + FleetAutomationApiGetFleetDeploymentRequest, + FleetAutomationApiListFleetDeploymentsRequest, + FleetAutomationApi, +} from "./FleetAutomationApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { FleetDeployment } from "./models/FleetDeployment"; +export { FleetDeploymentAttributes } from "./models/FleetDeploymentAttributes"; +export { FleetDeploymentConfigureAttributes } from "./models/FleetDeploymentConfigureAttributes"; +export { FleetDeploymentConfigureCreate } from "./models/FleetDeploymentConfigureCreate"; +export { FleetDeploymentConfigureCreateRequest } from "./models/FleetDeploymentConfigureCreateRequest"; +export { FleetDeploymentFileOp } from "./models/FleetDeploymentFileOp"; +export { FleetDeploymentOperation } from "./models/FleetDeploymentOperation"; +export { FleetDeploymentResourceType } from "./models/FleetDeploymentResourceType"; +export { FleetDeploymentResponse } from "./models/FleetDeploymentResponse"; +export { FleetDeploymentsPage } from "./models/FleetDeploymentsPage"; +export { FleetDeploymentsResponse } from "./models/FleetDeploymentsResponse"; +export { FleetDeploymentsResponseMeta } from "./models/FleetDeploymentsResponseMeta"; diff --git a/services/fleet_automation/src/v2/models/APIErrorResponse.ts b/services/fleet_automation/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/fleet_automation/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeployment.ts b/services/fleet_automation/src/v2/models/FleetDeployment.ts new file mode 100644 index 000000000000..767c963ad505 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeployment.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentAttributes } from "./FleetDeploymentAttributes"; +import { FleetDeploymentResourceType } from "./FleetDeploymentResourceType"; + +/** + * A deployment that defines automated configuration changes for a fleet of hosts. + */ +export class FleetDeployment { + /** + * Attributes of a deployment in the response. + */ + "attributes": FleetDeploymentAttributes; + /** + * Unique identifier for the deployment. + */ + "id": string; + /** + * The type of deployment resource. + */ + "type": FleetDeploymentResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "FleetDeploymentAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "FleetDeploymentResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeployment.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentAttributes.ts b/services/fleet_automation/src/v2/models/FleetDeploymentAttributes.ts new file mode 100644 index 000000000000..9419ad951ded --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentAttributes.ts @@ -0,0 +1,80 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentOperation } from "./FleetDeploymentOperation"; + +/** + * Attributes of a deployment in the response. + */ +export class FleetDeploymentAttributes { + /** + * Ordered list of configuration file operations to perform on the target hosts. + */ + "configOperations"?: Array; + /** + * Estimated completion time of the deployment as a Unix timestamp (seconds since epoch). + */ + "estimatedEndTimeUnix"?: number; + /** + * Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. + */ + "filterQuery"?: string; + /** + * Current high-level status of the deployment (for example, "pending", "running", "completed", "failed"). + */ + "highLevelStatus"?: string; + /** + * Total number of hosts targeted by this deployment. + */ + "totalHosts"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + configOperations: { + baseName: "config_operations", + type: "Array", + }, + estimatedEndTimeUnix: { + baseName: "estimated_end_time_unix", + type: "number", + format: "int64", + }, + filterQuery: { + baseName: "filter_query", + type: "string", + }, + highLevelStatus: { + baseName: "high_level_status", + type: "string", + }, + totalHosts: { + baseName: "total_hosts", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentConfigureAttributes.ts b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureAttributes.ts new file mode 100644 index 000000000000..99ab0d4b2f89 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureAttributes.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentOperation } from "./FleetDeploymentOperation"; + +/** + * Attributes for creating a new configuration deployment. + */ +export class FleetDeploymentConfigureAttributes { + /** + * Ordered list of configuration file operations to perform on the target hosts. + */ + "configOperations": Array; + /** + * Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. + */ + "filterQuery"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + configOperations: { + baseName: "config_operations", + type: "Array", + required: true, + }, + filterQuery: { + baseName: "filter_query", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentConfigureAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreate.ts b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreate.ts new file mode 100644 index 000000000000..e0f131a1d150 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreate.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentConfigureAttributes } from "./FleetDeploymentConfigureAttributes"; +import { FleetDeploymentResourceType } from "./FleetDeploymentResourceType"; + +/** + * Data for creating a new deployment. + */ +export class FleetDeploymentConfigureCreate { + /** + * Attributes for creating a new configuration deployment. + */ + "attributes": FleetDeploymentConfigureAttributes; + /** + * The type of deployment resource. + */ + "type": FleetDeploymentResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "FleetDeploymentConfigureAttributes", + required: true, + }, + type: { + baseName: "type", + type: "FleetDeploymentResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentConfigureCreate.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreateRequest.ts b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreateRequest.ts new file mode 100644 index 000000000000..0dab7475788e --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentConfigureCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentConfigureCreate } from "./FleetDeploymentConfigureCreate"; + +/** + * Request payload for creating a new deployment. + */ +export class FleetDeploymentConfigureCreateRequest { + /** + * Data for creating a new deployment. + */ + "data": FleetDeploymentConfigureCreate; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "FleetDeploymentConfigureCreate", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentConfigureCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentFileOp.ts b/services/fleet_automation/src/v2/models/FleetDeploymentFileOp.ts new file mode 100644 index 000000000000..d8a672604880 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentFileOp.ts @@ -0,0 +1,14 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Type of file operation to perform on the target configuration file. + * - `merge-patch`: Merges the provided patch data with the existing configuration file. + * Creates the file if it doesn't exist. + * - `delete`: Removes the specified configuration file from the target hosts. + */ +export type FleetDeploymentFileOp = + | typeof MERGE_PATCH + | typeof DELETE + | UnparsedObject; +export const MERGE_PATCH = "merge-patch"; +export const DELETE = "delete"; diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentOperation.ts b/services/fleet_automation/src/v2/models/FleetDeploymentOperation.ts new file mode 100644 index 000000000000..2120cc9ed7e8 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentOperation.ts @@ -0,0 +1,71 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentFileOp } from "./FleetDeploymentFileOp"; + +/** + * A single configuration file operation to perform on the target hosts. + */ +export class FleetDeploymentOperation { + /** + * Type of file operation to perform on the target configuration file. + * - `merge-patch`: Merges the provided patch data with the existing configuration file. + * Creates the file if it doesn't exist. + * - `delete`: Removes the specified configuration file from the target hosts. + */ + "fileOp": FleetDeploymentFileOp; + /** + * Absolute path to the target configuration file on the host. + */ + "filePath": string; + /** + * Patch data in JSON format to apply to the configuration file. + * When using `merge-patch`, this object is merged with the existing configuration, + * allowing you to add, update, or override specific fields without replacing the entire file. + * The structure must match the target configuration file format (for example, YAML structure for Datadog Agent config). + * Not applicable when using the `delete` operation. + */ + "patch"?: { [key: string]: any }; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + fileOp: { + baseName: "file_op", + type: "FleetDeploymentFileOp", + required: true, + }, + filePath: { + baseName: "file_path", + type: "string", + required: true, + }, + patch: { + baseName: "patch", + type: "{ [key: string]: any; }", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentOperation.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentResourceType.ts b/services/fleet_automation/src/v2/models/FleetDeploymentResourceType.ts new file mode 100644 index 000000000000..8b65e2302315 --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentResourceType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The type of deployment resource. + */ +export type FleetDeploymentResourceType = typeof DEPLOYMENT | UnparsedObject; +export const DEPLOYMENT = "deployment"; diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentResponse.ts b/services/fleet_automation/src/v2/models/FleetDeploymentResponse.ts new file mode 100644 index 000000000000..c9e6f202927d --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentResponse.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeployment } from "./FleetDeployment"; + +/** + * Response containing a single deployment. + */ +export class FleetDeploymentResponse { + /** + * A deployment that defines automated configuration changes for a fleet of hosts. + */ + "data"?: FleetDeployment; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "FleetDeployment", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentsPage.ts b/services/fleet_automation/src/v2/models/FleetDeploymentsPage.ts new file mode 100644 index 000000000000..aeaa964ca24a --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentsPage.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Pagination details for the list of deployments. + */ +export class FleetDeploymentsPage { + /** + * Total number of deployments available across all pages. + */ + "totalCount"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + totalCount: { + baseName: "total_count", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentsPage.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentsResponse.ts b/services/fleet_automation/src/v2/models/FleetDeploymentsResponse.ts new file mode 100644 index 000000000000..69991fc161bd --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentsResponse.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeployment } from "./FleetDeployment"; +import { FleetDeploymentsResponseMeta } from "./FleetDeploymentsResponseMeta"; + +/** + * Response containing a paginated list of deployments. + */ +export class FleetDeploymentsResponse { + /** + * Array of deployments matching the query criteria. + */ + "data": Array; + /** + * Metadata for the list of deployments, including pagination information. + */ + "meta"?: FleetDeploymentsResponseMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + meta: { + baseName: "meta", + type: "FleetDeploymentsResponseMeta", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/FleetDeploymentsResponseMeta.ts b/services/fleet_automation/src/v2/models/FleetDeploymentsResponseMeta.ts new file mode 100644 index 000000000000..533e2d05e87f --- /dev/null +++ b/services/fleet_automation/src/v2/models/FleetDeploymentsResponseMeta.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { FleetDeploymentsPage } from "./FleetDeploymentsPage"; + +/** + * Metadata for the list of deployments, including pagination information. + */ +export class FleetDeploymentsResponseMeta { + /** + * Pagination details for the list of deployments. + */ + "page"?: FleetDeploymentsPage; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + page: { + baseName: "page", + type: "FleetDeploymentsPage", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return FleetDeploymentsResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/fleet_automation/src/v2/models/TypingInfo.ts b/services/fleet_automation/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..73c0177a285c --- /dev/null +++ b/services/fleet_automation/src/v2/models/TypingInfo.ts @@ -0,0 +1,35 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { FleetDeployment } from "./FleetDeployment"; +import { FleetDeploymentAttributes } from "./FleetDeploymentAttributes"; +import { FleetDeploymentConfigureAttributes } from "./FleetDeploymentConfigureAttributes"; +import { FleetDeploymentConfigureCreate } from "./FleetDeploymentConfigureCreate"; +import { FleetDeploymentConfigureCreateRequest } from "./FleetDeploymentConfigureCreateRequest"; +import { FleetDeploymentOperation } from "./FleetDeploymentOperation"; +import { FleetDeploymentResponse } from "./FleetDeploymentResponse"; +import { FleetDeploymentsPage } from "./FleetDeploymentsPage"; +import { FleetDeploymentsResponse } from "./FleetDeploymentsResponse"; +import { FleetDeploymentsResponseMeta } from "./FleetDeploymentsResponseMeta"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + FleetDeploymentFileOp: ["merge-patch", "delete"], + FleetDeploymentResourceType: ["deployment"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + FleetDeployment: FleetDeployment, + FleetDeploymentAttributes: FleetDeploymentAttributes, + FleetDeploymentConfigureAttributes: FleetDeploymentConfigureAttributes, + FleetDeploymentConfigureCreate: FleetDeploymentConfigureCreate, + FleetDeploymentConfigureCreateRequest: + FleetDeploymentConfigureCreateRequest, + FleetDeploymentOperation: FleetDeploymentOperation, + FleetDeploymentResponse: FleetDeploymentResponse, + FleetDeploymentsPage: FleetDeploymentsPage, + FleetDeploymentsResponse: FleetDeploymentsResponse, + FleetDeploymentsResponseMeta: FleetDeploymentsResponseMeta, + }, +}; diff --git a/services/fleet_automation/tsconfig.json b/services/fleet_automation/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/fleet_automation/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index a29981bf11df..b9eef54bdacd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -586,6 +586,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-fleet-automation@workspace:services/fleet_automation": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-fleet-automation@workspace:services/fleet_automation" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.0" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-gcp-integration@workspace:services/gcp_integration": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-gcp-integration@workspace:services/gcp_integration"