diff --git a/.apigentools-info b/.apigentools-info index aadfc7462ea..0428ee69ce6 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-04 15:37:46.423606", - "spec_repo_commit": "e66bf244" + "regenerated": "2023-12-04 18:32:04.096708", + "spec_repo_commit": "07df9ec5" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-12-04 15:37:46.444320", - "spec_repo_commit": "e66bf244" + "regenerated": "2023-12-04 18:32:04.111110", + "spec_repo_commit": "07df9ec5" } } } \ No newline at end of file diff --git a/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/frozen.json b/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/frozen.json new file mode 100644 index 00000000000..6b321388960 --- /dev/null +++ b/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/frozen.json @@ -0,0 +1 @@ +"2023-11-21T19:25:15.118Z" diff --git a/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/recording.har b/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/recording.har new file mode 100644 index 00000000000..58f9b4e7fc4 --- /dev/null +++ b/cassettes/v1/AWS-Integration_2071210100/Delete-an-AWS-integration-returns-OK-response_3815706596/recording.har @@ -0,0 +1,173 @@ +{ + "log": { + "_recordingName": "AWS Integration/Delete an AWS integration returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "bb29ad65cdffba55412405b976907dc1", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 340, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 566, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"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\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/integration/aws" + }, + "response": { + "bodySize": 51, + "content": { + "mimeType": "application/json", + "size": 51, + "text": "{\"external_id\":\"77c77ead62584b0fa1bb6a9fe7d2fa28\"}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 516, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2023-11-21T19:25:15.135Z", + "time": 1335 + }, + { + "_id": "c922634dc5c2ad1983b0cbb0aad81180", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 69, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 567, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"account_id\":\"170059471500\",\"role_name\":\"DatadogAWSIntegrationRole\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/integration/aws" + }, + "response": { + "bodySize": 3, + "content": { + "mimeType": "application/json", + "size": 3, + "text": "{}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 492, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2023-11-21T19:25:16.482Z", + "time": 1225 + }, + { + "_id": "c922634dc5c2ad1983b0cbb0aad81180", + "_order": 1, + "cache": {}, + "request": { + "bodySize": 69, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 567, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"account_id\":\"170059471500\",\"role_name\":\"DatadogAWSIntegrationRole\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/integration/aws" + }, + "response": { + "bodySize": 69, + "content": { + "mimeType": "application/json", + "size": 69, + "text": "{\"errors\":[\"AWS account 170059471500 does not exist in integration\"]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 516, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 400, + "statusText": "Bad Request" + }, + "startedDateTime": "2023-11-21T19:25:17.719Z", + "time": 646 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/frozen.json b/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/frozen.json index 4fe93018a81..5cad1722be9 100644 --- a/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/frozen.json +++ b/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/frozen.json @@ -1 +1 @@ -"2022-05-17T15:38:07.190Z" +"2023-11-23T18:16:16.323Z" diff --git a/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/recording.har b/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/recording.har index c94ca26d06b..f379d126549 100644 --- a/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/recording.har +++ b/cassettes/v1/AWS-Integration_2071210100/Update-an-AWS-integration-returns-OK-response_598706190/recording.har @@ -8,11 +8,11 @@ }, "entries": [ { - "_id": "5a091278ee38e1a5fecb01ae94815ef4", + "_id": "e683ecb697b42ae82b13f186c3db794e", "_order": 0, "cache": {}, "request": { - "bodySize": 347, + "bodySize": 340, "cookies": [], "headers": [ { @@ -26,48 +26,154 @@ "value": "application/json" } ], - "headersSize": 632, + "headersSize": 566, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"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\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/integration/aws" + }, + "response": { + "bodySize": 51, + "content": { + "mimeType": "application/json", + "size": 51, + "text": "{\"external_id\":\"c7298c166e774bf1bd1bc0419e68f1a0\"}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 516, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2023-11-23T18:16:16.343Z", + "time": 2615 + }, + { + "_id": "b9ef091797137f878c603a564f800395", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 340, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 625, "httpVersion": "HTTP/1.1", "method": "PUT", "postData": { "mimeType": "application/json", "params": [], - "text": "{\"account_id\":\"123456789012\",\"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\":\"datadog-role\"}" + "text": "{\"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\"}" }, "queryString": [ { "name": "account_id", - "value": "123456789012" + "value": "170076337600" }, { "name": "role_name", - "value": "datadog-role" + "value": "DatadogAWSIntegrationRole" + } + ], + "url": "https://api.datadoghq.com/api/v1/integration/aws?account_id=170076337600&role_name=DatadogAWSIntegrationRole" + }, + "response": { + "bodySize": 3, + "content": { + "mimeType": "application/json", + "size": 3, + "text": "{}\n" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 492, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2023-11-23T18:16:18.984Z", + "time": 1204 + }, + { + "_id": "9979a2c458fd639b7988df76fa0025d7", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 69, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" } ], - "url": "https://api.datadoghq.com/api/v1/integration/aws?account_id=123456789012&role_name=datadog-role" + "headersSize": 567, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"account_id\":\"170076337600\",\"role_name\":\"DatadogAWSIntegrationRole\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/integration/aws" }, "response": { - "bodySize": 2, + "bodySize": 3, "content": { - "mimeType": "application/json;charset=utf-8", - "size": 2, - "text": "{}" + "mimeType": "application/json", + "size": 3, + "text": "{}\n" }, "cookies": [], "headers": [ { "name": "content-type", - "value": "application/json;charset=utf-8" + "value": "application/json" } ], - "headersSize": 654, + "headersSize": 492, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-05-17T15:38:07.204Z", - "time": 878 + "startedDateTime": "2023-11-23T18:16:20.211Z", + "time": 977 } ], "pages": [], diff --git a/examples/v1/aws-integration/DeleteAWSAccount.ts b/examples/v1/aws-integration/DeleteAWSAccount.ts index 52381fb4832..a65ad825a06 100644 --- a/examples/v1/aws-integration/DeleteAWSAccount.ts +++ b/examples/v1/aws-integration/DeleteAWSAccount.ts @@ -9,7 +9,7 @@ const apiInstance = new v1.AWSIntegrationApi(configuration); const params: v1.AWSIntegrationApiDeleteAWSAccountRequest = { body: { - accountId: "123456789012", + accountId: "163662907100", roleName: "DatadogAWSIntegrationRole", }, }; diff --git a/examples/v1/aws-integration/UpdateAWSAccount.ts b/examples/v1/aws-integration/UpdateAWSAccount.ts index f2437ff7863..db340ac383a 100644 --- a/examples/v1/aws-integration/UpdateAWSAccount.ts +++ b/examples/v1/aws-integration/UpdateAWSAccount.ts @@ -9,20 +9,20 @@ const apiInstance = new v1.AWSIntegrationApi(configuration); const params: v1.AWSIntegrationApiUpdateAWSAccountRequest = { body: { - accountId: "123456789012", + accountId: "163662907100", accountSpecificNamespaceRules: { auto_scaling: false, }, - cspmResourceCollectionEnabled: true, + cspmResourceCollectionEnabled: false, excludedRegions: ["us-east-1", "us-west-2"], filterTags: ["$KEY:$VALUE"], hostTags: ["$KEY:$VALUE"], - metricsCollectionEnabled: false, + metricsCollectionEnabled: true, resourceCollectionEnabled: true, - roleName: "datadog-role", + roleName: "DatadogAWSIntegrationRole", }, - accountId: "123456789012", - roleName: "datadog-role", + accountId: "163662907100", + roleName: "DatadogAWSIntegrationRole", }; apiInstance diff --git a/features/support/given.ts b/features/support/given.ts index 3ed417a2eb4..3066c599d2f 100644 --- a/features/support/given.ts +++ b/features/support/given.ts @@ -14,6 +14,7 @@ interface IOperationParameter { name: string; source?: string; value?: string; + origin?: string; } interface IGivenStep { @@ -98,6 +99,13 @@ for (const apiVersion of Versions) { p.source ); } + if (p.origin === "request"){ + for (const key in opts[p.name]){ + if (opts[p.name].hasOwnProperty(key)){ + this.fixtures[key] = opts[p.name][key]; + } + } + } } } diff --git a/features/v1/aws_integration.feature b/features/v1/aws_integration.feature index 6adfe4764f9..b37be660e0e 100644 --- a/features/v1/aws_integration.feature +++ b/features/v1/aws_integration.feature @@ -72,10 +72,11 @@ Feature: AWS Integration When the request is sent Then the response status is 409 Conflict Error - @generated @skip @team:DataDog/cloud-integrations + @team:DataDog/cloud-integrations Scenario: Delete an AWS integration returns "OK" response - Given new "DeleteAWSAccount" request - And body with value {"account_id": "123456789012", "role_name": "DatadogAWSIntegrationRole"} + Given there is a valid "aws_account" in the system + And new "DeleteAWSAccount" request + And body with value {"account_id": "{{ timestamp("now") }}00", "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 200 OK @@ -179,11 +180,12 @@ Feature: AWS Integration When the request is sent Then the response status is 409 Conflict Error - @replay-only @skip-typescript @team:DataDog/cloud-integrations + @team:DataDog/cloud-integrations Scenario: Update an AWS integration returns "OK" response - Given new "UpdateAWSAccount" request - And body with value {"account_id": "123456789012", "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": "datadog-role"} - And request contains "account_id" parameter with value "123456789012" - And request contains "role_name" parameter with value "datadog-role" + 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 request contains "account_id" parameter with value "{{ timestamp("now") }}00" + And request contains "role_name" parameter with value "DatadogAWSIntegrationRole" When the request is sent Then the response status is 200 OK diff --git a/features/v1/given.json b/features/v1/given.json index ea1945985bc..02854bcd670 100644 --- a/features/v1/given.json +++ b/features/v1/given.json @@ -99,6 +99,19 @@ "tag": "Downtimes", "operationId": "CreateDowntime" }, + { + "parameters": [ + { + "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}" + } + ], + "step": "there is a valid \"aws_account\" in the system", + "key": "aws_account", + "tag": "AWS Integration", + "operationId": "CreateAWSAccount" + }, { "parameters": [ {