From c0345c43f71b3c8926c03f38e30d1cb8fd3cd387 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 21 Sep 2026 14:04:45 +0000 Subject: [PATCH] Regenerate client from commit 6660dcf of spec repo --- .generator/schemas/v2/openapi.yaml | 471 +++++++++++++ .../CreateTerraformBackendSyncConfig.java | 43 ++ .../DeleteTerraformBackendSyncConfig.java | 23 + .../ListTerraformBackendSyncConfigs.java | 28 + .../UpdateTerraformBackendSyncConfig.java | 41 ++ .../client/v2/api/TerraformStateFilesApi.java | 662 ++++++++++++++++++ .../v2/model/TerraformBackendAttributes.java | 284 ++++++++ .../v2/model/TerraformBackendBucket.java | 306 ++++++++ .../TerraformBackendCreateAttributes.java | 244 +++++++ .../v2/model/TerraformBackendCreateData.java | 185 +++++ .../model/TerraformBackendCreateRequest.java | 149 ++++ .../client/v2/model/TerraformBackendData.java | 212 ++++++ .../client/v2/model/TerraformBackendKind.java | 54 ++ .../model/TerraformBackendListResponse.java | 163 +++++ .../v2/model/TerraformBackendResponse.java | 148 ++++ .../v2/model/TerraformBackendSyncStatus.java | 61 ++ .../client/v2/model/TerraformBackendType.java | 56 ++ .../TerraformBackendUpdateAttributes.java | 152 ++++ .../v2/model/TerraformBackendUpdateData.java | 213 ++++++ .../model/TerraformBackendUpdateRequest.java | 149 ++++ .../v2/api/terraform_state_files.feature | 90 +++ .../com/datadog/api/client/v2/api/undo.json | 31 + .../test-runner-data/manifest.json | 28 + ...guration-returns-bad-request-response.json | 38 + ...guration-returns-bad-request-response.json | 35 + ...nc-configurations-returns-ok-response.json | 35 + ...nfiguration-returns-conflict-response.json | 53 ++ 27 files changed, 3954 insertions(+) create mode 100644 examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.java create mode 100644 examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.java create mode 100644 examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.java create mode 100644 examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/TerraformStateFilesApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendBucket.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendKind.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendListResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendSyncStatus.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateRequest.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/terraform_state_files.feature create mode 100644 src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4d2c9181bee..4069de1ac0f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -121175,6 +121175,222 @@ components: required: - data type: object + TerraformBackendAttributes: + description: Terraform backend sync configuration and bucket statuses. + properties: + account_id: + description: AWS account ID that owns the S3 buckets. + example: "123456789012" + type: string + backend_type: + $ref: "#/components/schemas/TerraformBackendKind" + buckets: + description: Source buckets and their synchronization statuses. + items: + $ref: "#/components/schemas/TerraformBackendBucket" + type: array + org_id: + description: Datadog organization ID. + example: "12345" + type: string + region: + description: AWS region containing the S3 buckets. + example: us-east-1 + type: string + required: + - org_id + - backend_type + - account_id + - region + - buckets + type: object + TerraformBackendBucket: + description: Synchronization status for an S3 bucket. + properties: + bucket_name: + description: Name of the source S3 bucket. + example: terraform-state-bucket + type: string + last_sync_error: + description: Error from the most recent failed synchronization, or an empty string otherwise. + example: "" + type: string + last_sync_status: + $ref: "#/components/schemas/TerraformBackendSyncStatus" + last_sync_time: + description: Time of the most recent synchronization outcome, or null if none has been recorded. + example: "2026-01-01T12:00:00Z" + format: date-time + nullable: true + type: string + recurring_blob_sync_id: + description: Identifier of the recurring synchronization job. + example: 12345678-1234-1234-1234-123456789012 + type: string + statefile_count: + description: Number of synchronized Terraform state files in the bucket. + example: 3 + format: int64 + type: integer + required: + - bucket_name + - recurring_blob_sync_id + - last_sync_time + - last_sync_status + - last_sync_error + - statefile_count + type: object + TerraformBackendCreateAttributes: + description: Settings for a new Terraform backend sync configuration. + properties: + account_id: + description: AWS account ID that owns the S3 buckets. + example: "123456789012" + type: string + backend_type: + $ref: "#/components/schemas/TerraformBackendKind" + bucket_names: + description: Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + example: + - terraform-state-bucket + items: + minLength: 1 + type: string + minItems: 1 + type: array + uniqueItems: true + region: + description: AWS region containing the S3 buckets. + example: us-east-1 + type: string + required: + - backend_type + - account_id + - region + - bucket_names + type: object + TerraformBackendCreateData: + description: Terraform backend configuration create data. + properties: + attributes: + $ref: "#/components/schemas/TerraformBackendCreateAttributes" + type: + $ref: "#/components/schemas/TerraformBackendType" + required: + - type + - attributes + type: object + TerraformBackendCreateRequest: + description: Request to create a Terraform backend sync configuration. + properties: + data: + $ref: "#/components/schemas/TerraformBackendCreateData" + required: + - data + type: object + TerraformBackendData: + description: A Terraform backend sync configuration. + properties: + attributes: + $ref: "#/components/schemas/TerraformBackendAttributes" + id: + description: Configuration ID, serialized as a string to preserve integer precision. + example: "9007199254740993" + type: string + type: + $ref: "#/components/schemas/TerraformBackendType" + required: + - id + - type + - attributes + type: object + TerraformBackendKind: + description: Backend type to synchronize. + enum: + - terraform + example: terraform + type: string + x-enum-varnames: + - TERRAFORM + TerraformBackendListResponse: + description: Response containing Terraform backend sync configurations. + properties: + data: + description: Configurations matching the optional account filter. + items: + $ref: "#/components/schemas/TerraformBackendData" + type: array + required: + - data + type: object + TerraformBackendResponse: + description: Response containing a Terraform backend sync configuration. + properties: + data: + $ref: "#/components/schemas/TerraformBackendData" + required: + - data + type: object + TerraformBackendSyncStatus: + description: Most recent synchronization outcome, or pending if no outcome has been recorded. + enum: + - pending + - success + - failure + example: pending + type: string + x-enum-varnames: + - PENDING + - SUCCESS + - FAILURE + TerraformBackendType: + description: Terraform backend configuration resource type. + enum: + - terraform-backends + example: terraform-backends + type: string + x-enum-varnames: + - TERRAFORM_BACKENDS + TerraformBackendUpdateAttributes: + description: Replacement bucket set for a Terraform backend sync configuration. + properties: + bucket_names: + description: Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + example: + - terraform-state-bucket + items: + minLength: 1 + type: string + minItems: 1 + type: array + uniqueItems: true + required: + - bucket_names + type: object + TerraformBackendUpdateData: + description: Terraform backend configuration update data. + properties: + attributes: + $ref: "#/components/schemas/TerraformBackendUpdateAttributes" + id: + description: Configuration ID. Must match the ID in the request path. + example: "9007199254740993" + type: string + type: + $ref: "#/components/schemas/TerraformBackendType" + required: + - id + - type + - attributes + type: object + TerraformBackendUpdateRequest: + description: Request to update a Terraform backend sync configuration. + properties: + data: + $ref: "#/components/schemas/TerraformBackendUpdateData" + required: + - data + type: object TestOptimizationDeleteServiceSettingsRequest: description: Request object for deleting Test Optimization service settings. properties: @@ -159056,6 +159272,259 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/iac-api/terraform/backends: + get: + description: List Terraform backend sync configurations, optionally filtered by AWS account ID. + operationId: ListTerraformBackendSyncConfigs + parameters: + - description: AWS account ID used to filter configurations. Omit to list all configurations for the organization. + in: query + name: account_id + required: false + schema: + example: "123456789012" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + account_id: "123456789012" + backend_type: terraform + buckets: + - bucket_name: terraform-state-bucket + last_sync_error: "" + last_sync_status: pending + last_sync_time: + recurring_blob_sync_id: 12345678-1234-1234-1234-123456789012 + statefile_count: 0 + org_id: "12345" + region: us-east-1 + id: "9007199254740993" + type: terraform-backends + schema: + $ref: "#/components/schemas/TerraformBackendListResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List Terraform backend sync configurations + tags: + - Terraform State Files + x-permission: + operator: OR + permissions: + - terraform_state_file_configurations_read + - terraform_state_file_configurations_write + post: + description: Create a Terraform backend sync configuration for an AWS account, region, and set of S3 buckets. + operationId: CreateTerraformBackendSyncConfig + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + account_id: "123456789012" + backend_type: terraform + bucket_names: + - terraform-state-bucket + region: us-east-1 + type: terraform-backends + schema: + $ref: "#/components/schemas/TerraformBackendCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + account_id: "123456789012" + backend_type: terraform + buckets: + - bucket_name: terraform-state-bucket + last_sync_error: "" + last_sync_status: pending + last_sync_time: + recurring_blob_sync_id: 12345678-1234-1234-1234-123456789012 + statefile_count: 0 + org_id: "12345" + region: us-east-1 + id: "9007199254740993" + type: terraform-backends + schema: + $ref: "#/components/schemas/TerraformBackendResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a Terraform backend sync configuration + tags: + - Terraform State Files + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - terraform_state_file_configurations_write + /api/v2/iac-api/terraform/backends/{id}: + delete: + description: Delete a Terraform backend sync configuration and its synchronized state files. + operationId: DeleteTerraformBackendSyncConfig + parameters: + - description: Terraform backend sync configuration ID. + in: path + name: id + required: true + schema: + example: "9007199254740993" + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a Terraform backend sync configuration + tags: + - Terraform State Files + x-permission: + operator: OR + permissions: + - terraform_state_file_configurations_write + patch: + description: Replace the complete set of buckets in a Terraform backend sync configuration. The account and region cannot be changed. The resource ID in the request body must match the path ID; a mismatch returns 409 Conflict. + operationId: UpdateTerraformBackendSyncConfig + parameters: + - description: Terraform backend sync configuration ID. + in: path + name: id + required: true + schema: + example: "9007199254740993" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + bucket_names: + - terraform-state-bucket + id: "9007199254740993" + type: terraform-backends + schema: + $ref: "#/components/schemas/TerraformBackendUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + account_id: "123456789012" + backend_type: terraform + buckets: + - bucket_name: terraform-state-bucket + last_sync_error: "" + last_sync_status: pending + last_sync_time: + recurring_blob_sync_id: 12345678-1234-1234-1234-123456789012 + statefile_count: 0 + org_id: "12345" + region: us-east-1 + id: "9007199254740993" + type: terraform-backends + schema: + $ref: "#/components/schemas/TerraformBackendResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a Terraform backend sync configuration + tags: + - Terraform State Files + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - terraform_state_file_configurations_write /api/v2/identity_providers: get: description: Get all identity providers available for the current organization. @@ -230000,6 +230469,8 @@ tags: name: Tag Rules - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams + - description: Configure synchronization of Terraform state files from S3 buckets and inspect synchronization status. + name: Terraform State Files - description: |- Search and manage flaky tests through Test Optimization. See the [Test Optimization page](https://docs.datadoghq.com/tests/) for more information. name: Test Optimization diff --git a/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.java b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.java new file mode 100644 index 00000000000..5d5b9b3c894 --- /dev/null +++ b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.java @@ -0,0 +1,43 @@ +// Create a Terraform backend sync configuration returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TerraformStateFilesApi; +import com.datadog.api.client.v2.model.TerraformBackendCreateAttributes; +import com.datadog.api.client.v2.model.TerraformBackendCreateData; +import com.datadog.api.client.v2.model.TerraformBackendCreateRequest; +import com.datadog.api.client.v2.model.TerraformBackendKind; +import com.datadog.api.client.v2.model.TerraformBackendResponse; +import com.datadog.api.client.v2.model.TerraformBackendType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TerraformStateFilesApi apiInstance = new TerraformStateFilesApi(defaultClient); + + TerraformBackendCreateRequest body = + new TerraformBackendCreateRequest() + .data( + new TerraformBackendCreateData() + .attributes( + new TerraformBackendCreateAttributes() + .accountId("123456789012") + .backendType(TerraformBackendKind.TERRAFORM) + .bucketNames(Collections.singletonList("terraform-state-bucket")) + .region("us-east-1")) + .type(TerraformBackendType.TERRAFORM_BACKENDS)); + + try { + TerraformBackendResponse result = apiInstance.createTerraformBackendSyncConfig(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling TerraformStateFilesApi#createTerraformBackendSyncConfig"); + 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/terraform-state-files/DeleteTerraformBackendSyncConfig.java b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.java new file mode 100644 index 00000000000..8b68c6a0ca8 --- /dev/null +++ b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.java @@ -0,0 +1,23 @@ +// Delete a Terraform backend sync configuration returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TerraformStateFilesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TerraformStateFilesApi apiInstance = new TerraformStateFilesApi(defaultClient); + + try { + apiInstance.deleteTerraformBackendSyncConfig("9007199254740993"); + } catch (ApiException e) { + System.err.println( + "Exception when calling TerraformStateFilesApi#deleteTerraformBackendSyncConfig"); + 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/terraform-state-files/ListTerraformBackendSyncConfigs.java b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.java new file mode 100644 index 00000000000..3ecc7c4f73b --- /dev/null +++ b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.java @@ -0,0 +1,28 @@ +// List Terraform backend sync configurations returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TerraformStateFilesApi; +import com.datadog.api.client.v2.api.TerraformStateFilesApi.ListTerraformBackendSyncConfigsOptionalParameters; +import com.datadog.api.client.v2.model.TerraformBackendListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TerraformStateFilesApi apiInstance = new TerraformStateFilesApi(defaultClient); + + try { + TerraformBackendListResponse result = + apiInstance.listTerraformBackendSyncConfigs( + new ListTerraformBackendSyncConfigsOptionalParameters().accountId("123456789012")); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling TerraformStateFilesApi#listTerraformBackendSyncConfigs"); + 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/terraform-state-files/UpdateTerraformBackendSyncConfig.java b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.java new file mode 100644 index 00000000000..ea323ab82a4 --- /dev/null +++ b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.java @@ -0,0 +1,41 @@ +// Update a Terraform backend sync configuration returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TerraformStateFilesApi; +import com.datadog.api.client.v2.model.TerraformBackendResponse; +import com.datadog.api.client.v2.model.TerraformBackendType; +import com.datadog.api.client.v2.model.TerraformBackendUpdateAttributes; +import com.datadog.api.client.v2.model.TerraformBackendUpdateData; +import com.datadog.api.client.v2.model.TerraformBackendUpdateRequest; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + TerraformStateFilesApi apiInstance = new TerraformStateFilesApi(defaultClient); + + TerraformBackendUpdateRequest body = + new TerraformBackendUpdateRequest() + .data( + new TerraformBackendUpdateData() + .attributes( + new TerraformBackendUpdateAttributes() + .bucketNames(Collections.singletonList("terraform-state-bucket"))) + .id("9007199254740993") + .type(TerraformBackendType.TERRAFORM_BACKENDS)); + + try { + TerraformBackendResponse result = + apiInstance.updateTerraformBackendSyncConfig("9007199254740993", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling TerraformStateFilesApi#updateTerraformBackendSyncConfig"); + 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/v2/api/TerraformStateFilesApi.java b/src/main/java/com/datadog/api/client/v2/api/TerraformStateFilesApi.java new file mode 100644 index 00000000000..2ff97bd2f5f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/TerraformStateFilesApi.java @@ -0,0 +1,662 @@ +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.TerraformBackendCreateRequest; +import com.datadog.api.client.v2.model.TerraformBackendListResponse; +import com.datadog.api.client.v2.model.TerraformBackendResponse; +import com.datadog.api.client.v2.model.TerraformBackendUpdateRequest; +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 TerraformStateFilesApi { + private ApiClient apiClient; + + public TerraformStateFilesApi() { + this(ApiClient.getDefaultApiClient()); + } + + public TerraformStateFilesApi(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; + } + + /** + * Create a Terraform backend sync configuration. + * + *

