diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 364018c47d5..f35df77478f 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/examples/v2/fleet-automation/CancelFleetDeployment.java b/examples/v2/fleet-automation/CancelFleetDeployment.java new file mode 100644 index 00000000000..288f9b90b6c --- /dev/null +++ b/examples/v2/fleet-automation/CancelFleetDeployment.java @@ -0,0 +1,23 @@ +// Cancel a deployment returns "Deployment successfully canceled." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FleetAutomationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.cancelFleetDeployment", true); + FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient); + + try { + apiInstance.cancelFleetDeployment("abc-def-ghi"); + } catch (ApiException e) { + System.err.println("Exception when calling FleetAutomationApi#cancelFleetDeployment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.java b/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.java new file mode 100644 index 00000000000..b47b0a0c030 --- /dev/null +++ b/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.java @@ -0,0 +1,53 @@ +// Create a deployment returns "CREATED" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FleetAutomationApi; +import com.datadog.api.client.v2.model.FleetDeploymentConfigureAttributes; +import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreate; +import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreateRequest; +import com.datadog.api.client.v2.model.FleetDeploymentFileOp; +import com.datadog.api.client.v2.model.FleetDeploymentOperation; +import com.datadog.api.client.v2.model.FleetDeploymentResourceType; +import com.datadog.api.client.v2.model.FleetDeploymentResponse; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createFleetDeploymentConfigure", true); + FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient); + + FleetDeploymentConfigureCreateRequest body = + new FleetDeploymentConfigureCreateRequest() + .data( + new FleetDeploymentConfigureCreate() + .attributes( + new FleetDeploymentConfigureAttributes() + .configOperations( + Collections.singletonList( + new FleetDeploymentOperation() + .fileOp(FleetDeploymentFileOp.MERGE_PATCH) + .filePath("/datadog.yaml") + .patch( + Map.ofEntries( + Map.entry("apm_config", "{'enabled': True}"), + Map.entry("log_level", "debug"), + Map.entry("logs_enabled", "True"))))) + .filterQuery("env:prod AND service:web")) + .type(FleetDeploymentResourceType.DEPLOYMENT)); + + try { + FleetDeploymentResponse result = apiInstance.createFleetDeploymentConfigure(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling FleetAutomationApi#createFleetDeploymentConfigure"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/fleet-automation/GetFleetDeployment.java b/examples/v2/fleet-automation/GetFleetDeployment.java new file mode 100644 index 00000000000..1670a6eb6c7 --- /dev/null +++ b/examples/v2/fleet-automation/GetFleetDeployment.java @@ -0,0 +1,28 @@ +// Get a deployment by ID returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FleetAutomationApi; +import com.datadog.api.client.v2.model.FleetDeploymentResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getFleetDeployment", true); + FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient); + + // there is a valid "deployment" in the system + String DEPLOYMENT_ID = System.getenv("DEPLOYMENT_ID"); + + try { + FleetDeploymentResponse result = apiInstance.getFleetDeployment(DEPLOYMENT_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FleetAutomationApi#getFleetDeployment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/fleet-automation/ListFleetDeployments.java b/examples/v2/fleet-automation/ListFleetDeployments.java new file mode 100644 index 00000000000..ba00011c293 --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetDeployments.java @@ -0,0 +1,25 @@ +// List all deployments returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FleetAutomationApi; +import com.datadog.api.client.v2.model.FleetDeploymentsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listFleetDeployments", true); + FleetAutomationApi apiInstance = new FleetAutomationApi(defaultClient); + + try { + FleetDeploymentsResponse result = apiInstance.listFleetDeployments(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FleetAutomationApi#listFleetDeployments"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 4eb99152084..6302bf1379b 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -687,6 +687,10 @@ public class ApiClient { protected final Map unstableOperations = new HashMap() { { + put("v2.cancelFleetDeployment", false); + put("v2.createFleetDeploymentConfigure", false); + put("v2.getFleetDeployment", false); + put("v2.listFleetDeployments", false); put("v2.createOpenAPI", false); put("v2.deleteOpenAPI", false); put("v2.getOpenAPI", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/FleetAutomationApi.java b/src/main/java/com/datadog/api/client/v2/api/FleetAutomationApi.java new file mode 100644 index 00000000000..cbab3719124 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/FleetAutomationApi.java @@ -0,0 +1,722 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.FleetDeploymentConfigureCreateRequest; +import com.datadog.api.client.v2.model.FleetDeploymentResponse; +import com.datadog.api.client.v2.model.FleetDeploymentsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetAutomationApi { + private ApiClient apiClient; + + public FleetAutomationApi() { + this(ApiClient.getDefaultApiClient()); + } + + public FleetAutomationApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Cancel a deployment. + * + *

