Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
471 changes: 471 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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")
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
90 changes: 90 additions & 0 deletions features/v2/terraform_state_files.feature
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
28 changes: 28 additions & 0 deletions generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
Loading
Loading