From 27bf6276c8b05d8f6e498af8dee830ca37eb56a0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 21 Sep 2026 15:08:39 +0000 Subject: [PATCH] Regenerate client from commit c1f6c48 of spec repo --- .generator/schemas/v2/openapi.yaml | 471 ++++++++++++++++++ .../CreateTerraformBackendSyncConfig.rb | 19 + .../DeleteTerraformBackendSyncConfig.rb | 5 + .../ListTerraformBackendSyncConfigs.rb | 8 + .../UpdateTerraformBackendSyncConfig.rb | 17 + features/scenarios_model_mapping.rb | 13 + features/v2/terraform_state_files.feature | 90 ++++ features/v2/undo.json | 31 ++ generated-test/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 ++ generated-test/test-server-data/manifest.json | 5 + .../v2/terraform-state-files.json | 158 ++++++ lib/datadog_api_client/inflector.rb | 15 + .../v2/api/terraform_state_files_api.rb | 292 +++++++++++ .../v2/models/terraform_backend_attributes.rb | 209 ++++++++ .../v2/models/terraform_backend_bucket.rb | 225 +++++++++ .../terraform_backend_create_attributes.rb | 192 +++++++ .../models/terraform_backend_create_data.rb | 144 ++++++ .../terraform_backend_create_request.rb | 123 +++++ .../v2/models/terraform_backend_data.rb | 165 ++++++ .../v2/models/terraform_backend_kind.rb | 26 + .../models/terraform_backend_list_response.rb | 125 +++++ .../v2/models/terraform_backend_response.rb | 123 +++++ .../models/terraform_backend_sync_status.rb | 28 ++ .../v2/models/terraform_backend_type.rb | 26 + .../terraform_backend_update_attributes.rb | 129 +++++ .../models/terraform_backend_update_data.rb | 165 ++++++ .../terraform_backend_update_request.rb | 123 +++++ 31 files changed, 3116 insertions(+) create mode 100644 examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.rb create mode 100644 examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.rb create mode 100644 examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.rb create mode 100644 examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.rb create mode 100644 features/v2/terraform_state_files.feature create mode 100644 generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json create mode 100644 generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json create mode 100644 generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json create mode 100644 generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json create mode 100644 generated-test/test-server-data/v2/terraform-state-files.json create mode 100644 lib/datadog_api_client/v2/api/terraform_state_files_api.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_bucket.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_data.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_kind.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_response.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_sync_status.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_type.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/terraform_backend_update_request.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 81f698c5f321..6016eee4365d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -121883,6 +121883,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: @@ -159764,6 +159980,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. @@ -231091,6 +231560,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.rb b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.rb new file mode 100644 index 000000000000..5d0acf34decf --- /dev/null +++ b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.rb @@ -0,0 +1,19 @@ +# Create a Terraform backend sync configuration returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TerraformStateFilesAPI.new + +body = DatadogAPIClient::V2::TerraformBackendCreateRequest.new({ + data: DatadogAPIClient::V2::TerraformBackendCreateData.new({ + attributes: DatadogAPIClient::V2::TerraformBackendCreateAttributes.new({ + account_id: "123456789012", + backend_type: DatadogAPIClient::V2::TerraformBackendKind::TERRAFORM, + bucket_names: [ + "terraform-state-bucket", + ], + region: "us-east-1", + }), + type: DatadogAPIClient::V2::TerraformBackendType::TERRAFORM_BACKENDS, + }), +}) +p api_instance.create_terraform_backend_sync_config(body) diff --git a/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.rb b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.rb new file mode 100644 index 000000000000..8eff182f5e4d --- /dev/null +++ b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.rb @@ -0,0 +1,5 @@ +# Delete a Terraform backend sync configuration returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TerraformStateFilesAPI.new +api_instance.delete_terraform_backend_sync_config("9007199254740993") diff --git a/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.rb b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.rb new file mode 100644 index 000000000000..9a8f6f79a1fb --- /dev/null +++ b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.rb @@ -0,0 +1,8 @@ +# List Terraform backend sync configurations returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TerraformStateFilesAPI.new +opts = { + account_id: "123456789012", +} +p api_instance.list_terraform_backend_sync_configs(opts) diff --git a/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.rb b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.rb new file mode 100644 index 000000000000..366cb3a80959 --- /dev/null +++ b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.rb @@ -0,0 +1,17 @@ +# Update a Terraform backend sync configuration returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TerraformStateFilesAPI.new + +body = DatadogAPIClient::V2::TerraformBackendUpdateRequest.new({ + data: DatadogAPIClient::V2::TerraformBackendUpdateData.new({ + attributes: DatadogAPIClient::V2::TerraformBackendUpdateAttributes.new({ + bucket_names: [ + "terraform-state-bucket", + ], + }), + id: "9007199254740993", + type: DatadogAPIClient::V2::TerraformBackendType::TERRAFORM_BACKENDS, + }), +}) +p api_instance.update_terraform_backend_sync_config("9007199254740993", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index b6ed09aa920d..6e64058aaccd 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3700,6 +3700,19 @@ "v2.CreateHamrOrgConnection" => { "body" => "HamrOrgConnectionRequest", }, + "v2.ListTerraformBackendSyncConfigs" => { + "account_id" => "String", + }, + "v2.CreateTerraformBackendSyncConfig" => { + "body" => "TerraformBackendCreateRequest", + }, + "v2.DeleteTerraformBackendSyncConfig" => { + "id" => "String", + }, + "v2.UpdateTerraformBackendSyncConfig" => { + "id" => "String", + "body" => "TerraformBackendUpdateRequest", + }, "v2.UpdateIdentityProvider" => { "idp_id" => "String", "body" => "IdentityProviderUpdateRequest", diff --git a/features/v2/terraform_state_files.feature b/features/v2/terraform_state_files.feature new file mode 100644 index 000000000000..e0d85d518db7 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 1abefe2e9ed3..84cabc021b89 100644 --- a/features/v2/undo.json +++ b/features/v2/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/generated-test/test-runner-data/manifest.json b/generated-test/test-runner-data/manifest.json index 5f10ac681dc9..11a840bd7ada 100644 --- a/generated-test/test-runner-data/manifest.json +++ b/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": "../../features/v2/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": "../../features/v2/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": "../../features/v2/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": "../../features/v2/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": "../../features/v2/threat_intelligence.feature", diff --git a/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/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 000000000000..4ac36765b2d7 --- /dev/null +++ b/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/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/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 000000000000..3d81a34ef8e6 --- /dev/null +++ b/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/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json b/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json new file mode 100644 index 000000000000..78d447baea5e --- /dev/null +++ b/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/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json b/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json new file mode 100644 index 000000000000..552b5bef5621 --- /dev/null +++ b/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" +} diff --git a/generated-test/test-server-data/manifest.json b/generated-test/test-server-data/manifest.json index 77fd3c6d4260..b5971aa74ab6 100644 --- a/generated-test/test-server-data/manifest.json +++ b/generated-test/test-server-data/manifest.json @@ -535,6 +535,11 @@ "file": "v2/teams.json", "version": "v2" }, + { + "feature": "Terraform State Files", + "file": "v2/terraform-state-files.json", + "version": "v2" + }, { "feature": "Threat Intelligence", "file": "v2/threat-intelligence.json", diff --git a/generated-test/test-server-data/v2/terraform-state-files.json b/generated-test/test-server-data/v2/terraform-state-files.json new file mode 100644 index 000000000000..0a178e51d8ce --- /dev/null +++ b/generated-test/test-server-data/v2/terraform-state-files.json @@ -0,0 +1,158 @@ +{ + "feature": "Terraform State Files", + "recordings": [ + { + "feature": "Terraform State Files", + "frozen_at": "2026-09-21T14:21:29.111Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "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", + "path": "/api/v2/iac-api/terraform/backends", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"account_id must not be empty\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Create a Terraform backend sync configuration returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "frozen_at": "2026-09-21T14:21:29.176Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/iac-api/terraform/backends/invalid-id", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"path parameter id must be an integer\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Bad Request", + "status": 400 + } + } + ], + "scenario": "Delete a Terraform backend sync configuration returns \"Bad Request\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "frozen_at": "2026-09-21T14:21:29.270Z", + "interactions": [ + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/iac-api/terraform/backends", + "query": [ + [ + "account_id", + "123456789012" + ] + ] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":[]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "List Terraform backend sync configurations returns \"OK\" response", + "version": "v2" + }, + { + "feature": "Terraform State Files", + "frozen_at": "2026-09-21T14:21:29.365Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "bucket_names": [ + "terraform-state-bucket" + ] + }, + "id": "2", + "type": "terraform-backends" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/iac-api/terraform/backends/1", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"data.id must match the configuration id in the URL\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Conflict", + "status": 409 + } + } + ], + "scenario": "Update a Terraform backend sync configuration returns \"Conflict\" response", + "version": "v2" + } + ], + "schema_version": 1, + "version": "v2" +} diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 5ef436525253..c1a8cfff6e62 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -8575,6 +8575,20 @@ def overrides "v2.tenancy_products_data_attributes_products_items" => "TenancyProductsDataAttributesProductsItems", "v2.tenancy_products_data_type" => "TenancyProductsDataType", "v2.tenancy_products_list" => "TenancyProductsList", + "v2.terraform_backend_attributes" => "TerraformBackendAttributes", + "v2.terraform_backend_bucket" => "TerraformBackendBucket", + "v2.terraform_backend_create_attributes" => "TerraformBackendCreateAttributes", + "v2.terraform_backend_create_data" => "TerraformBackendCreateData", + "v2.terraform_backend_create_request" => "TerraformBackendCreateRequest", + "v2.terraform_backend_data" => "TerraformBackendData", + "v2.terraform_backend_kind" => "TerraformBackendKind", + "v2.terraform_backend_list_response" => "TerraformBackendListResponse", + "v2.terraform_backend_response" => "TerraformBackendResponse", + "v2.terraform_backend_sync_status" => "TerraformBackendSyncStatus", + "v2.terraform_backend_type" => "TerraformBackendType", + "v2.terraform_backend_update_attributes" => "TerraformBackendUpdateAttributes", + "v2.terraform_backend_update_data" => "TerraformBackendUpdateData", + "v2.terraform_backend_update_request" => "TerraformBackendUpdateRequest", "v2.test_optimization_delete_service_settings_request" => "TestOptimizationDeleteServiceSettingsRequest", "v2.test_optimization_delete_service_settings_request_attributes" => "TestOptimizationDeleteServiceSettingsRequestAttributes", "v2.test_optimization_delete_service_settings_request_data" => "TestOptimizationDeleteServiceSettingsRequestData", @@ -9298,6 +9312,7 @@ def overrides "v2.synthetics_api" => "SyntheticsAPI", "v2.tag_rules_api" => "TagRulesAPI", "v2.teams_api" => "TeamsAPI", + "v2.terraform_state_files_api" => "TerraformStateFilesAPI", "v2.test_optimization_api" => "TestOptimizationAPI", "v2.threat_intelligence_api" => "ThreatIntelligenceAPI", "v2.timeseries_anomaly_investigations_api" => "TimeseriesAnomalyInvestigationsAPI", diff --git a/lib/datadog_api_client/v2/api/terraform_state_files_api.rb b/lib/datadog_api_client/v2/api/terraform_state_files_api.rb new file mode 100644 index 000000000000..30698805bced --- /dev/null +++ b/lib/datadog_api_client/v2/api/terraform_state_files_api.rb @@ -0,0 +1,292 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class TerraformStateFilesAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a Terraform backend sync configuration. + # + # @see #create_terraform_backend_sync_config_with_http_info + def create_terraform_backend_sync_config(body, opts = {}) + data, _status_code, _headers = create_terraform_backend_sync_config_with_http_info(body, opts) + data + end + + # Create a Terraform backend sync configuration. + # + # Create a Terraform backend sync configuration for an AWS account, region, and set of S3 buckets. + # + # @param body [TerraformBackendCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TerraformBackendResponse, Integer, Hash)>] TerraformBackendResponse data, response status code and response headers + def create_terraform_backend_sync_config_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TerraformStateFilesAPI.create_terraform_backend_sync_config ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling TerraformStateFilesAPI.create_terraform_backend_sync_config" + end + # resource path + local_var_path = '/api/v2/iac-api/terraform/backends' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TerraformBackendResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_terraform_backend_sync_config, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TerraformStateFilesAPI#create_terraform_backend_sync_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a Terraform backend sync configuration. + # + # @see #delete_terraform_backend_sync_config_with_http_info + def delete_terraform_backend_sync_config(id, opts = {}) + delete_terraform_backend_sync_config_with_http_info(id, opts) + nil + end + + # Delete a Terraform backend sync configuration. + # + # Delete a Terraform backend sync configuration and its synchronized state files. + # + # @param id [String] Terraform backend sync configuration ID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_terraform_backend_sync_config_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TerraformStateFilesAPI.delete_terraform_backend_sync_config ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TerraformStateFilesAPI.delete_terraform_backend_sync_config" + end + # resource path + local_var_path = '/api/v2/iac-api/terraform/backends/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_terraform_backend_sync_config, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TerraformStateFilesAPI#delete_terraform_backend_sync_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Terraform backend sync configurations. + # + # @see #list_terraform_backend_sync_configs_with_http_info + def list_terraform_backend_sync_configs(opts = {}) + data, _status_code, _headers = list_terraform_backend_sync_configs_with_http_info(opts) + data + end + + # List Terraform backend sync configurations. + # + # List Terraform backend sync configurations, optionally filtered by AWS account ID. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :account_id AWS account ID used to filter configurations. Omit to list all configurations for the organization. + # @return [Array<(TerraformBackendListResponse, Integer, Hash)>] TerraformBackendListResponse data, response status code and response headers + def list_terraform_backend_sync_configs_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TerraformStateFilesAPI.list_terraform_backend_sync_configs ...' + end + # resource path + local_var_path = '/api/v2/iac-api/terraform/backends' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TerraformBackendListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_terraform_backend_sync_configs, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TerraformStateFilesAPI#list_terraform_backend_sync_configs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a Terraform backend sync configuration. + # + # @see #update_terraform_backend_sync_config_with_http_info + def update_terraform_backend_sync_config(id, body, opts = {}) + data, _status_code, _headers = update_terraform_backend_sync_config_with_http_info(id, body, opts) + data + end + + # Update a Terraform backend sync configuration. + # + # 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 [String] Terraform backend sync configuration ID. + # @param body [TerraformBackendUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TerraformBackendResponse, Integer, Hash)>] TerraformBackendResponse data, response status code and response headers + def update_terraform_backend_sync_config_with_http_info(id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TerraformStateFilesAPI.update_terraform_backend_sync_config ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TerraformStateFilesAPI.update_terraform_backend_sync_config" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling TerraformStateFilesAPI.update_terraform_backend_sync_config" + end + # resource path + local_var_path = '/api/v2/iac-api/terraform/backends/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TerraformBackendResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_terraform_backend_sync_config, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TerraformStateFilesAPI#update_terraform_backend_sync_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_attributes.rb b/lib/datadog_api_client/v2/models/terraform_backend_attributes.rb new file mode 100644 index 000000000000..3401fae49af7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_attributes.rb @@ -0,0 +1,209 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Terraform backend sync configuration and bucket statuses. + class TerraformBackendAttributes + include BaseGenericModel + + # AWS account ID that owns the S3 buckets. + attr_reader :account_id + + # Backend type to synchronize. + attr_reader :backend_type + + # Source buckets and their synchronization statuses. + attr_reader :buckets + + # Datadog organization ID. + attr_reader :org_id + + # AWS region containing the S3 buckets. + attr_reader :region + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_id' => :'account_id', + :'backend_type' => :'backend_type', + :'buckets' => :'buckets', + :'org_id' => :'org_id', + :'region' => :'region' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_id' => :'String', + :'backend_type' => :'TerraformBackendKind', + :'buckets' => :'Array', + :'org_id' => :'String', + :'region' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'backend_type') + self.backend_type = attributes[:'backend_type'] + end + + if attributes.key?(:'buckets') + if (value = attributes[:'buckets']).is_a?(Array) + self.buckets = value + end + end + + if attributes.key?(:'org_id') + self.org_id = attributes[:'org_id'] + end + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account_id.nil? + return false if @backend_type.nil? + return false if @buckets.nil? + return false if @org_id.nil? + return false if @region.nil? + true + end + + # Custom attribute writer method with validation + # @param account_id [Object] Object to be assigned + # @!visibility private + def account_id=(account_id) + if account_id.nil? + fail ArgumentError, 'invalid value for "account_id", account_id cannot be nil.' + end + @account_id = account_id + end + + # Custom attribute writer method with validation + # @param backend_type [Object] Object to be assigned + # @!visibility private + def backend_type=(backend_type) + if backend_type.nil? + fail ArgumentError, 'invalid value for "backend_type", backend_type cannot be nil.' + end + @backend_type = backend_type + end + + # Custom attribute writer method with validation + # @param buckets [Object] Object to be assigned + # @!visibility private + def buckets=(buckets) + if buckets.nil? + fail ArgumentError, 'invalid value for "buckets", buckets cannot be nil.' + end + @buckets = buckets + end + + # Custom attribute writer method with validation + # @param org_id [Object] Object to be assigned + # @!visibility private + def org_id=(org_id) + if org_id.nil? + fail ArgumentError, 'invalid value for "org_id", org_id cannot be nil.' + end + @org_id = org_id + end + + # Custom attribute writer method with validation + # @param region [Object] Object to be assigned + # @!visibility private + def region=(region) + if region.nil? + fail ArgumentError, 'invalid value for "region", region cannot be nil.' + end + @region = region + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + backend_type == o.backend_type && + buckets == o.buckets && + org_id == o.org_id && + region == o.region && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_id, backend_type, buckets, org_id, region, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_bucket.rb b/lib/datadog_api_client/v2/models/terraform_backend_bucket.rb new file mode 100644 index 000000000000..b1c2d4eb4756 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_bucket.rb @@ -0,0 +1,225 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Synchronization status for an S3 bucket. + class TerraformBackendBucket + include BaseGenericModel + + # Name of the source S3 bucket. + attr_reader :bucket_name + + # Error from the most recent failed synchronization, or an empty string otherwise. + attr_reader :last_sync_error + + # Most recent synchronization outcome, or pending if no outcome has been recorded. + attr_reader :last_sync_status + + # Time of the most recent synchronization outcome, or null if none has been recorded. + attr_accessor :last_sync_time + + # Identifier of the recurring synchronization job. + attr_reader :recurring_blob_sync_id + + # Number of synchronized Terraform state files in the bucket. + attr_reader :statefile_count + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bucket_name' => :'bucket_name', + :'last_sync_error' => :'last_sync_error', + :'last_sync_status' => :'last_sync_status', + :'last_sync_time' => :'last_sync_time', + :'recurring_blob_sync_id' => :'recurring_blob_sync_id', + :'statefile_count' => :'statefile_count' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bucket_name' => :'String', + :'last_sync_error' => :'String', + :'last_sync_status' => :'TerraformBackendSyncStatus', + :'last_sync_time' => :'Time', + :'recurring_blob_sync_id' => :'String', + :'statefile_count' => :'Integer' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'last_sync_time', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendBucket` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bucket_name') + self.bucket_name = attributes[:'bucket_name'] + end + + if attributes.key?(:'last_sync_error') + self.last_sync_error = attributes[:'last_sync_error'] + end + + if attributes.key?(:'last_sync_status') + self.last_sync_status = attributes[:'last_sync_status'] + end + + if attributes.key?(:'last_sync_time') + self.last_sync_time = attributes[:'last_sync_time'] + end + + if attributes.key?(:'recurring_blob_sync_id') + self.recurring_blob_sync_id = attributes[:'recurring_blob_sync_id'] + end + + if attributes.key?(:'statefile_count') + self.statefile_count = attributes[:'statefile_count'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @bucket_name.nil? + return false if @last_sync_error.nil? + return false if @last_sync_status.nil? + return false if @recurring_blob_sync_id.nil? + return false if @statefile_count.nil? + true + end + + # Custom attribute writer method with validation + # @param bucket_name [Object] Object to be assigned + # @!visibility private + def bucket_name=(bucket_name) + if bucket_name.nil? + fail ArgumentError, 'invalid value for "bucket_name", bucket_name cannot be nil.' + end + @bucket_name = bucket_name + end + + # Custom attribute writer method with validation + # @param last_sync_error [Object] Object to be assigned + # @!visibility private + def last_sync_error=(last_sync_error) + if last_sync_error.nil? + fail ArgumentError, 'invalid value for "last_sync_error", last_sync_error cannot be nil.' + end + @last_sync_error = last_sync_error + end + + # Custom attribute writer method with validation + # @param last_sync_status [Object] Object to be assigned + # @!visibility private + def last_sync_status=(last_sync_status) + if last_sync_status.nil? + fail ArgumentError, 'invalid value for "last_sync_status", last_sync_status cannot be nil.' + end + @last_sync_status = last_sync_status + end + + # Custom attribute writer method with validation + # @param recurring_blob_sync_id [Object] Object to be assigned + # @!visibility private + def recurring_blob_sync_id=(recurring_blob_sync_id) + if recurring_blob_sync_id.nil? + fail ArgumentError, 'invalid value for "recurring_blob_sync_id", recurring_blob_sync_id cannot be nil.' + end + @recurring_blob_sync_id = recurring_blob_sync_id + end + + # Custom attribute writer method with validation + # @param statefile_count [Object] Object to be assigned + # @!visibility private + def statefile_count=(statefile_count) + if statefile_count.nil? + fail ArgumentError, 'invalid value for "statefile_count", statefile_count cannot be nil.' + end + @statefile_count = statefile_count + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bucket_name == o.bucket_name && + last_sync_error == o.last_sync_error && + last_sync_status == o.last_sync_status && + last_sync_time == o.last_sync_time && + recurring_blob_sync_id == o.recurring_blob_sync_id && + statefile_count == o.statefile_count && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bucket_name, last_sync_error, last_sync_status, last_sync_time, recurring_blob_sync_id, statefile_count, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_create_attributes.rb b/lib/datadog_api_client/v2/models/terraform_backend_create_attributes.rb new file mode 100644 index 000000000000..3826478da35d --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_create_attributes.rb @@ -0,0 +1,192 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Settings for a new Terraform backend sync configuration. + class TerraformBackendCreateAttributes + include BaseGenericModel + + # AWS account ID that owns the S3 buckets. + attr_reader :account_id + + # Backend type to synchronize. + attr_reader :backend_type + + # Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + attr_reader :bucket_names + + # AWS region containing the S3 buckets. + attr_reader :region + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account_id' => :'account_id', + :'backend_type' => :'backend_type', + :'bucket_names' => :'bucket_names', + :'region' => :'region' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account_id' => :'String', + :'backend_type' => :'TerraformBackendKind', + :'bucket_names' => :'Array', + :'region' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'backend_type') + self.backend_type = attributes[:'backend_type'] + end + + if attributes.key?(:'bucket_names') + if (value = attributes[:'bucket_names']).is_a?(Array) + self.bucket_names = value + end + end + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account_id.nil? + return false if @backend_type.nil? + return false if @bucket_names.nil? + return false if @bucket_names.length < 1 + return false if @region.nil? + true + end + + # Custom attribute writer method with validation + # @param account_id [Object] Object to be assigned + # @!visibility private + def account_id=(account_id) + if account_id.nil? + fail ArgumentError, 'invalid value for "account_id", account_id cannot be nil.' + end + @account_id = account_id + end + + # Custom attribute writer method with validation + # @param backend_type [Object] Object to be assigned + # @!visibility private + def backend_type=(backend_type) + if backend_type.nil? + fail ArgumentError, 'invalid value for "backend_type", backend_type cannot be nil.' + end + @backend_type = backend_type + end + + # Custom attribute writer method with validation + # @param bucket_names [Object] Object to be assigned + # @!visibility private + def bucket_names=(bucket_names) + if bucket_names.nil? + fail ArgumentError, 'invalid value for "bucket_names", bucket_names cannot be nil.' + end + if bucket_names.length < 1 + fail ArgumentError, 'invalid value for "bucket_names", number of items must be greater than or equal to 1.' + end + @bucket_names = bucket_names + end + + # Custom attribute writer method with validation + # @param region [Object] Object to be assigned + # @!visibility private + def region=(region) + if region.nil? + fail ArgumentError, 'invalid value for "region", region cannot be nil.' + end + @region = region + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + backend_type == o.backend_type && + bucket_names == o.bucket_names && + region == o.region && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account_id, backend_type, bucket_names, region, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_create_data.rb b/lib/datadog_api_client/v2/models/terraform_backend_create_data.rb new file mode 100644 index 000000000000..0606e249fa67 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Terraform backend configuration create data. + class TerraformBackendCreateData + include BaseGenericModel + + # Settings for a new Terraform backend sync configuration. + attr_reader :attributes + + # Terraform backend configuration resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TerraformBackendCreateAttributes', + :'type' => :'TerraformBackendType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_create_request.rb b/lib/datadog_api_client/v2/models/terraform_backend_create_request.rb new file mode 100644 index 000000000000..08738ed3f03f --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to create a Terraform backend sync configuration. + class TerraformBackendCreateRequest + include BaseGenericModel + + # Terraform backend configuration create data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TerraformBackendCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_data.rb b/lib/datadog_api_client/v2/models/terraform_backend_data.rb new file mode 100644 index 000000000000..1bb4da0d258e --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A Terraform backend sync configuration. + class TerraformBackendData + include BaseGenericModel + + # Terraform backend sync configuration and bucket statuses. + attr_reader :attributes + + # Configuration ID, serialized as a string to preserve integer precision. + attr_reader :id + + # Terraform backend configuration resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TerraformBackendAttributes', + :'id' => :'String', + :'type' => :'TerraformBackendType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_kind.rb b/lib/datadog_api_client/v2/models/terraform_backend_kind.rb new file mode 100644 index 000000000000..80e9c13b9447 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_kind.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Backend type to synchronize. + class TerraformBackendKind + include BaseEnumModel + + TERRAFORM = "terraform".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_list_response.rb b/lib/datadog_api_client/v2/models/terraform_backend_list_response.rb new file mode 100644 index 000000000000..9b514fb3924c --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_list_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing Terraform backend sync configurations. + class TerraformBackendListResponse + include BaseGenericModel + + # Configurations matching the optional account filter. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_response.rb b/lib/datadog_api_client/v2/models/terraform_backend_response.rb new file mode 100644 index 000000000000..fc8380969991 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a Terraform backend sync configuration. + class TerraformBackendResponse + include BaseGenericModel + + # A Terraform backend sync configuration. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TerraformBackendData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_sync_status.rb b/lib/datadog_api_client/v2/models/terraform_backend_sync_status.rb new file mode 100644 index 000000000000..e24a6372441c --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_sync_status.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Most recent synchronization outcome, or pending if no outcome has been recorded. + class TerraformBackendSyncStatus + include BaseEnumModel + + PENDING = "pending".freeze + SUCCESS = "success".freeze + FAILURE = "failure".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_type.rb b/lib/datadog_api_client/v2/models/terraform_backend_type.rb new file mode 100644 index 000000000000..4c648b02008f --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Terraform backend configuration resource type. + class TerraformBackendType + include BaseEnumModel + + TERRAFORM_BACKENDS = "terraform-backends".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_update_attributes.rb b/lib/datadog_api_client/v2/models/terraform_backend_update_attributes.rb new file mode 100644 index 000000000000..bf3931bb25de --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_update_attributes.rb @@ -0,0 +1,129 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Replacement bucket set for a Terraform backend sync configuration. + class TerraformBackendUpdateAttributes + include BaseGenericModel + + # Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + attr_reader :bucket_names + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bucket_names' => :'bucket_names' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bucket_names' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bucket_names') + if (value = attributes[:'bucket_names']).is_a?(Array) + self.bucket_names = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @bucket_names.nil? + return false if @bucket_names.length < 1 + true + end + + # Custom attribute writer method with validation + # @param bucket_names [Object] Object to be assigned + # @!visibility private + def bucket_names=(bucket_names) + if bucket_names.nil? + fail ArgumentError, 'invalid value for "bucket_names", bucket_names cannot be nil.' + end + if bucket_names.length < 1 + fail ArgumentError, 'invalid value for "bucket_names", number of items must be greater than or equal to 1.' + end + @bucket_names = bucket_names + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bucket_names == o.bucket_names && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bucket_names, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_update_data.rb b/lib/datadog_api_client/v2/models/terraform_backend_update_data.rb new file mode 100644 index 000000000000..f07556f4e7f2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_update_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Terraform backend configuration update data. + class TerraformBackendUpdateData + include BaseGenericModel + + # Replacement bucket set for a Terraform backend sync configuration. + attr_reader :attributes + + # Configuration ID. Must match the ID in the request path. + attr_reader :id + + # Terraform backend configuration resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TerraformBackendUpdateAttributes', + :'id' => :'String', + :'type' => :'TerraformBackendType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/terraform_backend_update_request.rb b/lib/datadog_api_client/v2/models/terraform_backend_update_request.rb new file mode 100644 index 000000000000..6fe851225da6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/terraform_backend_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to update a Terraform backend sync configuration. + class TerraformBackendUpdateRequest + include BaseGenericModel + + # Terraform backend configuration update data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TerraformBackendUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TerraformBackendUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end