See {@link #createTerraformBackendSyncConfigWithHttpInfo}. + * + * @param body (required) + * @return TerraformBackendResponse + * @throws ApiException if fails to make API call + */ + public TerraformBackendResponse createTerraformBackendSyncConfig( + TerraformBackendCreateRequest body) throws ApiException { + return createTerraformBackendSyncConfigWithHttpInfo(body).getData(); + } + + /** + * Create a Terraform backend sync configuration. + * + *

See {@link #createTerraformBackendSyncConfigWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<TerraformBackendResponse> + */ + public CompletableFuture createTerraformBackendSyncConfigAsync( + TerraformBackendCreateRequest body) { + return createTerraformBackendSyncConfigWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a Terraform backend sync configuration for an AWS account, region, and set of S3 + * buckets. + * + * @param body (required) + * @return ApiResponse<TerraformBackendResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createTerraformBackendSyncConfigWithHttpInfo( + TerraformBackendCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createTerraformBackendSyncConfig"); + } + // create path and map variables + String localVarPath = "/api/v2/iac-api/terraform/backends"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.createTerraformBackendSyncConfig", + 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 Terraform backend sync configuration. + * + *

See {@link #createTerraformBackendSyncConfigWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<TerraformBackendResponse>> + */ + public CompletableFuture> + createTerraformBackendSyncConfigWithHttpInfoAsync(TerraformBackendCreateRequest body) { + 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" + + " createTerraformBackendSyncConfig")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/iac-api/terraform/backends"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.createTerraformBackendSyncConfig", + 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() {}); + } + + /** + * Delete a Terraform backend sync configuration. + * + *

See {@link #deleteTerraformBackendSyncConfigWithHttpInfo}. + * + * @param id Terraform backend sync configuration ID. (required) + * @throws ApiException if fails to make API call + */ + public void deleteTerraformBackendSyncConfig(String id) throws ApiException { + deleteTerraformBackendSyncConfigWithHttpInfo(id); + } + + /** + * Delete a Terraform backend sync configuration. + * + *

See {@link #deleteTerraformBackendSyncConfigWithHttpInfoAsync}. + * + * @param id Terraform backend sync configuration ID. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteTerraformBackendSyncConfigAsync(String id) { + return deleteTerraformBackendSyncConfigWithHttpInfoAsync(id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a Terraform backend sync configuration and its synchronized state files. + * + * @param id Terraform backend sync configuration ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteTerraformBackendSyncConfigWithHttpInfo(String id) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling deleteTerraformBackendSyncConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/iac-api/terraform/backends/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.deleteTerraformBackendSyncConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a Terraform backend sync configuration. + * + *

See {@link #deleteTerraformBackendSyncConfigWithHttpInfo}. + * + * @param id Terraform backend sync configuration ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteTerraformBackendSyncConfigWithHttpInfoAsync( + String id) { + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'id' when calling deleteTerraformBackendSyncConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/iac-api/terraform/backends/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.deleteTerraformBackendSyncConfig", + 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( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** Manage optional parameters to listTerraformBackendSyncConfigs. */ + public static class ListTerraformBackendSyncConfigsOptionalParameters { + private String accountId; + + /** + * Set accountId. + * + * @param accountId AWS account ID used to filter configurations. Omit to list all + * configurations for the organization. (optional) + * @return ListTerraformBackendSyncConfigsOptionalParameters + */ + public ListTerraformBackendSyncConfigsOptionalParameters accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + /** + * List Terraform backend sync configurations. + * + *

See {@link #listTerraformBackendSyncConfigsWithHttpInfo}. + * + * @return TerraformBackendListResponse + * @throws ApiException if fails to make API call + */ + public TerraformBackendListResponse listTerraformBackendSyncConfigs() throws ApiException { + return listTerraformBackendSyncConfigsWithHttpInfo( + new ListTerraformBackendSyncConfigsOptionalParameters()) + .getData(); + } + + /** + * List Terraform backend sync configurations. + * + *

See {@link #listTerraformBackendSyncConfigsWithHttpInfoAsync}. + * + * @return CompletableFuture<TerraformBackendListResponse> + */ + public CompletableFuture listTerraformBackendSyncConfigsAsync() { + return listTerraformBackendSyncConfigsWithHttpInfoAsync( + new ListTerraformBackendSyncConfigsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Terraform backend sync configurations. + * + *

See {@link #listTerraformBackendSyncConfigsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return TerraformBackendListResponse + * @throws ApiException if fails to make API call + */ + public TerraformBackendListResponse listTerraformBackendSyncConfigs( + ListTerraformBackendSyncConfigsOptionalParameters parameters) throws ApiException { + return listTerraformBackendSyncConfigsWithHttpInfo(parameters).getData(); + } + + /** + * List Terraform backend sync configurations. + * + *

See {@link #listTerraformBackendSyncConfigsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TerraformBackendListResponse> + */ + public CompletableFuture listTerraformBackendSyncConfigsAsync( + ListTerraformBackendSyncConfigsOptionalParameters parameters) { + return listTerraformBackendSyncConfigsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List Terraform backend sync configurations, optionally filtered by AWS account ID. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<TerraformBackendListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listTerraformBackendSyncConfigsWithHttpInfo( + ListTerraformBackendSyncConfigsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + String accountId = parameters.accountId; + // create path and map variables + String localVarPath = "/api/v2/iac-api/terraform/backends"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "account_id", accountId)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.listTerraformBackendSyncConfigs", + 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 Terraform backend sync configurations. + * + *

See {@link #listTerraformBackendSyncConfigsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TerraformBackendListResponse>> + */ + public CompletableFuture> + listTerraformBackendSyncConfigsWithHttpInfoAsync( + ListTerraformBackendSyncConfigsOptionalParameters parameters) { + Object localVarPostBody = null; + String accountId = parameters.accountId; + // create path and map variables + String localVarPath = "/api/v2/iac-api/terraform/backends"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "account_id", accountId)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.listTerraformBackendSyncConfigs", + 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() {}); + } + + /** + * Update a Terraform backend sync configuration. + * + *

See {@link #updateTerraformBackendSyncConfigWithHttpInfo}. + * + * @param id Terraform backend sync configuration ID. (required) + * @param body (required) + * @return TerraformBackendResponse + * @throws ApiException if fails to make API call + */ + public TerraformBackendResponse updateTerraformBackendSyncConfig( + String id, TerraformBackendUpdateRequest body) throws ApiException { + return updateTerraformBackendSyncConfigWithHttpInfo(id, body).getData(); + } + + /** + * Update a Terraform backend sync configuration. + * + *

See {@link #updateTerraformBackendSyncConfigWithHttpInfoAsync}. + * + * @param id Terraform backend sync configuration ID. (required) + * @param body (required) + * @return CompletableFuture<TerraformBackendResponse> + */ + public CompletableFuture updateTerraformBackendSyncConfigAsync( + String id, TerraformBackendUpdateRequest body) { + return updateTerraformBackendSyncConfigWithHttpInfoAsync(id, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Replace the complete set of buckets in a Terraform backend sync configuration. The account and + * region cannot be changed. The resource ID in the request body must match the path ID; a + * mismatch returns 409 Conflict. + * + * @param id Terraform backend sync configuration ID. (required) + * @param body (required) + * @return ApiResponse<TerraformBackendResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse updateTerraformBackendSyncConfigWithHttpInfo( + String id, TerraformBackendUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling updateTerraformBackendSyncConfig"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling updateTerraformBackendSyncConfig"); + } + // create path and map variables + String localVarPath = + "/api/v2/iac-api/terraform/backends/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.updateTerraformBackendSyncConfig", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a Terraform backend sync configuration. + * + *

See {@link #updateTerraformBackendSyncConfigWithHttpInfo}. + * + * @param id Terraform backend sync configuration ID. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<TerraformBackendResponse>> + */ + public CompletableFuture> + updateTerraformBackendSyncConfigWithHttpInfoAsync( + String id, TerraformBackendUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'id' when calling updateTerraformBackendSyncConfig")); + return result; + } + + // 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" + + " updateTerraformBackendSyncConfig")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/iac-api/terraform/backends/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TerraformStateFilesApi.updateTerraformBackendSyncConfig", + 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( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TerraformBackendAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendAttributes.java new file mode 100644 index 00000000000..92bbe6b32ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendAttributes.java @@ -0,0 +1,284 @@ +/* + * 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; + +/** Terraform backend sync configuration and bucket statuses. */ +@JsonPropertyOrder({ + TerraformBackendAttributes.JSON_PROPERTY_ACCOUNT_ID, + TerraformBackendAttributes.JSON_PROPERTY_BACKEND_TYPE, + TerraformBackendAttributes.JSON_PROPERTY_BUCKETS, + TerraformBackendAttributes.JSON_PROPERTY_ORG_ID, + TerraformBackendAttributes.JSON_PROPERTY_REGION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_BACKEND_TYPE = "backend_type"; + private TerraformBackendKind backendType; + + public static final String JSON_PROPERTY_BUCKETS = "buckets"; + private List buckets = new ArrayList<>(); + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private String orgId; + + public static final String JSON_PROPERTY_REGION = "region"; + private String region; + + public TerraformBackendAttributes() {} + + @JsonCreator + public TerraformBackendAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT_ID) String accountId, + @JsonProperty(required = true, value = JSON_PROPERTY_BACKEND_TYPE) + TerraformBackendKind backendType, + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKETS) + List buckets, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_ID) String orgId, + @JsonProperty(required = true, value = JSON_PROPERTY_REGION) String region) { + this.accountId = accountId; + this.backendType = backendType; + this.unparsed |= !backendType.isValid(); + this.buckets = buckets; + for (TerraformBackendBucket item : buckets) { + this.unparsed |= item.unparsed; + } + this.orgId = orgId; + this.region = region; + } + + public TerraformBackendAttributes accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * AWS account ID that owns the S3 buckets. + * + * @return accountId + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public TerraformBackendAttributes backendType(TerraformBackendKind backendType) { + this.backendType = backendType; + this.unparsed |= !backendType.isValid(); + return this; + } + + /** + * Backend type to synchronize. + * + * @return backendType + */ + @JsonProperty(JSON_PROPERTY_BACKEND_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendKind getBackendType() { + return backendType; + } + + public void setBackendType(TerraformBackendKind backendType) { + if (!backendType.isValid()) { + this.unparsed = true; + } + this.backendType = backendType; + } + + public TerraformBackendAttributes buckets(List buckets) { + this.buckets = buckets; + for (TerraformBackendBucket item : buckets) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TerraformBackendAttributes addBucketsItem(TerraformBackendBucket bucketsItem) { + this.buckets.add(bucketsItem); + this.unparsed |= bucketsItem.unparsed; + return this; + } + + /** + * Source buckets and their synchronization statuses. + * + * @return buckets + */ + @JsonProperty(JSON_PROPERTY_BUCKETS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getBuckets() { + return buckets; + } + + public void setBuckets(List buckets) { + this.buckets = buckets; + if (buckets != null) { + for (TerraformBackendBucket item : buckets) { + this.unparsed |= item.unparsed; + } + } + } + + public TerraformBackendAttributes orgId(String orgId) { + this.orgId = orgId; + return this; + } + + /** + * Datadog organization ID. + * + * @return orgId + */ + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public TerraformBackendAttributes region(String region) { + this.region = region; + return this; + } + + /** + * AWS region containing the S3 buckets. + * + * @return region + */ + @JsonProperty(JSON_PROPERTY_REGION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + /** + * 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 TerraformBackendAttributes + */ + @JsonAnySetter + public TerraformBackendAttributes 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 TerraformBackendAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendAttributes terraformBackendAttributes = (TerraformBackendAttributes) o; + return Objects.equals(this.accountId, terraformBackendAttributes.accountId) + && Objects.equals(this.backendType, terraformBackendAttributes.backendType) + && Objects.equals(this.buckets, terraformBackendAttributes.buckets) + && Objects.equals(this.orgId, terraformBackendAttributes.orgId) + && Objects.equals(this.region, terraformBackendAttributes.region) + && Objects.equals( + this.additionalProperties, terraformBackendAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, backendType, buckets, orgId, region, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendAttributes {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" backendType: ").append(toIndentedString(backendType)).append("\n"); + sb.append(" buckets: ").append(toIndentedString(buckets)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).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/TerraformBackendBucket.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendBucket.java new file mode 100644 index 00000000000..599ff4143f3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendBucket.java @@ -0,0 +1,306 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Synchronization status for an S3 bucket. */ +@JsonPropertyOrder({ + TerraformBackendBucket.JSON_PROPERTY_BUCKET_NAME, + TerraformBackendBucket.JSON_PROPERTY_LAST_SYNC_ERROR, + TerraformBackendBucket.JSON_PROPERTY_LAST_SYNC_STATUS, + TerraformBackendBucket.JSON_PROPERTY_LAST_SYNC_TIME, + TerraformBackendBucket.JSON_PROPERTY_RECURRING_BLOB_SYNC_ID, + TerraformBackendBucket.JSON_PROPERTY_STATEFILE_COUNT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendBucket { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BUCKET_NAME = "bucket_name"; + private String bucketName; + + public static final String JSON_PROPERTY_LAST_SYNC_ERROR = "last_sync_error"; + private String lastSyncError; + + public static final String JSON_PROPERTY_LAST_SYNC_STATUS = "last_sync_status"; + private TerraformBackendSyncStatus lastSyncStatus; + + public static final String JSON_PROPERTY_LAST_SYNC_TIME = "last_sync_time"; + private OffsetDateTime lastSyncTime; + + public static final String JSON_PROPERTY_RECURRING_BLOB_SYNC_ID = "recurring_blob_sync_id"; + private String recurringBlobSyncId; + + public static final String JSON_PROPERTY_STATEFILE_COUNT = "statefile_count"; + private Long statefileCount; + + public TerraformBackendBucket() {} + + @JsonCreator + public TerraformBackendBucket( + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKET_NAME) String bucketName, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_SYNC_ERROR) String lastSyncError, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_SYNC_STATUS) + TerraformBackendSyncStatus lastSyncStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_LAST_SYNC_TIME) + OffsetDateTime lastSyncTime, + @JsonProperty(required = true, value = JSON_PROPERTY_RECURRING_BLOB_SYNC_ID) + String recurringBlobSyncId, + @JsonProperty(required = true, value = JSON_PROPERTY_STATEFILE_COUNT) Long statefileCount) { + this.bucketName = bucketName; + this.lastSyncError = lastSyncError; + this.lastSyncStatus = lastSyncStatus; + this.unparsed |= !lastSyncStatus.isValid(); + this.lastSyncTime = lastSyncTime; + if (lastSyncTime != null) {} + this.recurringBlobSyncId = recurringBlobSyncId; + this.statefileCount = statefileCount; + } + + public TerraformBackendBucket bucketName(String bucketName) { + this.bucketName = bucketName; + return this; + } + + /** + * Name of the source S3 bucket. + * + * @return bucketName + */ + @JsonProperty(JSON_PROPERTY_BUCKET_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public TerraformBackendBucket lastSyncError(String lastSyncError) { + this.lastSyncError = lastSyncError; + return this; + } + + /** + * Error from the most recent failed synchronization, or an empty string otherwise. + * + * @return lastSyncError + */ + @JsonProperty(JSON_PROPERTY_LAST_SYNC_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getLastSyncError() { + return lastSyncError; + } + + public void setLastSyncError(String lastSyncError) { + this.lastSyncError = lastSyncError; + } + + public TerraformBackendBucket lastSyncStatus(TerraformBackendSyncStatus lastSyncStatus) { + this.lastSyncStatus = lastSyncStatus; + this.unparsed |= !lastSyncStatus.isValid(); + return this; + } + + /** + * Most recent synchronization outcome, or pending if no outcome has been recorded. + * + * @return lastSyncStatus + */ + @JsonProperty(JSON_PROPERTY_LAST_SYNC_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendSyncStatus getLastSyncStatus() { + return lastSyncStatus; + } + + public void setLastSyncStatus(TerraformBackendSyncStatus lastSyncStatus) { + if (!lastSyncStatus.isValid()) { + this.unparsed = true; + } + this.lastSyncStatus = lastSyncStatus; + } + + public TerraformBackendBucket lastSyncTime(OffsetDateTime lastSyncTime) { + this.lastSyncTime = lastSyncTime; + if (lastSyncTime != null) {} + return this; + } + + /** + * Time of the most recent synchronization outcome, or null if none has been recorded. + * + * @return lastSyncTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_SYNC_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getLastSyncTime() { + return lastSyncTime; + } + + public void setLastSyncTime(OffsetDateTime lastSyncTime) { + this.lastSyncTime = lastSyncTime; + } + + public TerraformBackendBucket recurringBlobSyncId(String recurringBlobSyncId) { + this.recurringBlobSyncId = recurringBlobSyncId; + return this; + } + + /** + * Identifier of the recurring synchronization job. + * + * @return recurringBlobSyncId + */ + @JsonProperty(JSON_PROPERTY_RECURRING_BLOB_SYNC_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRecurringBlobSyncId() { + return recurringBlobSyncId; + } + + public void setRecurringBlobSyncId(String recurringBlobSyncId) { + this.recurringBlobSyncId = recurringBlobSyncId; + } + + public TerraformBackendBucket statefileCount(Long statefileCount) { + this.statefileCount = statefileCount; + return this; + } + + /** + * Number of synchronized Terraform state files in the bucket. + * + * @return statefileCount + */ + @JsonProperty(JSON_PROPERTY_STATEFILE_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getStatefileCount() { + return statefileCount; + } + + public void setStatefileCount(Long statefileCount) { + this.statefileCount = statefileCount; + } + + /** + * 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 TerraformBackendBucket + */ + @JsonAnySetter + public TerraformBackendBucket 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 TerraformBackendBucket object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendBucket terraformBackendBucket = (TerraformBackendBucket) o; + return Objects.equals(this.bucketName, terraformBackendBucket.bucketName) + && Objects.equals(this.lastSyncError, terraformBackendBucket.lastSyncError) + && Objects.equals(this.lastSyncStatus, terraformBackendBucket.lastSyncStatus) + && Objects.equals(this.lastSyncTime, terraformBackendBucket.lastSyncTime) + && Objects.equals(this.recurringBlobSyncId, terraformBackendBucket.recurringBlobSyncId) + && Objects.equals(this.statefileCount, terraformBackendBucket.statefileCount) + && Objects.equals(this.additionalProperties, terraformBackendBucket.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + bucketName, + lastSyncError, + lastSyncStatus, + lastSyncTime, + recurringBlobSyncId, + statefileCount, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendBucket {\n"); + sb.append(" bucketName: ").append(toIndentedString(bucketName)).append("\n"); + sb.append(" lastSyncError: ").append(toIndentedString(lastSyncError)).append("\n"); + sb.append(" lastSyncStatus: ").append(toIndentedString(lastSyncStatus)).append("\n"); + sb.append(" lastSyncTime: ").append(toIndentedString(lastSyncTime)).append("\n"); + sb.append(" recurringBlobSyncId: ") + .append(toIndentedString(recurringBlobSyncId)) + .append("\n"); + sb.append(" statefileCount: ").append(toIndentedString(statefileCount)).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/TerraformBackendCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateAttributes.java new file mode 100644 index 00000000000..830c85c3388 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateAttributes.java @@ -0,0 +1,244 @@ +/* + * 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; + +/** Settings for a new Terraform backend sync configuration. */ +@JsonPropertyOrder({ + TerraformBackendCreateAttributes.JSON_PROPERTY_ACCOUNT_ID, + TerraformBackendCreateAttributes.JSON_PROPERTY_BACKEND_TYPE, + TerraformBackendCreateAttributes.JSON_PROPERTY_BUCKET_NAMES, + TerraformBackendCreateAttributes.JSON_PROPERTY_REGION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; + private String accountId; + + public static final String JSON_PROPERTY_BACKEND_TYPE = "backend_type"; + private TerraformBackendKind backendType; + + public static final String JSON_PROPERTY_BUCKET_NAMES = "bucket_names"; + private List bucketNames = new ArrayList<>(); + + public static final String JSON_PROPERTY_REGION = "region"; + private String region; + + public TerraformBackendCreateAttributes() {} + + @JsonCreator + public TerraformBackendCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCOUNT_ID) String accountId, + @JsonProperty(required = true, value = JSON_PROPERTY_BACKEND_TYPE) + TerraformBackendKind backendType, + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKET_NAMES) List bucketNames, + @JsonProperty(required = true, value = JSON_PROPERTY_REGION) String region) { + this.accountId = accountId; + this.backendType = backendType; + this.unparsed |= !backendType.isValid(); + this.bucketNames = bucketNames; + this.region = region; + } + + public TerraformBackendCreateAttributes accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * AWS account ID that owns the S3 buckets. + * + * @return accountId + */ + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public TerraformBackendCreateAttributes backendType(TerraformBackendKind backendType) { + this.backendType = backendType; + this.unparsed |= !backendType.isValid(); + return this; + } + + /** + * Backend type to synchronize. + * + * @return backendType + */ + @JsonProperty(JSON_PROPERTY_BACKEND_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendKind getBackendType() { + return backendType; + } + + public void setBackendType(TerraformBackendKind backendType) { + if (!backendType.isValid()) { + this.unparsed = true; + } + this.backendType = backendType; + } + + public TerraformBackendCreateAttributes bucketNames(List bucketNames) { + this.bucketNames = bucketNames; + return this; + } + + public TerraformBackendCreateAttributes addBucketNamesItem(String bucketNamesItem) { + this.bucketNames.add(bucketNamesItem); + return this; + } + + /** + * Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + * + * @return bucketNames + */ + @JsonProperty(JSON_PROPERTY_BUCKET_NAMES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getBucketNames() { + return bucketNames; + } + + public void setBucketNames(List bucketNames) { + this.bucketNames = bucketNames; + } + + public TerraformBackendCreateAttributes region(String region) { + this.region = region; + return this; + } + + /** + * AWS region containing the S3 buckets. + * + * @return region + */ + @JsonProperty(JSON_PROPERTY_REGION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + /** + * 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 TerraformBackendCreateAttributes + */ + @JsonAnySetter + public TerraformBackendCreateAttributes 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 TerraformBackendCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendCreateAttributes terraformBackendCreateAttributes = + (TerraformBackendCreateAttributes) o; + return Objects.equals(this.accountId, terraformBackendCreateAttributes.accountId) + && Objects.equals(this.backendType, terraformBackendCreateAttributes.backendType) + && Objects.equals(this.bucketNames, terraformBackendCreateAttributes.bucketNames) + && Objects.equals(this.region, terraformBackendCreateAttributes.region) + && Objects.equals( + this.additionalProperties, terraformBackendCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, backendType, bucketNames, region, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendCreateAttributes {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" backendType: ").append(toIndentedString(backendType)).append("\n"); + sb.append(" bucketNames: ").append(toIndentedString(bucketNames)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).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/TerraformBackendCreateData.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateData.java new file mode 100644 index 00000000000..f8fc34c517c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateData.java @@ -0,0 +1,185 @@ +/* + * 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; + +/** Terraform backend configuration create data. */ +@JsonPropertyOrder({ + TerraformBackendCreateData.JSON_PROPERTY_ATTRIBUTES, + TerraformBackendCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TerraformBackendCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TerraformBackendType type; + + public TerraformBackendCreateData() {} + + @JsonCreator + public TerraformBackendCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TerraformBackendCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TerraformBackendType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TerraformBackendCreateData attributes(TerraformBackendCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Settings for a new Terraform backend sync configuration. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TerraformBackendCreateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TerraformBackendCreateData type(TerraformBackendType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Terraform backend configuration resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendType getType() { + return type; + } + + public void setType(TerraformBackendType 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 TerraformBackendCreateData + */ + @JsonAnySetter + public TerraformBackendCreateData 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 TerraformBackendCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendCreateData terraformBackendCreateData = (TerraformBackendCreateData) o; + return Objects.equals(this.attributes, terraformBackendCreateData.attributes) + && Objects.equals(this.type, terraformBackendCreateData.type) + && Objects.equals( + this.additionalProperties, terraformBackendCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendCreateData {\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/TerraformBackendCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateRequest.java new file mode 100644 index 00000000000..dc420882fe4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendCreateRequest.java @@ -0,0 +1,149 @@ +/* + * 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 to create a Terraform backend sync configuration. */ +@JsonPropertyOrder({TerraformBackendCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TerraformBackendCreateData data; + + public TerraformBackendCreateRequest() {} + + @JsonCreator + public TerraformBackendCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TerraformBackendCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TerraformBackendCreateRequest data(TerraformBackendCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Terraform backend configuration create data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendCreateData getData() { + return data; + } + + public void setData(TerraformBackendCreateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 TerraformBackendCreateRequest + */ + @JsonAnySetter + public TerraformBackendCreateRequest 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 TerraformBackendCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendCreateRequest terraformBackendCreateRequest = (TerraformBackendCreateRequest) o; + return Objects.equals(this.data, terraformBackendCreateRequest.data) + && Objects.equals( + this.additionalProperties, terraformBackendCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendCreateRequest {\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/TerraformBackendData.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendData.java new file mode 100644 index 00000000000..5c05f5a1146 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendData.java @@ -0,0 +1,212 @@ +/* + * 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 Terraform backend sync configuration. */ +@JsonPropertyOrder({ + TerraformBackendData.JSON_PROPERTY_ATTRIBUTES, + TerraformBackendData.JSON_PROPERTY_ID, + TerraformBackendData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TerraformBackendAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TerraformBackendType type; + + public TerraformBackendData() {} + + @JsonCreator + public TerraformBackendData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TerraformBackendAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TerraformBackendType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TerraformBackendData attributes(TerraformBackendAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Terraform backend sync configuration and bucket statuses. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TerraformBackendAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TerraformBackendData id(String id) { + this.id = id; + return this; + } + + /** + * Configuration ID, serialized as a string to preserve integer precision. + * + * @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 TerraformBackendData type(TerraformBackendType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Terraform backend configuration resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendType getType() { + return type; + } + + public void setType(TerraformBackendType 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 TerraformBackendData + */ + @JsonAnySetter + public TerraformBackendData 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 TerraformBackendData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendData terraformBackendData = (TerraformBackendData) o; + return Objects.equals(this.attributes, terraformBackendData.attributes) + && Objects.equals(this.id, terraformBackendData.id) + && Objects.equals(this.type, terraformBackendData.type) + && Objects.equals(this.additionalProperties, terraformBackendData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendData {\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/TerraformBackendKind.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendKind.java new file mode 100644 index 00000000000..02f0742efbf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendKind.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** Backend type to synchronize. */ +@JsonSerialize(using = TerraformBackendKind.TerraformBackendKindSerializer.class) +public class TerraformBackendKind extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("terraform")); + + public static final TerraformBackendKind TERRAFORM = new TerraformBackendKind("terraform"); + + TerraformBackendKind(String value) { + super(value, allowedValues); + } + + public static class TerraformBackendKindSerializer extends StdSerializer { + public TerraformBackendKindSerializer(Class t) { + super(t); + } + + public TerraformBackendKindSerializer() { + this(null); + } + + @Override + public void serialize( + TerraformBackendKind value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TerraformBackendKind fromValue(String value) { + return new TerraformBackendKind(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TerraformBackendListResponse.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendListResponse.java new file mode 100644 index 00000000000..84b8994cd3e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendListResponse.java @@ -0,0 +1,163 @@ +/* + * 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 Terraform backend sync configurations. */ +@JsonPropertyOrder({TerraformBackendListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public TerraformBackendListResponse() {} + + @JsonCreator + public TerraformBackendListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + for (TerraformBackendData item : data) { + this.unparsed |= item.unparsed; + } + } + + public TerraformBackendListResponse data(List data) { + this.data = data; + for (TerraformBackendData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TerraformBackendListResponse addDataItem(TerraformBackendData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Configurations matching the optional account filter. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (TerraformBackendData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 TerraformBackendListResponse + */ + @JsonAnySetter + public TerraformBackendListResponse 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 TerraformBackendListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendListResponse terraformBackendListResponse = (TerraformBackendListResponse) o; + return Objects.equals(this.data, terraformBackendListResponse.data) + && Objects.equals( + this.additionalProperties, terraformBackendListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendListResponse {\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/TerraformBackendResponse.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendResponse.java new file mode 100644 index 00000000000..ecd4eaa4258 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendResponse.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; + +/** Response containing a Terraform backend sync configuration. */ +@JsonPropertyOrder({TerraformBackendResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TerraformBackendData data; + + public TerraformBackendResponse() {} + + @JsonCreator + public TerraformBackendResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TerraformBackendData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TerraformBackendResponse data(TerraformBackendData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A Terraform backend sync configuration. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendData getData() { + return data; + } + + public void setData(TerraformBackendData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 TerraformBackendResponse + */ + @JsonAnySetter + public TerraformBackendResponse 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 TerraformBackendResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendResponse terraformBackendResponse = (TerraformBackendResponse) o; + return Objects.equals(this.data, terraformBackendResponse.data) + && Objects.equals(this.additionalProperties, terraformBackendResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendResponse {\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/TerraformBackendSyncStatus.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendSyncStatus.java new file mode 100644 index 00000000000..eb1702152b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendSyncStatus.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; + +/** Most recent synchronization outcome, or pending if no outcome has been recorded. */ +@JsonSerialize(using = TerraformBackendSyncStatus.TerraformBackendSyncStatusSerializer.class) +public class TerraformBackendSyncStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "success", "failure")); + + public static final TerraformBackendSyncStatus PENDING = + new TerraformBackendSyncStatus("pending"); + public static final TerraformBackendSyncStatus SUCCESS = + new TerraformBackendSyncStatus("success"); + public static final TerraformBackendSyncStatus FAILURE = + new TerraformBackendSyncStatus("failure"); + + TerraformBackendSyncStatus(String value) { + super(value, allowedValues); + } + + public static class TerraformBackendSyncStatusSerializer + extends StdSerializer { + public TerraformBackendSyncStatusSerializer(Class t) { + super(t); + } + + public TerraformBackendSyncStatusSerializer() { + this(null); + } + + @Override + public void serialize( + TerraformBackendSyncStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TerraformBackendSyncStatus fromValue(String value) { + return new TerraformBackendSyncStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TerraformBackendType.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendType.java new file mode 100644 index 00000000000..0980371a451 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendType.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; + +/** Terraform backend configuration resource type. */ +@JsonSerialize(using = TerraformBackendType.TerraformBackendTypeSerializer.class) +public class TerraformBackendType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("terraform-backends")); + + public static final TerraformBackendType TERRAFORM_BACKENDS = + new TerraformBackendType("terraform-backends"); + + TerraformBackendType(String value) { + super(value, allowedValues); + } + + public static class TerraformBackendTypeSerializer extends StdSerializer { + public TerraformBackendTypeSerializer(Class t) { + super(t); + } + + public TerraformBackendTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TerraformBackendType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TerraformBackendType fromValue(String value) { + return new TerraformBackendType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateAttributes.java new file mode 100644 index 00000000000..79100fa1b34 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateAttributes.java @@ -0,0 +1,152 @@ +/* + * 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; + +/** Replacement bucket set for a Terraform backend sync configuration. */ +@JsonPropertyOrder({TerraformBackendUpdateAttributes.JSON_PROPERTY_BUCKET_NAMES}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_BUCKET_NAMES = "bucket_names"; + private List bucketNames = new ArrayList<>(); + + public TerraformBackendUpdateAttributes() {} + + @JsonCreator + public TerraformBackendUpdateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_BUCKET_NAMES) List bucketNames) { + this.bucketNames = bucketNames; + } + + public TerraformBackendUpdateAttributes bucketNames(List bucketNames) { + this.bucketNames = bucketNames; + return this; + } + + public TerraformBackendUpdateAttributes addBucketNamesItem(String bucketNamesItem) { + this.bucketNames.add(bucketNamesItem); + return this; + } + + /** + * Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + * + * @return bucketNames + */ + @JsonProperty(JSON_PROPERTY_BUCKET_NAMES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getBucketNames() { + return bucketNames; + } + + public void setBucketNames(List bucketNames) { + this.bucketNames = bucketNames; + } + + /** + * 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 TerraformBackendUpdateAttributes + */ + @JsonAnySetter + public TerraformBackendUpdateAttributes 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 TerraformBackendUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendUpdateAttributes terraformBackendUpdateAttributes = + (TerraformBackendUpdateAttributes) o; + return Objects.equals(this.bucketNames, terraformBackendUpdateAttributes.bucketNames) + && Objects.equals( + this.additionalProperties, terraformBackendUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucketNames, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendUpdateAttributes {\n"); + sb.append(" bucketNames: ").append(toIndentedString(bucketNames)).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/TerraformBackendUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateData.java new file mode 100644 index 00000000000..6e6b0174450 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateData.java @@ -0,0 +1,213 @@ +/* + * 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; + +/** Terraform backend configuration update data. */ +@JsonPropertyOrder({ + TerraformBackendUpdateData.JSON_PROPERTY_ATTRIBUTES, + TerraformBackendUpdateData.JSON_PROPERTY_ID, + TerraformBackendUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TerraformBackendUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TerraformBackendType type; + + public TerraformBackendUpdateData() {} + + @JsonCreator + public TerraformBackendUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TerraformBackendUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TerraformBackendType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TerraformBackendUpdateData attributes(TerraformBackendUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Replacement bucket set for a Terraform backend sync configuration. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TerraformBackendUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TerraformBackendUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * Configuration ID. Must match the ID in the request path. + * + * @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 TerraformBackendUpdateData type(TerraformBackendType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Terraform backend configuration resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendType getType() { + return type; + } + + public void setType(TerraformBackendType 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 TerraformBackendUpdateData + */ + @JsonAnySetter + public TerraformBackendUpdateData 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 TerraformBackendUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendUpdateData terraformBackendUpdateData = (TerraformBackendUpdateData) o; + return Objects.equals(this.attributes, terraformBackendUpdateData.attributes) + && Objects.equals(this.id, terraformBackendUpdateData.id) + && Objects.equals(this.type, terraformBackendUpdateData.type) + && Objects.equals( + this.additionalProperties, terraformBackendUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendUpdateData {\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/TerraformBackendUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateRequest.java new file mode 100644 index 00000000000..19e69e109b2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TerraformBackendUpdateRequest.java @@ -0,0 +1,149 @@ +/* + * 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 to update a Terraform backend sync configuration. */ +@JsonPropertyOrder({TerraformBackendUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TerraformBackendUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TerraformBackendUpdateData data; + + public TerraformBackendUpdateRequest() {} + + @JsonCreator + public TerraformBackendUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TerraformBackendUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TerraformBackendUpdateRequest data(TerraformBackendUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Terraform backend configuration update data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TerraformBackendUpdateData getData() { + return data; + } + + public void setData(TerraformBackendUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 TerraformBackendUpdateRequest + */ + @JsonAnySetter + public TerraformBackendUpdateRequest 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 TerraformBackendUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerraformBackendUpdateRequest terraformBackendUpdateRequest = (TerraformBackendUpdateRequest) o; + return Objects.equals(this.data, terraformBackendUpdateRequest.data) + && Objects.equals( + this.additionalProperties, terraformBackendUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TerraformBackendUpdateRequest {\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/test/resources/com/datadog/api/client/v2/api/terraform_state_files.feature b/src/test/resources/com/datadog/api/client/v2/api/terraform_state_files.feature new file mode 100644 index 00000000000..e0d85d518db --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/terraform_state_files.feature @@ -0,0 +1,90 @@ +@endpoint(terraform-state-files) @endpoint(terraform-state-files-v2) +Feature: Terraform State Files + Configure synchronization of Terraform state files from S3 buckets and + inspect synchronization status. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "TerraformStateFiles" API + + @team:DataDog/iac-platform + Scenario: Create a Terraform backend sync configuration returns "Bad Request" response + Given new "CreateTerraformBackendSyncConfig" request + And body with value {"data":{"type":"terraform-backends","attributes":{"backend_type":"terraform","account_id":" ","region":"us-east-1","bucket_names":["terraform-state-bucket"]}}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/iac-platform + Scenario: Create a Terraform backend sync configuration returns "Conflict" response + Given new "CreateTerraformBackendSyncConfig" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "backend_type": "terraform", "bucket_names": ["terraform-state-bucket"], "region": "us-east-1"}, "type": "terraform-backends"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/iac-platform + Scenario: Create a Terraform backend sync configuration returns "Created" response + Given new "CreateTerraformBackendSyncConfig" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "backend_type": "terraform", "bucket_names": ["terraform-state-bucket"], "region": "us-east-1"}, "type": "terraform-backends"}} + When the request is sent + Then the response status is 201 Created + + @team:DataDog/iac-platform + Scenario: Delete a Terraform backend sync configuration returns "Bad Request" response + Given new "DeleteTerraformBackendSyncConfig" request + And request contains "id" parameter with value "invalid-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/iac-platform + Scenario: Delete a Terraform backend sync configuration returns "No Content" response + Given new "DeleteTerraformBackendSyncConfig" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/iac-platform + Scenario: Delete a Terraform backend sync configuration returns "Not Found" response + Given new "DeleteTerraformBackendSyncConfig" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/iac-platform + Scenario: List Terraform backend sync configurations returns "OK" response + Given new "ListTerraformBackendSyncConfigs" request + And request contains "account_id" parameter with value "123456789012" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/iac-platform + Scenario: Update a Terraform backend sync configuration returns "Bad Request" response + Given new "UpdateTerraformBackendSyncConfig" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"bucket_names": ["terraform-state-bucket"]}, "id": "9007199254740993", "type": "terraform-backends"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/iac-platform + Scenario: Update a Terraform backend sync configuration returns "Conflict" response + Given new "UpdateTerraformBackendSyncConfig" request + And request contains "id" parameter with value "1" + And body with value {"data":{"type":"terraform-backends","id":"2","attributes":{"bucket_names":["terraform-state-bucket"]}}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/iac-platform + Scenario: Update a Terraform backend sync configuration returns "Not Found" response + Given new "UpdateTerraformBackendSyncConfig" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"bucket_names": ["terraform-state-bucket"]}, "id": "9007199254740993", "type": "terraform-backends"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/iac-platform + Scenario: Update a Terraform backend sync configuration returns "OK" response + Given new "UpdateTerraformBackendSyncConfig" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"bucket_names": ["terraform-state-bucket"]}, "id": "9007199254740993", "type": "terraform-backends"}} + When the request is sent + Then the response status is 200 OK 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 cbfa79c39e1..1df70ca109b 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 @@ -3179,6 +3179,37 @@ "type": "unsafe" } }, + "ListTerraformBackendSyncConfigs": { + "tag": "Terraform State Files", + "undo": { + "type": "safe" + } + }, + "CreateTerraformBackendSyncConfig": { + "tag": "Terraform State Files", + "undo": { + "operationId": "DeleteTerraformBackendSyncConfig", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteTerraformBackendSyncConfig": { + "tag": "Terraform State Files", + "undo": { + "type": "idempotent" + } + }, + "UpdateTerraformBackendSyncConfig": { + "tag": "Terraform State Files", + "undo": { + "type": "idempotent" + } + }, "ListIdentityProviders": { "tag": "Identity Providers", "undo": { diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 24847416a45..7afefcfd884 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -11543,6 +11543,34 @@ "scenario": "Update team notification rule returns \"OK\" response", "version": "v2" }, + { + "feature": "Terraform State Files", + "feature_file": "../../com/datadog/api/client/v2/api/terraform_state_files.feature", + "file": "v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json", + "scenario": "Create a Terraform backend sync configuration returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "feature_file": "../../com/datadog/api/client/v2/api/terraform_state_files.feature", + "file": "v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json", + "scenario": "Delete a Terraform backend sync configuration returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "feature_file": "../../com/datadog/api/client/v2/api/terraform_state_files.feature", + "file": "v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json", + "scenario": "List Terraform backend sync configurations returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "feature_file": "../../com/datadog/api/client/v2/api/terraform_state_files.feature", + "file": "v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json", + "scenario": "Update a Terraform backend sync configuration returns \"Conflict\" response", + "version": "v2" + }, { "feature": "Threat Intelligence", "feature_file": "../../com/datadog/api/client/v2/api/threat_intelligence.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json new file mode 100644 index 00000000000..4ac36765b2d --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json @@ -0,0 +1,38 @@ +{ + "api": "TerraformStateFiles", + "expected_status": 400, + "feature": "Terraform State Files", + "id": "v2/Terraform State Files/Create a Terraform backend sync configuration returns \"Bad Request\" response", + "operation_id": "CreateTerraformBackendSyncConfig", + "request": { + "body": { + "schema": { + "format": null, + "ref": "TerraformBackendCreateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "account_id": " ", + "backend_type": "terraform", + "bucket_names": [ + "terraform-state-bucket" + ], + "region": "us-east-1" + }, + "type": "terraform-backends" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/iac-api/terraform/backends" + }, + "scenario": "Create a Terraform backend sync configuration returns \"Bad Request\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json new file mode 100644 index 00000000000..3d81a34ef8e --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json @@ -0,0 +1,35 @@ +{ + "api": "TerraformStateFiles", + "expected_status": 400, + "feature": "Terraform State Files", + "id": "v2/Terraform State Files/Delete a Terraform backend sync configuration returns \"Bad Request\" response", + "operation_id": "DeleteTerraformBackendSyncConfig", + "request": { + "body": null, + "content_type": null, + "method": "DELETE", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "invalid-id" + }, + "style": null + } + ], + "path": "/api/v2/iac-api/terraform/backends/{id}" + }, + "scenario": "Delete a Terraform backend sync configuration returns \"Bad Request\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json new file mode 100644 index 00000000000..78d447baea5 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "TerraformStateFiles", + "expected_status": 200, + "feature": "Terraform State Files", + "id": "v2/Terraform State Files/List Terraform backend sync configurations returns \"OK\" response", + "operation_id": "ListTerraformBackendSyncConfigs", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "query", + "name": "account_id", + "required": false, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "123456789012" + }, + "style": null + } + ], + "path": "/api/v2/iac-api/terraform/backends" + }, + "scenario": "List Terraform backend sync configurations returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json new file mode 100644 index 00000000000..552b5bef562 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json @@ -0,0 +1,53 @@ +{ + "api": "TerraformStateFiles", + "expected_status": 409, + "feature": "Terraform State Files", + "id": "v2/Terraform State Files/Update a Terraform backend sync configuration returns \"Conflict\" response", + "operation_id": "UpdateTerraformBackendSyncConfig", + "request": { + "body": { + "schema": { + "format": null, + "ref": "TerraformBackendUpdateRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "bucket_names": [ + "terraform-state-bucket" + ] + }, + "id": "2", + "type": "terraform-backends" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "id", + "required": true, + "schema": { + "format": null, + "ref": null, + "type": "string" + }, + "source": { + "type": "literal", + "value": "1" + }, + "style": null + } + ], + "path": "/api/v2/iac-api/terraform/backends/{id}" + }, + "scenario": "Update a Terraform backend sync configuration returns \"Conflict\" response", + "schema_version": 1, + "version": "v2" +}