diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 81f698c5f3..6016eee436 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.py b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.py new file mode 100644 index 0000000000..2382f04ced --- /dev/null +++ b/examples/v2/terraform-state-files/CreateTerraformBackendSyncConfig.py @@ -0,0 +1,32 @@ +""" +Create a Terraform backend sync configuration returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.terraform_state_files_api import TerraformStateFilesApi +from datadog_api_client.v2.model.terraform_backend_create_attributes import TerraformBackendCreateAttributes +from datadog_api_client.v2.model.terraform_backend_create_data import TerraformBackendCreateData +from datadog_api_client.v2.model.terraform_backend_create_request import TerraformBackendCreateRequest +from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind +from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + +body = TerraformBackendCreateRequest( + data=TerraformBackendCreateData( + attributes=TerraformBackendCreateAttributes( + account_id="123456789012", + backend_type=TerraformBackendKind.TERRAFORM, + bucket_names=[ + "terraform-state-bucket", + ], + region="us-east-1", + ), + type=TerraformBackendType.TERRAFORM_BACKENDS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TerraformStateFilesApi(api_client) + response = api_instance.create_terraform_backend_sync_config(body=body) + + print(response) diff --git a/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.py b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.py new file mode 100644 index 0000000000..6562f82c1d --- /dev/null +++ b/examples/v2/terraform-state-files/DeleteTerraformBackendSyncConfig.py @@ -0,0 +1,13 @@ +""" +Delete a Terraform backend sync configuration returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.terraform_state_files_api import TerraformStateFilesApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TerraformStateFilesApi(api_client) + api_instance.delete_terraform_backend_sync_config( + id="9007199254740993", + ) diff --git a/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.py b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.py new file mode 100644 index 0000000000..0acb0f160e --- /dev/null +++ b/examples/v2/terraform-state-files/ListTerraformBackendSyncConfigs.py @@ -0,0 +1,15 @@ +""" +List Terraform backend sync configurations returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.terraform_state_files_api import TerraformStateFilesApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TerraformStateFilesApi(api_client) + response = api_instance.list_terraform_backend_sync_configs( + account_id="123456789012", + ) + + print(response) diff --git a/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.py b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.py new file mode 100644 index 0000000000..506f1528cd --- /dev/null +++ b/examples/v2/terraform-state-files/UpdateTerraformBackendSyncConfig.py @@ -0,0 +1,29 @@ +""" +Update a Terraform backend sync configuration returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.terraform_state_files_api import TerraformStateFilesApi +from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType +from datadog_api_client.v2.model.terraform_backend_update_attributes import TerraformBackendUpdateAttributes +from datadog_api_client.v2.model.terraform_backend_update_data import TerraformBackendUpdateData +from datadog_api_client.v2.model.terraform_backend_update_request import TerraformBackendUpdateRequest + +body = TerraformBackendUpdateRequest( + data=TerraformBackendUpdateData( + attributes=TerraformBackendUpdateAttributes( + bucket_names=[ + "terraform-state-bucket", + ], + ), + id="9007199254740993", + type=TerraformBackendType.TERRAFORM_BACKENDS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TerraformStateFilesApi(api_client) + response = api_instance.update_terraform_backend_sync_config(id="9007199254740993", body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/terraform_state_files_api.py b/src/datadog_api_client/v2/api/terraform_state_files_api.py new file mode 100644 index 0000000000..c801e72532 --- /dev/null +++ b/src/datadog_api_client/v2/api/terraform_state_files_api.py @@ -0,0 +1,192 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.terraform_backend_list_response import TerraformBackendListResponse +from datadog_api_client.v2.model.terraform_backend_response import TerraformBackendResponse +from datadog_api_client.v2.model.terraform_backend_create_request import TerraformBackendCreateRequest +from datadog_api_client.v2.model.terraform_backend_update_request import TerraformBackendUpdateRequest + + +class TerraformStateFilesApi: + """ + Configure synchronization of Terraform state files from S3 buckets and inspect synchronization status. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_terraform_backend_sync_config_endpoint = _Endpoint( + settings={ + "response_type": (TerraformBackendResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/iac-api/terraform/backends", + "operation_id": "create_terraform_backend_sync_config", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (TerraformBackendCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_terraform_backend_sync_config_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/iac-api/terraform/backends/{id}", + "operation_id": "delete_terraform_backend_sync_config", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._list_terraform_backend_sync_configs_endpoint = _Endpoint( + settings={ + "response_type": (TerraformBackendListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/iac-api/terraform/backends", + "operation_id": "list_terraform_backend_sync_configs", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "account_id": { + "openapi_types": (str,), + "attribute": "account_id", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_terraform_backend_sync_config_endpoint = _Endpoint( + settings={ + "response_type": (TerraformBackendResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/iac-api/terraform/backends/{id}", + "operation_id": "update_terraform_backend_sync_config", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (TerraformBackendUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_terraform_backend_sync_config( + self, + body: TerraformBackendCreateRequest, + ) -> TerraformBackendResponse: + """Create a Terraform backend sync configuration. + + Create a Terraform backend sync configuration for an AWS account, region, and set of S3 buckets. + + :type body: TerraformBackendCreateRequest + :rtype: TerraformBackendResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_terraform_backend_sync_config_endpoint.call_with_http_info(**kwargs) + + def delete_terraform_backend_sync_config( + self, + id: str, + ) -> None: + """Delete a Terraform backend sync configuration. + + Delete a Terraform backend sync configuration and its synchronized state files. + + :param id: Terraform backend sync configuration ID. + :type id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + return self._delete_terraform_backend_sync_config_endpoint.call_with_http_info(**kwargs) + + def list_terraform_backend_sync_configs( + self, + *, + account_id: Union[str, UnsetType] = unset, + ) -> TerraformBackendListResponse: + """List Terraform backend sync configurations. + + List Terraform backend sync configurations, optionally filtered by AWS account ID. + + :param account_id: AWS account ID used to filter configurations. Omit to list all configurations for the organization. + :type account_id: str, optional + :rtype: TerraformBackendListResponse + """ + kwargs: Dict[str, Any] = {} + if account_id is not unset: + kwargs["account_id"] = account_id + + return self._list_terraform_backend_sync_configs_endpoint.call_with_http_info(**kwargs) + + def update_terraform_backend_sync_config( + self, + id: str, + body: TerraformBackendUpdateRequest, + ) -> TerraformBackendResponse: + """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: Terraform backend sync configuration ID. + :type id: str + :type body: TerraformBackendUpdateRequest + :rtype: TerraformBackendResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + kwargs["body"] = body + + return self._update_terraform_backend_sync_config_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 4f1e9b0f60..f7e9c7e1fa 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -137,6 +137,7 @@ from datadog_api_client.v2.api.synthetics_api import SyntheticsApi from datadog_api_client.v2.api.tag_rules_api import TagRulesApi from datadog_api_client.v2.api.teams_api import TeamsApi +from datadog_api_client.v2.api.terraform_state_files_api import TerraformStateFilesApi from datadog_api_client.v2.api.test_optimization_api import TestOptimizationApi from datadog_api_client.v2.api.threat_intelligence_api import ThreatIntelligenceApi from datadog_api_client.v2.api.timeseries_anomaly_investigations_api import TimeseriesAnomalyInvestigationsApi @@ -290,6 +291,7 @@ "SyntheticsApi", "TagRulesApi", "TeamsApi", + "TerraformStateFilesApi", "TestOptimizationApi", "ThreatIntelligenceApi", "TimeseriesAnomalyInvestigationsApi", diff --git a/src/datadog_api_client/v2/model/terraform_backend_attributes.py b/src/datadog_api_client/v2/model/terraform_backend_attributes.py new file mode 100644 index 0000000000..ca409a0515 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_attributes.py @@ -0,0 +1,74 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind + from datadog_api_client.v2.model.terraform_backend_bucket import TerraformBackendBucket + + +class TerraformBackendAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind + from datadog_api_client.v2.model.terraform_backend_bucket import TerraformBackendBucket + + return { + "account_id": (str,), + "backend_type": (TerraformBackendKind,), + "buckets": ([TerraformBackendBucket],), + "org_id": (str,), + "region": (str,), + } + + attribute_map = { + "account_id": "account_id", + "backend_type": "backend_type", + "buckets": "buckets", + "org_id": "org_id", + "region": "region", + } + + def __init__( + self_, + account_id: str, + backend_type: TerraformBackendKind, + buckets: List[TerraformBackendBucket], + org_id: str, + region: str, + **kwargs, + ): + """ + Terraform backend sync configuration and bucket statuses. + + :param account_id: AWS account ID that owns the S3 buckets. + :type account_id: str + + :param backend_type: Backend type to synchronize. + :type backend_type: TerraformBackendKind + + :param buckets: Source buckets and their synchronization statuses. + :type buckets: [TerraformBackendBucket] + + :param org_id: Datadog organization ID. + :type org_id: str + + :param region: AWS region containing the S3 buckets. + :type region: str + """ + super().__init__(kwargs) + + self_.account_id = account_id + self_.backend_type = backend_type + self_.buckets = buckets + self_.org_id = org_id + self_.region = region diff --git a/src/datadog_api_client/v2/model/terraform_backend_bucket.py b/src/datadog_api_client/v2/model/terraform_backend_bucket.py new file mode 100644 index 0000000000..97eedafd39 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_bucket.py @@ -0,0 +1,81 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_sync_status import TerraformBackendSyncStatus + + +class TerraformBackendBucket(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_sync_status import TerraformBackendSyncStatus + + return { + "bucket_name": (str,), + "last_sync_error": (str,), + "last_sync_status": (TerraformBackendSyncStatus,), + "last_sync_time": (datetime, none_type), + "recurring_blob_sync_id": (str,), + "statefile_count": (int,), + } + + 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", + } + + def __init__( + self_, + bucket_name: str, + last_sync_error: str, + last_sync_status: TerraformBackendSyncStatus, + last_sync_time: Union[datetime, none_type], + recurring_blob_sync_id: str, + statefile_count: int, + **kwargs, + ): + """ + Synchronization status for an S3 bucket. + + :param bucket_name: Name of the source S3 bucket. + :type bucket_name: str + + :param last_sync_error: Error from the most recent failed synchronization, or an empty string otherwise. + :type last_sync_error: str + + :param last_sync_status: Most recent synchronization outcome, or pending if no outcome has been recorded. + :type last_sync_status: TerraformBackendSyncStatus + + :param last_sync_time: Time of the most recent synchronization outcome, or null if none has been recorded. + :type last_sync_time: datetime, none_type + + :param recurring_blob_sync_id: Identifier of the recurring synchronization job. + :type recurring_blob_sync_id: str + + :param statefile_count: Number of synchronized Terraform state files in the bucket. + :type statefile_count: int + """ + super().__init__(kwargs) + + self_.bucket_name = bucket_name + self_.last_sync_error = last_sync_error + self_.last_sync_status = last_sync_status + self_.last_sync_time = last_sync_time + self_.recurring_blob_sync_id = recurring_blob_sync_id + self_.statefile_count = statefile_count diff --git a/src/datadog_api_client/v2/model/terraform_backend_create_attributes.py b/src/datadog_api_client/v2/model/terraform_backend_create_attributes.py new file mode 100644 index 0000000000..8b890a854d --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_create_attributes.py @@ -0,0 +1,66 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind + + +class TerraformBackendCreateAttributes(ModelNormal): + validations = { + "bucket_names": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind + + return { + "account_id": (str,), + "backend_type": (TerraformBackendKind,), + "bucket_names": ([str],), + "region": (str,), + } + + attribute_map = { + "account_id": "account_id", + "backend_type": "backend_type", + "bucket_names": "bucket_names", + "region": "region", + } + + def __init__( + self_, account_id: str, backend_type: TerraformBackendKind, bucket_names: List[str], region: str, **kwargs + ): + """ + Settings for a new Terraform backend sync configuration. + + :param account_id: AWS account ID that owns the S3 buckets. + :type account_id: str + + :param backend_type: Backend type to synchronize. + :type backend_type: TerraformBackendKind + + :param bucket_names: Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + :type bucket_names: [str] + + :param region: AWS region containing the S3 buckets. + :type region: str + """ + super().__init__(kwargs) + + self_.account_id = account_id + self_.backend_type = backend_type + self_.bucket_names = bucket_names + self_.region = region diff --git a/src/datadog_api_client/v2/model/terraform_backend_create_data.py b/src/datadog_api_client/v2/model/terraform_backend_create_data.py new file mode 100644 index 0000000000..9aaca7c946 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_create_data.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_create_attributes import TerraformBackendCreateAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + +class TerraformBackendCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_create_attributes import TerraformBackendCreateAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + return { + "attributes": (TerraformBackendCreateAttributes,), + "type": (TerraformBackendType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: TerraformBackendCreateAttributes, type: TerraformBackendType, **kwargs): + """ + Terraform backend configuration create data. + + :param attributes: Settings for a new Terraform backend sync configuration. + :type attributes: TerraformBackendCreateAttributes + + :param type: Terraform backend configuration resource type. + :type type: TerraformBackendType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/terraform_backend_create_request.py b/src/datadog_api_client/v2/model/terraform_backend_create_request.py new file mode 100644 index 0000000000..825b555dd9 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_create_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_create_data import TerraformBackendCreateData + + +class TerraformBackendCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_create_data import TerraformBackendCreateData + + return { + "data": (TerraformBackendCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TerraformBackendCreateData, **kwargs): + """ + Request to create a Terraform backend sync configuration. + + :param data: Terraform backend configuration create data. + :type data: TerraformBackendCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/terraform_backend_data.py b/src/datadog_api_client/v2/model/terraform_backend_data.py new file mode 100644 index 0000000000..3538802dfe --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_attributes import TerraformBackendAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + +class TerraformBackendData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_attributes import TerraformBackendAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + return { + "attributes": (TerraformBackendAttributes,), + "id": (str,), + "type": (TerraformBackendType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: TerraformBackendAttributes, id: str, type: TerraformBackendType, **kwargs): + """ + A Terraform backend sync configuration. + + :param attributes: Terraform backend sync configuration and bucket statuses. + :type attributes: TerraformBackendAttributes + + :param id: Configuration ID, serialized as a string to preserve integer precision. + :type id: str + + :param type: Terraform backend configuration resource type. + :type type: TerraformBackendType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/terraform_backend_kind.py b/src/datadog_api_client/v2/model/terraform_backend_kind.py new file mode 100644 index 0000000000..59f6eb059a --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_kind.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TerraformBackendKind(ModelSimple): + """ + Backend type to synchronize. + + :param value: If omitted defaults to "terraform". Must be one of ["terraform"]. + :type value: str + """ + + allowed_values = { + "terraform", + } + TERRAFORM: ClassVar["TerraformBackendKind"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TerraformBackendKind.TERRAFORM = TerraformBackendKind("terraform") diff --git a/src/datadog_api_client/v2/model/terraform_backend_list_response.py b/src/datadog_api_client/v2/model/terraform_backend_list_response.py new file mode 100644 index 0000000000..37ddf529f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_list_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_data import TerraformBackendData + + +class TerraformBackendListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_data import TerraformBackendData + + return { + "data": ([TerraformBackendData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[TerraformBackendData], **kwargs): + """ + Response containing Terraform backend sync configurations. + + :param data: Configurations matching the optional account filter. + :type data: [TerraformBackendData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/terraform_backend_response.py b/src/datadog_api_client/v2/model/terraform_backend_response.py new file mode 100644 index 0000000000..efc0dc14d8 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_data import TerraformBackendData + + +class TerraformBackendResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_data import TerraformBackendData + + return { + "data": (TerraformBackendData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TerraformBackendData, **kwargs): + """ + Response containing a Terraform backend sync configuration. + + :param data: A Terraform backend sync configuration. + :type data: TerraformBackendData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/terraform_backend_sync_status.py b/src/datadog_api_client/v2/model/terraform_backend_sync_status.py new file mode 100644 index 0000000000..086acd9cd6 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_sync_status.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TerraformBackendSyncStatus(ModelSimple): + """ + Most recent synchronization outcome, or pending if no outcome has been recorded. + + :param value: Must be one of ["pending", "success", "failure"]. + :type value: str + """ + + allowed_values = { + "pending", + "success", + "failure", + } + PENDING: ClassVar["TerraformBackendSyncStatus"] + SUCCESS: ClassVar["TerraformBackendSyncStatus"] + FAILURE: ClassVar["TerraformBackendSyncStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TerraformBackendSyncStatus.PENDING = TerraformBackendSyncStatus("pending") +TerraformBackendSyncStatus.SUCCESS = TerraformBackendSyncStatus("success") +TerraformBackendSyncStatus.FAILURE = TerraformBackendSyncStatus("failure") diff --git a/src/datadog_api_client/v2/model/terraform_backend_type.py b/src/datadog_api_client/v2/model/terraform_backend_type.py new file mode 100644 index 0000000000..fbb34e7711 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TerraformBackendType(ModelSimple): + """ + Terraform backend configuration resource type. + + :param value: If omitted defaults to "terraform-backends". Must be one of ["terraform-backends"]. + :type value: str + """ + + allowed_values = { + "terraform-backends", + } + TERRAFORM_BACKENDS: ClassVar["TerraformBackendType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TerraformBackendType.TERRAFORM_BACKENDS = TerraformBackendType("terraform-backends") diff --git a/src/datadog_api_client/v2/model/terraform_backend_update_attributes.py b/src/datadog_api_client/v2/model/terraform_backend_update_attributes.py new file mode 100644 index 0000000000..9c1ee6e2e4 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_update_attributes.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class TerraformBackendUpdateAttributes(ModelNormal): + validations = { + "bucket_names": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "bucket_names": ([str],), + } + + attribute_map = { + "bucket_names": "bucket_names", + } + + def __init__(self_, bucket_names: List[str], **kwargs): + """ + Replacement bucket set for a Terraform backend sync configuration. + + :param bucket_names: Complete set of S3 bucket names to synchronize. Names must be nonempty and unique. + :type bucket_names: [str] + """ + super().__init__(kwargs) + + self_.bucket_names = bucket_names diff --git a/src/datadog_api_client/v2/model/terraform_backend_update_data.py b/src/datadog_api_client/v2/model/terraform_backend_update_data.py new file mode 100644 index 0000000000..04f5ab9406 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_update_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_update_attributes import TerraformBackendUpdateAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + +class TerraformBackendUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_update_attributes import TerraformBackendUpdateAttributes + from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType + + return { + "attributes": (TerraformBackendUpdateAttributes,), + "id": (str,), + "type": (TerraformBackendType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: TerraformBackendUpdateAttributes, id: str, type: TerraformBackendType, **kwargs): + """ + Terraform backend configuration update data. + + :param attributes: Replacement bucket set for a Terraform backend sync configuration. + :type attributes: TerraformBackendUpdateAttributes + + :param id: Configuration ID. Must match the ID in the request path. + :type id: str + + :param type: Terraform backend configuration resource type. + :type type: TerraformBackendType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/terraform_backend_update_request.py b/src/datadog_api_client/v2/model/terraform_backend_update_request.py new file mode 100644 index 0000000000..866c7ff081 --- /dev/null +++ b/src/datadog_api_client/v2/model/terraform_backend_update_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.terraform_backend_update_data import TerraformBackendUpdateData + + +class TerraformBackendUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.terraform_backend_update_data import TerraformBackendUpdateData + + return { + "data": (TerraformBackendUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: TerraformBackendUpdateData, **kwargs): + """ + Request to update a Terraform backend sync configuration. + + :param data: Terraform backend configuration update data. + :type data: TerraformBackendUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 3289fddd8a..72802f37c5 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -10870,6 +10870,20 @@ ) from datadog_api_client.v2.model.tenancy_products_data_type import TenancyProductsDataType from datadog_api_client.v2.model.tenancy_products_list import TenancyProductsList +from datadog_api_client.v2.model.terraform_backend_attributes import TerraformBackendAttributes +from datadog_api_client.v2.model.terraform_backend_bucket import TerraformBackendBucket +from datadog_api_client.v2.model.terraform_backend_create_attributes import TerraformBackendCreateAttributes +from datadog_api_client.v2.model.terraform_backend_create_data import TerraformBackendCreateData +from datadog_api_client.v2.model.terraform_backend_create_request import TerraformBackendCreateRequest +from datadog_api_client.v2.model.terraform_backend_data import TerraformBackendData +from datadog_api_client.v2.model.terraform_backend_kind import TerraformBackendKind +from datadog_api_client.v2.model.terraform_backend_list_response import TerraformBackendListResponse +from datadog_api_client.v2.model.terraform_backend_response import TerraformBackendResponse +from datadog_api_client.v2.model.terraform_backend_sync_status import TerraformBackendSyncStatus +from datadog_api_client.v2.model.terraform_backend_type import TerraformBackendType +from datadog_api_client.v2.model.terraform_backend_update_attributes import TerraformBackendUpdateAttributes +from datadog_api_client.v2.model.terraform_backend_update_data import TerraformBackendUpdateData +from datadog_api_client.v2.model.terraform_backend_update_request import TerraformBackendUpdateRequest from datadog_api_client.v2.model.test_optimization_delete_service_settings_request import ( TestOptimizationDeleteServiceSettingsRequest, ) @@ -19180,6 +19194,20 @@ "TenancyProductsDataAttributesProductsItems", "TenancyProductsDataType", "TenancyProductsList", + "TerraformBackendAttributes", + "TerraformBackendBucket", + "TerraformBackendCreateAttributes", + "TerraformBackendCreateData", + "TerraformBackendCreateRequest", + "TerraformBackendData", + "TerraformBackendKind", + "TerraformBackendListResponse", + "TerraformBackendResponse", + "TerraformBackendSyncStatus", + "TerraformBackendType", + "TerraformBackendUpdateAttributes", + "TerraformBackendUpdateData", + "TerraformBackendUpdateRequest", "TestOptimizationDeleteServiceSettingsRequest", "TestOptimizationDeleteServiceSettingsRequestAttributes", "TestOptimizationDeleteServiceSettingsRequestData", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index f06e0c4a10..730032c82b 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/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": "../../v2/features/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": "../../v2/features/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": "../../v2/features/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": "../../v2/features/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": "../../v2/features/threat_intelligence.feature", diff --git a/tests/generated-test/test-runner-data/v2/terraform-state-files/create-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/tests/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 0000000000..4ac36765b2 --- /dev/null +++ b/tests/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/tests/generated-test/test-runner-data/v2/terraform-state-files/delete-a-terraform-backend-sync-configuration-returns-bad-request-response.json b/tests/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 0000000000..3d81a34ef8 --- /dev/null +++ b/tests/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/tests/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/terraform-state-files/list-terraform-backend-sync-configurations-returns-ok-response.json new file mode 100644 index 0000000000..78d447baea --- /dev/null +++ b/tests/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/tests/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json b/tests/generated-test/test-runner-data/v2/terraform-state-files/update-a-terraform-backend-sync-configuration-returns-conflict-response.json new file mode 100644 index 0000000000..552b5bef56 --- /dev/null +++ b/tests/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/tests/generated-test/test-server-data/manifest.json b/tests/generated-test/test-server-data/manifest.json index 77fd3c6d42..b5971aa74a 100644 --- a/tests/generated-test/test-server-data/manifest.json +++ b/tests/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/tests/generated-test/test-server-data/v2/terraform-state-files.json b/tests/generated-test/test-server-data/v2/terraform-state-files.json new file mode 100644 index 0000000000..0a178e51d8 --- /dev/null +++ b/tests/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/tests/v2/features/terraform_state_files.feature b/tests/v2/features/terraform_state_files.feature new file mode 100644 index 0000000000..e0d85d518d --- /dev/null +++ b/tests/v2/features/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/tests/v2/features/undo.json b/tests/v2/features/undo.json index 1abefe2e9e..84cabc021b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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": {