See {@link #cancelFleetDeploymentWithHttpInfo}. + * + * @param deploymentId The unique identifier of the deployment to cancel. (required) + * @throws ApiException if fails to make API call + */ + public void cancelFleetDeployment(String deploymentId) throws ApiException { + cancelFleetDeploymentWithHttpInfo(deploymentId); + } + + /** + * Cancel a deployment. + * + *

See {@link #cancelFleetDeploymentWithHttpInfoAsync}. + * + * @param deploymentId The unique identifier of the deployment to cancel. (required) + * @return CompletableFuture + */ + public CompletableFuture cancelFleetDeploymentAsync(String deploymentId) { + return cancelFleetDeploymentWithHttpInfoAsync(deploymentId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 deploymentId The unique identifier of the deployment to cancel. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 Deployment successfully canceled. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse cancelFleetDeploymentWithHttpInfo(String deploymentId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "cancelFleetDeployment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'deploymentId' when calling cancelFleetDeployment"); + } + // create path and map variables + String localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}/cancel" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.cancelFleetDeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Cancel a deployment. + * + *

See {@link #cancelFleetDeploymentWithHttpInfo}. + * + * @param deploymentId The unique identifier of the deployment to cancel. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> cancelFleetDeploymentWithHttpInfoAsync( + String deploymentId) { + // Check if unstable operation is enabled + String operationId = "cancelFleetDeployment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'deploymentId' when calling cancelFleetDeployment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}/cancel" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.cancelFleetDeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Create a deployment. + * + *

See {@link #createFleetDeploymentConfigureWithHttpInfo}. + * + * @param body Request payload containing the deployment details. (required) + * @return FleetDeploymentResponse + * @throws ApiException if fails to make API call + */ + public FleetDeploymentResponse createFleetDeploymentConfigure( + FleetDeploymentConfigureCreateRequest body) throws ApiException { + return createFleetDeploymentConfigureWithHttpInfo(body).getData(); + } + + /** + * Create a deployment. + * + *

See {@link #createFleetDeploymentConfigureWithHttpInfoAsync}. + * + * @param body Request payload containing the deployment details. (required) + * @return CompletableFuture<FleetDeploymentResponse> + */ + public CompletableFuture createFleetDeploymentConfigureAsync( + FleetDeploymentConfigureCreateRequest body) { + return createFleetDeploymentConfigureWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new deployment to apply configuration changes to a fleet of hosts matching the + * specified filter query. + * + * @param body Request payload containing the deployment details. (required) + * @return ApiResponse<FleetDeploymentResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createFleetDeploymentConfigureWithHttpInfo( + FleetDeploymentConfigureCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createFleetDeploymentConfigure"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createFleetDeploymentConfigure"); + } + // create path and map variables + String localVarPath = "/api/unstable/fleet/deployments/configure"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.createFleetDeploymentConfigure", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a deployment. + * + *

See {@link #createFleetDeploymentConfigureWithHttpInfo}. + * + * @param body Request payload containing the deployment details. (required) + * @return CompletableFuture<ApiResponse<FleetDeploymentResponse>> + */ + public CompletableFuture> + createFleetDeploymentConfigureWithHttpInfoAsync(FleetDeploymentConfigureCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createFleetDeploymentConfigure"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createFleetDeploymentConfigure")); + return result; + } + // create path and map variables + String localVarPath = "/api/unstable/fleet/deployments/configure"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.createFleetDeploymentConfigure", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a deployment by ID. + * + *

See {@link #getFleetDeploymentWithHttpInfo}. + * + * @param deploymentId The unique identifier of the deployment to retrieve. (required) + * @return FleetDeploymentResponse + * @throws ApiException if fails to make API call + */ + public FleetDeploymentResponse getFleetDeployment(String deploymentId) throws ApiException { + return getFleetDeploymentWithHttpInfo(deploymentId).getData(); + } + + /** + * Get a deployment by ID. + * + *

See {@link #getFleetDeploymentWithHttpInfoAsync}. + * + * @param deploymentId The unique identifier of the deployment to retrieve. (required) + * @return CompletableFuture<FleetDeploymentResponse> + */ + public CompletableFuture getFleetDeploymentAsync(String deploymentId) { + return getFleetDeploymentWithHttpInfoAsync(deploymentId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve the details of a specific deployment using its unique identifier. + * + * @param deploymentId The unique identifier of the deployment to retrieve. (required) + * @return ApiResponse<FleetDeploymentResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getFleetDeploymentWithHttpInfo(String deploymentId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getFleetDeployment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'deploymentId' when calling getFleetDeployment"); + } + // create path and map variables + String localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.getFleetDeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a deployment by ID. + * + *

See {@link #getFleetDeploymentWithHttpInfo}. + * + * @param deploymentId The unique identifier of the deployment to retrieve. (required) + * @return CompletableFuture<ApiResponse<FleetDeploymentResponse>> + */ + public CompletableFuture> + getFleetDeploymentWithHttpInfoAsync(String deploymentId) { + // Check if unstable operation is enabled + String operationId = "getFleetDeployment"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'deploymentId' when calling getFleetDeployment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/unstable/fleet/deployments/{deployment_id}" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.getFleetDeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listFleetDeployments. */ + public static class ListFleetDeploymentsOptionalParameters { + private Long pageSize; + private Long pageOffset; + + /** + * Set pageSize. + * + * @param pageSize Number of deployments to return per page. Maximum value is 100. (optional, + * default to 10) + * @return ListFleetDeploymentsOptionalParameters + */ + public ListFleetDeploymentsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageOffset. + * + * @param pageOffset Index of the first deployment to return. Use this with page_size + * to paginate through results. (optional, default to 0) + * @return ListFleetDeploymentsOptionalParameters + */ + public ListFleetDeploymentsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + } + + /** + * List all deployments. + * + *

See {@link #listFleetDeploymentsWithHttpInfo}. + * + * @return FleetDeploymentsResponse + * @throws ApiException if fails to make API call + */ + public FleetDeploymentsResponse listFleetDeployments() throws ApiException { + return listFleetDeploymentsWithHttpInfo(new ListFleetDeploymentsOptionalParameters()).getData(); + } + + /** + * List all deployments. + * + *

See {@link #listFleetDeploymentsWithHttpInfoAsync}. + * + * @return CompletableFuture<FleetDeploymentsResponse> + */ + public CompletableFuture listFleetDeploymentsAsync() { + return listFleetDeploymentsWithHttpInfoAsync(new ListFleetDeploymentsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all deployments. + * + *

See {@link #listFleetDeploymentsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return FleetDeploymentsResponse + * @throws ApiException if fails to make API call + */ + public FleetDeploymentsResponse listFleetDeployments( + ListFleetDeploymentsOptionalParameters parameters) throws ApiException { + return listFleetDeploymentsWithHttpInfo(parameters).getData(); + } + + /** + * List all deployments. + * + *

See {@link #listFleetDeploymentsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<FleetDeploymentsResponse> + */ + public CompletableFuture listFleetDeploymentsAsync( + ListFleetDeploymentsOptionalParameters parameters) { + return listFleetDeploymentsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a list of all deployments for fleet automation. Use the page_size and + * page_offset parameters to paginate results. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<FleetDeploymentsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listFleetDeploymentsWithHttpInfo( + ListFleetDeploymentsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listFleetDeployments"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageOffset = parameters.pageOffset; + // create path and map variables + String localVarPath = "/api/unstable/fleet/deployments"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_offset", pageOffset)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.listFleetDeployments", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all deployments. + * + *

See {@link #listFleetDeploymentsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<FleetDeploymentsResponse>> + */ + public CompletableFuture> + listFleetDeploymentsWithHttpInfoAsync(ListFleetDeploymentsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listFleetDeployments"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageOffset = parameters.pageOffset; + // create path and map variables + String localVarPath = "/api/unstable/fleet/deployments"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_offset", pageOffset)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FleetAutomationApi.listFleetDeployments", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeployment.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeployment.java new file mode 100644 index 00000000000..39e95b5577f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeployment.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A deployment that defines automated configuration changes for a fleet of hosts. */ +@JsonPropertyOrder({ + FleetDeployment.JSON_PROPERTY_ATTRIBUTES, + FleetDeployment.JSON_PROPERTY_ID, + FleetDeployment.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeployment { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FleetDeploymentAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FleetDeploymentResourceType type = FleetDeploymentResourceType.DEPLOYMENT; + + public FleetDeployment() {} + + @JsonCreator + public FleetDeployment( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FleetDeploymentAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FleetDeploymentResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FleetDeployment attributes(FleetDeploymentAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a deployment in the response. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FleetDeploymentAttributes attributes) { + this.attributes = attributes; + } + + public FleetDeployment id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the deployment. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public FleetDeployment type(FleetDeploymentResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of deployment resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentResourceType getType() { + return type; + } + + public void setType(FleetDeploymentResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeployment + */ + @JsonAnySetter + public FleetDeployment putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeployment object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeployment fleetDeployment = (FleetDeployment) o; + return Objects.equals(this.attributes, fleetDeployment.attributes) + && Objects.equals(this.id, fleetDeployment.id) + && Objects.equals(this.type, fleetDeployment.type) + && Objects.equals(this.additionalProperties, fleetDeployment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeployment {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentAttributes.java new file mode 100644 index 00000000000..addbd323db3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentAttributes.java @@ -0,0 +1,271 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a deployment in the response. */ +@JsonPropertyOrder({ + FleetDeploymentAttributes.JSON_PROPERTY_CONFIG_OPERATIONS, + FleetDeploymentAttributes.JSON_PROPERTY_ESTIMATED_END_TIME_UNIX, + FleetDeploymentAttributes.JSON_PROPERTY_FILTER_QUERY, + FleetDeploymentAttributes.JSON_PROPERTY_HIGH_LEVEL_STATUS, + FleetDeploymentAttributes.JSON_PROPERTY_TOTAL_HOSTS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONFIG_OPERATIONS = "config_operations"; + private List configOperations = null; + + public static final String JSON_PROPERTY_ESTIMATED_END_TIME_UNIX = "estimated_end_time_unix"; + private Long estimatedEndTimeUnix; + + public static final String JSON_PROPERTY_FILTER_QUERY = "filter_query"; + private String filterQuery; + + public static final String JSON_PROPERTY_HIGH_LEVEL_STATUS = "high_level_status"; + private String highLevelStatus; + + public static final String JSON_PROPERTY_TOTAL_HOSTS = "total_hosts"; + private Long totalHosts; + + public FleetDeploymentAttributes configOperations( + List configOperations) { + this.configOperations = configOperations; + for (FleetDeploymentOperation item : configOperations) { + this.unparsed |= item.unparsed; + } + return this; + } + + public FleetDeploymentAttributes addConfigOperationsItem( + FleetDeploymentOperation configOperationsItem) { + if (this.configOperations == null) { + this.configOperations = new ArrayList<>(); + } + this.configOperations.add(configOperationsItem); + this.unparsed |= configOperationsItem.unparsed; + return this; + } + + /** + * Ordered list of configuration file operations to perform on the target hosts. + * + * @return configOperations + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONFIG_OPERATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getConfigOperations() { + return configOperations; + } + + public void setConfigOperations(List configOperations) { + this.configOperations = configOperations; + } + + public FleetDeploymentAttributes estimatedEndTimeUnix(Long estimatedEndTimeUnix) { + this.estimatedEndTimeUnix = estimatedEndTimeUnix; + return this; + } + + /** + * Estimated completion time of the deployment as a Unix timestamp (seconds since epoch). + * + * @return estimatedEndTimeUnix + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ESTIMATED_END_TIME_UNIX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEstimatedEndTimeUnix() { + return estimatedEndTimeUnix; + } + + public void setEstimatedEndTimeUnix(Long estimatedEndTimeUnix) { + this.estimatedEndTimeUnix = estimatedEndTimeUnix; + } + + public FleetDeploymentAttributes filterQuery(String filterQuery) { + this.filterQuery = filterQuery; + return this; + } + + /** + * Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. + * + * @return filterQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTER_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFilterQuery() { + return filterQuery; + } + + public void setFilterQuery(String filterQuery) { + this.filterQuery = filterQuery; + } + + public FleetDeploymentAttributes highLevelStatus(String highLevelStatus) { + this.highLevelStatus = highLevelStatus; + return this; + } + + /** + * Current high-level status of the deployment (for example, "pending", "running", "completed", + * "failed"). + * + * @return highLevelStatus + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HIGH_LEVEL_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHighLevelStatus() { + return highLevelStatus; + } + + public void setHighLevelStatus(String highLevelStatus) { + this.highLevelStatus = highLevelStatus; + } + + public FleetDeploymentAttributes totalHosts(Long totalHosts) { + this.totalHosts = totalHosts; + return this; + } + + /** + * Total number of hosts targeted by this deployment. + * + * @return totalHosts + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_HOSTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalHosts() { + return totalHosts; + } + + public void setTotalHosts(Long totalHosts) { + this.totalHosts = totalHosts; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentAttributes + */ + @JsonAnySetter + public FleetDeploymentAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentAttributes fleetDeploymentAttributes = (FleetDeploymentAttributes) o; + return Objects.equals(this.configOperations, fleetDeploymentAttributes.configOperations) + && Objects.equals(this.estimatedEndTimeUnix, fleetDeploymentAttributes.estimatedEndTimeUnix) + && Objects.equals(this.filterQuery, fleetDeploymentAttributes.filterQuery) + && Objects.equals(this.highLevelStatus, fleetDeploymentAttributes.highLevelStatus) + && Objects.equals(this.totalHosts, fleetDeploymentAttributes.totalHosts) + && Objects.equals( + this.additionalProperties, fleetDeploymentAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + configOperations, + estimatedEndTimeUnix, + filterQuery, + highLevelStatus, + totalHosts, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentAttributes {\n"); + sb.append(" configOperations: ").append(toIndentedString(configOperations)).append("\n"); + sb.append(" estimatedEndTimeUnix: ") + .append(toIndentedString(estimatedEndTimeUnix)) + .append("\n"); + sb.append(" filterQuery: ").append(toIndentedString(filterQuery)).append("\n"); + sb.append(" highLevelStatus: ").append(toIndentedString(highLevelStatus)).append("\n"); + sb.append(" totalHosts: ").append(toIndentedString(totalHosts)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureAttributes.java new file mode 100644 index 00000000000..f976e1f8ae5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureAttributes.java @@ -0,0 +1,189 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for creating a new configuration deployment. */ +@JsonPropertyOrder({ + FleetDeploymentConfigureAttributes.JSON_PROPERTY_CONFIG_OPERATIONS, + FleetDeploymentConfigureAttributes.JSON_PROPERTY_FILTER_QUERY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentConfigureAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONFIG_OPERATIONS = "config_operations"; + private List configOperations = new ArrayList<>(); + + public static final String JSON_PROPERTY_FILTER_QUERY = "filter_query"; + private String filterQuery; + + public FleetDeploymentConfigureAttributes() {} + + @JsonCreator + public FleetDeploymentConfigureAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CONFIG_OPERATIONS) + List configOperations) { + this.configOperations = configOperations; + } + + public FleetDeploymentConfigureAttributes configOperations( + List configOperations) { + this.configOperations = configOperations; + for (FleetDeploymentOperation item : configOperations) { + this.unparsed |= item.unparsed; + } + return this; + } + + public FleetDeploymentConfigureAttributes addConfigOperationsItem( + FleetDeploymentOperation configOperationsItem) { + this.configOperations.add(configOperationsItem); + this.unparsed |= configOperationsItem.unparsed; + return this; + } + + /** + * Ordered list of configuration file operations to perform on the target hosts. + * + * @return configOperations + */ + @JsonProperty(JSON_PROPERTY_CONFIG_OPERATIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getConfigOperations() { + return configOperations; + } + + public void setConfigOperations(List configOperations) { + this.configOperations = configOperations; + } + + public FleetDeploymentConfigureAttributes filterQuery(String filterQuery) { + this.filterQuery = filterQuery; + return this; + } + + /** + * Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. + * + * @return filterQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTER_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFilterQuery() { + return filterQuery; + } + + public void setFilterQuery(String filterQuery) { + this.filterQuery = filterQuery; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentConfigureAttributes + */ + @JsonAnySetter + public FleetDeploymentConfigureAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentConfigureAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentConfigureAttributes fleetDeploymentConfigureAttributes = + (FleetDeploymentConfigureAttributes) o; + return Objects.equals( + this.configOperations, fleetDeploymentConfigureAttributes.configOperations) + && Objects.equals(this.filterQuery, fleetDeploymentConfigureAttributes.filterQuery) + && Objects.equals( + this.additionalProperties, fleetDeploymentConfigureAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(configOperations, filterQuery, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentConfigureAttributes {\n"); + sb.append(" configOperations: ").append(toIndentedString(configOperations)).append("\n"); + sb.append(" filterQuery: ").append(toIndentedString(filterQuery)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreate.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreate.java new file mode 100644 index 00000000000..3875d41df73 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreate.java @@ -0,0 +1,183 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for creating a new deployment. */ +@JsonPropertyOrder({ + FleetDeploymentConfigureCreate.JSON_PROPERTY_ATTRIBUTES, + FleetDeploymentConfigureCreate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentConfigureCreate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FleetDeploymentConfigureAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FleetDeploymentResourceType type = FleetDeploymentResourceType.DEPLOYMENT; + + public FleetDeploymentConfigureCreate() {} + + @JsonCreator + public FleetDeploymentConfigureCreate( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FleetDeploymentConfigureAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FleetDeploymentResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FleetDeploymentConfigureCreate attributes(FleetDeploymentConfigureAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating a new configuration deployment. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentConfigureAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FleetDeploymentConfigureAttributes attributes) { + this.attributes = attributes; + } + + public FleetDeploymentConfigureCreate type(FleetDeploymentResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of deployment resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentResourceType getType() { + return type; + } + + public void setType(FleetDeploymentResourceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentConfigureCreate + */ + @JsonAnySetter + public FleetDeploymentConfigureCreate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentConfigureCreate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentConfigureCreate fleetDeploymentConfigureCreate = + (FleetDeploymentConfigureCreate) o; + return Objects.equals(this.attributes, fleetDeploymentConfigureCreate.attributes) + && Objects.equals(this.type, fleetDeploymentConfigureCreate.type) + && Objects.equals( + this.additionalProperties, fleetDeploymentConfigureCreate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentConfigureCreate {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreateRequest.java new file mode 100644 index 00000000000..84d6ca82947 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentConfigureCreateRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request payload for creating a new deployment. */ +@JsonPropertyOrder({FleetDeploymentConfigureCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentConfigureCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FleetDeploymentConfigureCreate data; + + public FleetDeploymentConfigureCreateRequest() {} + + @JsonCreator + public FleetDeploymentConfigureCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + FleetDeploymentConfigureCreate data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FleetDeploymentConfigureCreateRequest data(FleetDeploymentConfigureCreate data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating a new deployment. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentConfigureCreate getData() { + return data; + } + + public void setData(FleetDeploymentConfigureCreate data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentConfigureCreateRequest + */ + @JsonAnySetter + public FleetDeploymentConfigureCreateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentConfigureCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentConfigureCreateRequest fleetDeploymentConfigureCreateRequest = + (FleetDeploymentConfigureCreateRequest) o; + return Objects.equals(this.data, fleetDeploymentConfigureCreateRequest.data) + && Objects.equals( + this.additionalProperties, fleetDeploymentConfigureCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentConfigureCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentFileOp.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentFileOp.java new file mode 100644 index 00000000000..05c3ecff2cc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentFileOp.java @@ -0,0 +1,61 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * 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. + */ +@JsonSerialize(using = FleetDeploymentFileOp.FleetDeploymentFileOpSerializer.class) +public class FleetDeploymentFileOp extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("merge-patch", "delete")); + + public static final FleetDeploymentFileOp MERGE_PATCH = new FleetDeploymentFileOp("merge-patch"); + public static final FleetDeploymentFileOp DELETE = new FleetDeploymentFileOp("delete"); + + FleetDeploymentFileOp(String value) { + super(value, allowedValues); + } + + public static class FleetDeploymentFileOpSerializer extends StdSerializer { + public FleetDeploymentFileOpSerializer(Class t) { + super(t); + } + + public FleetDeploymentFileOpSerializer() { + this(null); + } + + @Override + public void serialize( + FleetDeploymentFileOp value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FleetDeploymentFileOp fromValue(String value) { + return new FleetDeploymentFileOp(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentOperation.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentOperation.java new file mode 100644 index 00000000000..40ba1868c88 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentOperation.java @@ -0,0 +1,220 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single configuration file operation to perform on the target hosts. */ +@JsonPropertyOrder({ + FleetDeploymentOperation.JSON_PROPERTY_FILE_OP, + FleetDeploymentOperation.JSON_PROPERTY_FILE_PATH, + FleetDeploymentOperation.JSON_PROPERTY_PATCH +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentOperation { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FILE_OP = "file_op"; + private FleetDeploymentFileOp fileOp; + + public static final String JSON_PROPERTY_FILE_PATH = "file_path"; + private String filePath; + + public static final String JSON_PROPERTY_PATCH = "patch"; + private Map patch = null; + + public FleetDeploymentOperation() {} + + @JsonCreator + public FleetDeploymentOperation( + @JsonProperty(required = true, value = JSON_PROPERTY_FILE_OP) FleetDeploymentFileOp fileOp, + @JsonProperty(required = true, value = JSON_PROPERTY_FILE_PATH) String filePath) { + this.fileOp = fileOp; + this.unparsed |= !fileOp.isValid(); + this.filePath = filePath; + } + + public FleetDeploymentOperation fileOp(FleetDeploymentFileOp fileOp) { + this.fileOp = fileOp; + this.unparsed |= !fileOp.isValid(); + return this; + } + + /** + * 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. + * + * @return fileOp + */ + @JsonProperty(JSON_PROPERTY_FILE_OP) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FleetDeploymentFileOp getFileOp() { + return fileOp; + } + + public void setFileOp(FleetDeploymentFileOp fileOp) { + if (!fileOp.isValid()) { + this.unparsed = true; + } + this.fileOp = fileOp; + } + + public FleetDeploymentOperation filePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Absolute path to the target configuration file on the host. + * + * @return filePath + */ + @JsonProperty(JSON_PROPERTY_FILE_PATH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public FleetDeploymentOperation patch(Map patch) { + this.patch = patch; + return this; + } + + public FleetDeploymentOperation putPatchItem(String key, Object patchItem) { + if (this.patch == null) { + this.patch = new HashMap<>(); + } + this.patch.put(key, patchItem); + return this; + } + + /** + * 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. + * + * @return patch + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PATCH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getPatch() { + return patch; + } + + public void setPatch(Map patch) { + this.patch = patch; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentOperation + */ + @JsonAnySetter + public FleetDeploymentOperation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentOperation object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentOperation fleetDeploymentOperation = (FleetDeploymentOperation) o; + return Objects.equals(this.fileOp, fleetDeploymentOperation.fileOp) + && Objects.equals(this.filePath, fleetDeploymentOperation.filePath) + && Objects.equals(this.patch, fleetDeploymentOperation.patch) + && Objects.equals(this.additionalProperties, fleetDeploymentOperation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(fileOp, filePath, patch, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentOperation {\n"); + sb.append(" fileOp: ").append(toIndentedString(fileOp)).append("\n"); + sb.append(" filePath: ").append(toIndentedString(filePath)).append("\n"); + sb.append(" patch: ").append(toIndentedString(patch)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResourceType.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResourceType.java new file mode 100644 index 00000000000..46b298fe968 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResourceType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of deployment resource. */ +@JsonSerialize(using = FleetDeploymentResourceType.FleetDeploymentResourceTypeSerializer.class) +public class FleetDeploymentResourceType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("deployment")); + + public static final FleetDeploymentResourceType DEPLOYMENT = + new FleetDeploymentResourceType("deployment"); + + FleetDeploymentResourceType(String value) { + super(value, allowedValues); + } + + public static class FleetDeploymentResourceTypeSerializer + extends StdSerializer { + public FleetDeploymentResourceTypeSerializer(Class t) { + super(t); + } + + public FleetDeploymentResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FleetDeploymentResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FleetDeploymentResourceType fromValue(String value) { + return new FleetDeploymentResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResponse.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResponse.java new file mode 100644 index 00000000000..455b56e68c5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single deployment. */ +@JsonPropertyOrder({FleetDeploymentResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FleetDeployment data; + + public FleetDeploymentResponse data(FleetDeployment data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A deployment that defines automated configuration changes for a fleet of hosts. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FleetDeployment getData() { + return data; + } + + public void setData(FleetDeployment data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentResponse + */ + @JsonAnySetter + public FleetDeploymentResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentResponse fleetDeploymentResponse = (FleetDeploymentResponse) o; + return Objects.equals(this.data, fleetDeploymentResponse.data) + && Objects.equals(this.additionalProperties, fleetDeploymentResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsPage.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsPage.java new file mode 100644 index 00000000000..38fc7bf07e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsPage.java @@ -0,0 +1,135 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Pagination details for the list of deployments. */ +@JsonPropertyOrder({FleetDeploymentsPage.JSON_PROPERTY_TOTAL_COUNT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentsPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TOTAL_COUNT = "total_count"; + private Long totalCount; + + public FleetDeploymentsPage totalCount(Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of deployments available across all pages. + * + * @return totalCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentsPage + */ + @JsonAnySetter + public FleetDeploymentsPage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentsPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentsPage fleetDeploymentsPage = (FleetDeploymentsPage) o; + return Objects.equals(this.totalCount, fleetDeploymentsPage.totalCount) + && Objects.equals(this.additionalProperties, fleetDeploymentsPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentsPage {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponse.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponse.java new file mode 100644 index 00000000000..f095e24614d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponse.java @@ -0,0 +1,184 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a paginated list of deployments. */ +@JsonPropertyOrder({ + FleetDeploymentsResponse.JSON_PROPERTY_DATA, + FleetDeploymentsResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_META = "meta"; + private FleetDeploymentsResponseMeta meta; + + public FleetDeploymentsResponse() {} + + @JsonCreator + public FleetDeploymentsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public FleetDeploymentsResponse data(List data) { + this.data = data; + for (FleetDeployment item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public FleetDeploymentsResponse addDataItem(FleetDeployment dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of deployments matching the query criteria. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public FleetDeploymentsResponse meta(FleetDeploymentsResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata for the list of deployments, including pagination information. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FleetDeploymentsResponseMeta getMeta() { + return meta; + } + + public void setMeta(FleetDeploymentsResponseMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentsResponse + */ + @JsonAnySetter + public FleetDeploymentsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentsResponse fleetDeploymentsResponse = (FleetDeploymentsResponse) o; + return Objects.equals(this.data, fleetDeploymentsResponse.data) + && Objects.equals(this.meta, fleetDeploymentsResponse.meta) + && Objects.equals(this.additionalProperties, fleetDeploymentsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponseMeta.java new file mode 100644 index 00000000000..1ae769ba1da --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FleetDeploymentsResponseMeta.java @@ -0,0 +1,137 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metadata for the list of deployments, including pagination information. */ +@JsonPropertyOrder({FleetDeploymentsResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FleetDeploymentsResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private FleetDeploymentsPage page; + + public FleetDeploymentsResponseMeta page(FleetDeploymentsPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Pagination details for the list of deployments. + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FleetDeploymentsPage getPage() { + return page; + } + + public void setPage(FleetDeploymentsPage page) { + this.page = page; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FleetDeploymentsResponseMeta + */ + @JsonAnySetter + public FleetDeploymentsResponseMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FleetDeploymentsResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FleetDeploymentsResponseMeta fleetDeploymentsResponseMeta = (FleetDeploymentsResponseMeta) o; + return Objects.equals(this.page, fleetDeploymentsResponseMeta.page) + && Objects.equals( + this.additionalProperties, fleetDeploymentsResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FleetDeploymentsResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/fleet_automation.feature b/src/test/resources/com/datadog/api/client/v2/api/fleet_automation.feature new file mode 100644 index 00000000000..2e91b6e0a85 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 23b1000e2cd..a4ab9c24bd1 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 6c74e264b65..bb35cea36c2 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {