From a24a0bba5785dc091142c80da55d9b397c682da0 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:27:58 +0000 Subject: [PATCH] aws api adding extended and deprecating old resource collection field (#2463) Co-authored-by: ci.datadog-api-spec Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> --- .apigentools-info | 8 +-- .generator/schemas/v1/openapi.yaml | 11 ++- api/datadogV1/model_aws_account.go | 69 +++++++++++++++---- .../v1/aws-integration/CreateAWSAccount.go | 6 +- .../aws-integration/CreateNewAWSExternalID.go | 1 + .../v1/aws-integration/UpdateAWSAccount.go | 6 +- ...AWS_integration_returns_OK_response.freeze | 2 +- ...n_AWS_integration_returns_OK_response.yaml | 6 +- ...AWS_integration_returns_OK_response.freeze | 2 +- ...n_AWS_integration_returns_OK_response.yaml | 10 +-- ...AWS_integration_returns_OK_response.freeze | 2 +- ...n_AWS_integration_returns_OK_response.yaml | 10 +-- .../features/v1/aws_integration.feature | 16 ++--- tests/scenarios/features/v1/given.json | 2 +- 14 files changed, 101 insertions(+), 50 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 76daab6c4b5..eb99a48089e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-10 17:49:46.632329", - "spec_repo_commit": "bb0f8c92" + "regenerated": "2024-04-10 19:45:03.769689", + "spec_repo_commit": "3fb610b5" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-04-10 17:49:46.651626", - "spec_repo_commit": "bb0f8c92" + "regenerated": "2024-04-10 19:45:03.787823", + "spec_repo_commit": "3fb610b5" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0945b223251..37646e9c4cb 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -90,6 +90,12 @@ components: description: Regions to exclude. type: string type: array + extended_resource_collection_enabled: + default: false + description: Whether Datadog collects additional attributes and configuration + information about the resources in your AWS account. Required for `cspm_resource_collection`. + example: true + type: boolean filter_tags: description: 'The array of EC2 tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from EC2. @@ -128,8 +134,9 @@ components: type: boolean resource_collection_enabled: default: false - description: Whether Datadog collects a standard set of resources from your - AWS account. + deprecated: true + description: Deprecated in favor of 'extended_resource_collection_enabled'. + Whether Datadog collects a standard set of resources from your AWS account. example: true type: boolean role_name: diff --git a/api/datadogV1/model_aws_account.go b/api/datadogV1/model_aws_account.go index a4dfa7b494a..609d56c5025 100644 --- a/api/datadogV1/model_aws_account.go +++ b/api/datadogV1/model_aws_account.go @@ -23,6 +23,8 @@ type AWSAccount struct { // An array of [AWS regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints) // to exclude from metrics collection. ExcludedRegions []string `json:"excluded_regions,omitempty"` + // Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Required for `cspm_resource_collection`. + ExtendedResourceCollectionEnabled *bool `json:"extended_resource_collection_enabled,omitempty"` // The array of EC2 tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from EC2. // Wildcards, such as `?` (for single characters) and `*` (for multiple characters) can also be used. // Only hosts that match one of the defined tags @@ -35,7 +37,8 @@ type AWSAccount struct { HostTags []string `json:"host_tags,omitempty"` // Whether Datadog collects metrics for this AWS account. MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` - // Whether Datadog collects a standard set of resources from your AWS account. + // Deprecated in favor of 'extended_resource_collection_enabled'. Whether Datadog collects a standard set of resources from your AWS account. + // Deprecated ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` // Your Datadog role delegation name. RoleName *string `json:"role_name,omitempty"` @@ -54,6 +57,8 @@ func NewAWSAccount() *AWSAccount { this := AWSAccount{} var cspmResourceCollectionEnabled bool = false this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled + var extendedResourceCollectionEnabled bool = false + this.ExtendedResourceCollectionEnabled = &extendedResourceCollectionEnabled var metricsCollectionEnabled bool = true this.MetricsCollectionEnabled = &metricsCollectionEnabled var resourceCollectionEnabled bool = false @@ -68,6 +73,8 @@ func NewAWSAccountWithDefaults() *AWSAccount { this := AWSAccount{} var cspmResourceCollectionEnabled bool = false this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled + var extendedResourceCollectionEnabled bool = false + this.ExtendedResourceCollectionEnabled = &extendedResourceCollectionEnabled var metricsCollectionEnabled bool = true this.MetricsCollectionEnabled = &metricsCollectionEnabled var resourceCollectionEnabled bool = false @@ -215,6 +222,34 @@ func (o *AWSAccount) SetExcludedRegions(v []string) { o.ExcludedRegions = v } +// GetExtendedResourceCollectionEnabled returns the ExtendedResourceCollectionEnabled field value if set, zero value otherwise. +func (o *AWSAccount) GetExtendedResourceCollectionEnabled() bool { + if o == nil || o.ExtendedResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.ExtendedResourceCollectionEnabled +} + +// GetExtendedResourceCollectionEnabledOk returns a tuple with the ExtendedResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccount) GetExtendedResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.ExtendedResourceCollectionEnabled == nil { + return nil, false + } + return o.ExtendedResourceCollectionEnabled, true +} + +// HasExtendedResourceCollectionEnabled returns a boolean if a field has been set. +func (o *AWSAccount) HasExtendedResourceCollectionEnabled() bool { + return o != nil && o.ExtendedResourceCollectionEnabled != nil +} + +// SetExtendedResourceCollectionEnabled gets a reference to the given bool and assigns it to the ExtendedResourceCollectionEnabled field. +func (o *AWSAccount) SetExtendedResourceCollectionEnabled(v bool) { + o.ExtendedResourceCollectionEnabled = &v +} + // GetFilterTags returns the FilterTags field value if set, zero value otherwise. func (o *AWSAccount) GetFilterTags() []string { if o == nil || o.FilterTags == nil { @@ -300,6 +335,7 @@ func (o *AWSAccount) SetMetricsCollectionEnabled(v bool) { } // GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. +// Deprecated func (o *AWSAccount) GetResourceCollectionEnabled() bool { if o == nil || o.ResourceCollectionEnabled == nil { var ret bool @@ -310,6 +346,7 @@ func (o *AWSAccount) GetResourceCollectionEnabled() bool { // GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *AWSAccount) GetResourceCollectionEnabledOk() (*bool, bool) { if o == nil || o.ResourceCollectionEnabled == nil { return nil, false @@ -323,6 +360,7 @@ func (o *AWSAccount) HasResourceCollectionEnabled() bool { } // SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. +// Deprecated func (o *AWSAccount) SetResourceCollectionEnabled(v bool) { o.ResourceCollectionEnabled = &v } @@ -404,6 +442,9 @@ func (o AWSAccount) MarshalJSON() ([]byte, error) { if o.ExcludedRegions != nil { toSerialize["excluded_regions"] = o.ExcludedRegions } + if o.ExtendedResourceCollectionEnabled != nil { + toSerialize["extended_resource_collection_enabled"] = o.ExtendedResourceCollectionEnabled + } if o.FilterTags != nil { toSerialize["filter_tags"] = o.FilterTags } @@ -432,24 +473,25 @@ func (o AWSAccount) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { all := struct { - AccessKeyId *string `json:"access_key_id,omitempty"` - AccountId *string `json:"account_id,omitempty"` - AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` - CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` - ExcludedRegions []string `json:"excluded_regions,omitempty"` - FilterTags []string `json:"filter_tags,omitempty"` - HostTags []string `json:"host_tags,omitempty"` - MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` - ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` - RoleName *string `json:"role_name,omitempty"` - SecretAccessKey *string `json:"secret_access_key,omitempty"` + AccessKeyId *string `json:"access_key_id,omitempty"` + AccountId *string `json:"account_id,omitempty"` + AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"` + CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"` + ExcludedRegions []string `json:"excluded_regions,omitempty"` + ExtendedResourceCollectionEnabled *bool `json:"extended_resource_collection_enabled,omitempty"` + FilterTags []string `json:"filter_tags,omitempty"` + HostTags []string `json:"host_tags,omitempty"` + MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"` + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + RoleName *string `json:"role_name,omitempty"` + SecretAccessKey *string `json:"secret_access_key,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "account_id", "account_specific_namespace_rules", "cspm_resource_collection_enabled", "excluded_regions", "filter_tags", "host_tags", "metrics_collection_enabled", "resource_collection_enabled", "role_name", "secret_access_key"}) + datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "account_id", "account_specific_namespace_rules", "cspm_resource_collection_enabled", "excluded_regions", "extended_resource_collection_enabled", "filter_tags", "host_tags", "metrics_collection_enabled", "resource_collection_enabled", "role_name", "secret_access_key"}) } else { return err } @@ -458,6 +500,7 @@ func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { o.AccountSpecificNamespaceRules = all.AccountSpecificNamespaceRules o.CspmResourceCollectionEnabled = all.CspmResourceCollectionEnabled o.ExcludedRegions = all.ExcludedRegions + o.ExtendedResourceCollectionEnabled = all.ExtendedResourceCollectionEnabled o.FilterTags = all.FilterTags o.HostTags = all.HostTags o.MetricsCollectionEnabled = all.MetricsCollectionEnabled diff --git a/examples/v1/aws-integration/CreateAWSAccount.go b/examples/v1/aws-integration/CreateAWSAccount.go index 1da75572741..c32e90f3c70 100644 --- a/examples/v1/aws-integration/CreateAWSAccount.go +++ b/examples/v1/aws-integration/CreateAWSAccount.go @@ -23,15 +23,15 @@ func main() { "us-east-1", "us-west-2", }, + ExtendedResourceCollectionEnabled: datadog.PtrBool(true), FilterTags: []string{ "$KEY:$VALUE", }, HostTags: []string{ "$KEY:$VALUE", }, - MetricsCollectionEnabled: datadog.PtrBool(false), - ResourceCollectionEnabled: datadog.PtrBool(true), - RoleName: datadog.PtrString("DatadogAWSIntegrationRole"), + MetricsCollectionEnabled: datadog.PtrBool(false), + RoleName: datadog.PtrString("DatadogAWSIntegrationRole"), } ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() diff --git a/examples/v1/aws-integration/CreateNewAWSExternalID.go b/examples/v1/aws-integration/CreateNewAWSExternalID.go index 94d8841d434..88c5d2ba032 100644 --- a/examples/v1/aws-integration/CreateNewAWSExternalID.go +++ b/examples/v1/aws-integration/CreateNewAWSExternalID.go @@ -24,6 +24,7 @@ func main() { "us-east-1", "us-west-2", }, + ExtendedResourceCollectionEnabled: datadog.PtrBool(true), FilterTags: []string{ "$KEY:$VALUE", }, diff --git a/examples/v1/aws-integration/UpdateAWSAccount.go b/examples/v1/aws-integration/UpdateAWSAccount.go index 3fcba70059b..3ae5f2833f1 100644 --- a/examples/v1/aws-integration/UpdateAWSAccount.go +++ b/examples/v1/aws-integration/UpdateAWSAccount.go @@ -23,15 +23,15 @@ func main() { "us-east-1", "us-west-2", }, + ExtendedResourceCollectionEnabled: datadog.PtrBool(true), FilterTags: []string{ "$KEY:$VALUE", }, HostTags: []string{ "$KEY:$VALUE", }, - MetricsCollectionEnabled: datadog.PtrBool(true), - ResourceCollectionEnabled: datadog.PtrBool(true), - RoleName: datadog.PtrString("DatadogAWSIntegrationRole"), + MetricsCollectionEnabled: datadog.PtrBool(true), + RoleName: datadog.PtrString("DatadogAWSIntegrationRole"), } ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.freeze index 7c618358256..fcf7051a3b4 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.freeze @@ -1 +1 @@ -2023-11-13T14:17:01.291Z \ No newline at end of file +2024-04-05T18:30:30.891Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.yaml index 17cf496f60e..78eca7ff09a 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_OK_response.yaml @@ -1,7 +1,7 @@ interactions: - request: body: | - {"account_id":"169988502100","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183000","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -12,7 +12,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/integration/aws response: - body: '{"external_id":"9668e281c0ef4cc8be01710ef7a0ae4c"} + body: '{"external_id":"acb8f6b8a844443dbb726d07dcb1a870"} ' code: 200 @@ -23,7 +23,7 @@ interactions: status: 200 OK - request: body: | - {"account_id":"169988502100","role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183000","role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.freeze index e3ae39811fa..320bb529875 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.freeze @@ -1 +1 @@ -2023-11-21T19:25:15.118Z \ No newline at end of file +2024-04-05T18:30:32.594Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.yaml index 2e476204870..8d65457f1cd 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_OK_response.yaml @@ -1,7 +1,7 @@ interactions: - request: body: | - {"account_id":"170059471500","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183200","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -12,7 +12,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/integration/aws response: - body: '{"external_id":"77c77ead62584b0fa1bb6a9fe7d2fa28"} + body: '{"external_id":"6aa1bf95e5dc4c9985593e94169bd2f6"} ' code: 200 @@ -23,7 +23,7 @@ interactions: status: 200 OK - request: body: | - {"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183200","role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -45,7 +45,7 @@ interactions: status: 200 OK - request: body: | - {"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183200","role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -56,7 +56,7 @@ interactions: method: DELETE url: https://api.datadoghq.com/api/v1/integration/aws response: - body: '{"errors":["AWS account 170059471500 does not exist in integration"]}' + body: '{"errors":["AWS account 171234183200 does not exist in integration"]}' code: 400 duration: 0ms headers: diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.freeze index 34d80ee0cd5..a9e26108fb2 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.freeze @@ -1 +1 @@ -2023-11-23T18:16:16.323Z \ No newline at end of file +2024-04-05T18:30:34.377Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.yaml index 0519c8d2b44..22fdac1c241 100644 --- a/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_OK_response.yaml @@ -1,7 +1,7 @@ interactions: - request: body: | - {"account_id":"170076337600","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183400","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -12,7 +12,7 @@ interactions: method: POST url: https://api.datadoghq.com/api/v1/integration/aws response: - body: '{"external_id":"c7298c166e774bf1bd1bc0419e68f1a0"} + body: '{"external_id":"c8ceedec95fc472fb6156f3104d425c9"} ' code: 200 @@ -23,7 +23,7 @@ interactions: status: 200 OK - request: body: | - {"account_id":"170076337600","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":false,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":true,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183400","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":false,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: @@ -32,7 +32,7 @@ interactions: - application/json id: 1 method: PUT - url: https://api.datadoghq.com/api/v1/integration/aws?account_id=170076337600&role_name=DatadogAWSIntegrationRole + url: https://api.datadoghq.com/api/v1/integration/aws?account_id=171234183400&role_name=DatadogAWSIntegrationRole response: body: '{} @@ -45,7 +45,7 @@ interactions: status: 200 OK - request: body: | - {"account_id":"170076337600","role_name":"DatadogAWSIntegrationRole"} + {"account_id":"171234183400","role_name":"DatadogAWSIntegrationRole"} form: {} headers: Accept: diff --git a/tests/scenarios/features/v1/aws_integration.feature b/tests/scenarios/features/v1/aws_integration.feature index b37be660e0e..017326abd32 100644 --- a/tests/scenarios/features/v1/aws_integration.feature +++ b/tests/scenarios/features/v1/aws_integration.feature @@ -12,21 +12,21 @@ Feature: AWS Integration @generated @skip @team:DataDog/cloud-integrations Scenario: Create an AWS integration returns "Bad Request" response Given new "CreateAWSAccount" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/cloud-integrations Scenario: Create an AWS integration returns "Conflict Error" response Given new "CreateAWSAccount" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 409 Conflict Error @team:DataDog/cloud-integrations Scenario: Create an AWS integration returns "OK" response Given new "CreateAWSAccount" request - And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 200 OK @@ -97,14 +97,14 @@ Feature: AWS Integration @generated @skip @team:DataDog/cloud-integrations Scenario: Generate a new external ID returns "Bad Request" response Given new "CreateNewAWSExternalID" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/cloud-integrations Scenario: Generate a new external ID returns "OK" response Given new "CreateNewAWSExternalID" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 200 OK @@ -169,14 +169,14 @@ Feature: AWS Integration @generated @skip @team:DataDog/cloud-integrations Scenario: Update an AWS integration returns "Bad Request" response Given new "UpdateAWSAccount" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/cloud-integrations Scenario: Update an AWS integration returns "Conflict Error" response Given new "UpdateAWSAccount" request - And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 409 Conflict Error @@ -184,7 +184,7 @@ Feature: AWS Integration Scenario: Update an AWS integration returns "OK" response Given there is a valid "aws_account" in the system And new "UpdateAWSAccount" request - And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": false, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": true, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} + And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": false, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} And request contains "account_id" parameter with value "{{ timestamp("now") }}00" And request contains "role_name" parameter with value "DatadogAWSIntegrationRole" When the request is sent diff --git a/tests/scenarios/features/v1/given.json b/tests/scenarios/features/v1/given.json index 0934ea27dd9..b1884bdbbad 100644 --- a/tests/scenarios/features/v1/given.json +++ b/tests/scenarios/features/v1/given.json @@ -104,7 +104,7 @@ { "name": "body", "origin": "request", - "value": "{\n \"account_id\": \"{{ timestamp(\"now\") }}00\",\n \"account_specific_namespace_rules\": {\n \"auto_scaling\": false\n },\n \"cspm_resource_collection_enabled\": true,\n \"excluded_regions\": [\n \"us-east-1\",\n \"us-west-2\"\n ],\n \"filter_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"host_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"metrics_collection_enabled\": false,\n \"resource_collection_enabled\": true,\n \"role_name\": \"DatadogAWSIntegrationRole\"\n}" + "value": "{\n \"account_id\": \"{{ timestamp(\"now\") }}00\",\n \"account_specific_namespace_rules\": {\n \"auto_scaling\": false\n },\n \"cspm_resource_collection_enabled\": true,\n \"excluded_regions\": [\n \"us-east-1\",\n \"us-west-2\"\n ],\n \"extended_resource_collection_enabled\": true,\n \"filter_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"host_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"metrics_collection_enabled\": false,\n \"role_name\": \"DatadogAWSIntegrationRole\"\n}" } ], "step": "there is a valid \"aws_account\" in the system",