Skip to content

Commit ede190a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Enable delete and update aws tests (#1779)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 0296686 commit ede190a

9 files changed

+143
-23
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-12-04 15:37:43.895117",
8-
"spec_repo_commit": "e66bf244"
7+
"regenerated": "2023-12-04 18:32:11.743247",
8+
"spec_repo_commit": "07df9ec5"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-12-04 15:37:43.915222",
13-
"spec_repo_commit": "e66bf244"
12+
"regenerated": "2023-12-04 18:32:11.850605",
13+
"spec_repo_commit": "07df9ec5"
1414
}
1515
}
1616
}

examples/v1/aws-integration/DeleteAWSAccount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datadog_api_client.v1.model.aws_account_delete_request import AWSAccountDeleteRequest
88

99
body = AWSAccountDeleteRequest(
10-
account_id="123456789012",
10+
account_id="163662907100",
1111
role_name="DatadogAWSIntegrationRole",
1212
)
1313

examples/v1/aws-integration/UpdateAWSAccount.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from datadog_api_client.v1.model.aws_account import AWSAccount
88

99
body = AWSAccount(
10-
account_id="123456789012",
10+
account_id="163662907100",
1111
account_specific_namespace_rules=dict(
1212
auto_scaling=False,
1313
),
14-
cspm_resource_collection_enabled=True,
14+
cspm_resource_collection_enabled=False,
1515
excluded_regions=[
1616
"us-east-1",
1717
"us-west-2",
@@ -22,14 +22,16 @@
2222
host_tags=[
2323
"$KEY:$VALUE",
2424
],
25-
metrics_collection_enabled=False,
25+
metrics_collection_enabled=True,
2626
resource_collection_enabled=True,
27-
role_name="datadog-role",
27+
role_name="DatadogAWSIntegrationRole",
2828
)
2929

3030
configuration = Configuration()
3131
with ApiClient(configuration) as api_client:
3232
api_instance = AWSIntegrationApi(api_client)
33-
response = api_instance.update_aws_account(account_id="123456789012", role_name="datadog-role", body=body)
33+
response = api_instance.update_aws_account(
34+
account_id="163662907100", role_name="DatadogAWSIntegrationRole", body=body
35+
)
3436

3537
print(response)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-21T19:25:15.118Z
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
interactions:
2+
- request:
3+
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"}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v1/integration/aws
11+
response:
12+
body:
13+
string: '{"external_id":"77c77ead62584b0fa1bb6a9fe7d2fa28"}
14+
15+
'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
22+
- request:
23+
body: '{"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"}'
24+
headers:
25+
accept:
26+
- application/json
27+
content-type:
28+
- application/json
29+
method: DELETE
30+
uri: https://api.datadoghq.com/api/v1/integration/aws
31+
response:
32+
body:
33+
string: '{}
34+
35+
'
36+
headers:
37+
content-type:
38+
- application/json
39+
status:
40+
code: 200
41+
message: OK
42+
- request:
43+
body: '{"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"}'
44+
headers:
45+
accept:
46+
- application/json
47+
content-type:
48+
- application/json
49+
method: DELETE
50+
uri: https://api.datadoghq.com/api/v1/integration/aws
51+
response:
52+
body:
53+
string: '{"errors":["AWS account 170059471500 does not exist in integration"]}'
54+
headers:
55+
content-type:
56+
- application/json
57+
status:
58+
code: 400
59+
message: Bad Request
60+
version: 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-05-17T15:38:07.190Z
1+
2023-11-23T18:16:16.323Z

tests/v1/cassettes/test_scenarios/test_update_an_aws_integration_returns_ok_response.yaml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,61 @@
11
interactions:
22
- request:
3-
body: '{"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"}'
3+
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"}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v1/integration/aws
11+
response:
12+
body:
13+
string: '{"external_id":"c7298c166e774bf1bd1bc0419e68f1a0"}
14+
15+
'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
22+
- request:
23+
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"}'
424
headers:
525
accept:
626
- application/json
727
content-type:
828
- application/json
929
method: PUT
10-
uri: https://api.datadoghq.com/api/v1/integration/aws?account_id=123456789012&role_name=datadog-role
30+
uri: https://api.datadoghq.com/api/v1/integration/aws?account_id=170076337600&role_name=DatadogAWSIntegrationRole
1131
response:
1232
body:
13-
string: '{}'
33+
string: '{}
34+
35+
'
1436
headers:
1537
content-type:
16-
- application/json;charset=utf-8
38+
- application/json
39+
status:
40+
code: 200
41+
message: OK
42+
- request:
43+
body: '{"account_id":"170076337600","role_name":"DatadogAWSIntegrationRole"}'
44+
headers:
45+
accept:
46+
- application/json
47+
content-type:
48+
- application/json
49+
method: DELETE
50+
uri: https://api.datadoghq.com/api/v1/integration/aws
51+
response:
52+
body:
53+
string: '{}
54+
55+
'
56+
headers:
57+
content-type:
58+
- application/json
1759
status:
1860
code: 200
1961
message: OK

tests/v1/features/aws_integration.feature

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ Feature: AWS Integration
7272
When the request is sent
7373
Then the response status is 409 Conflict Error
7474

75-
@generated @skip @team:DataDog/cloud-integrations
75+
@team:DataDog/cloud-integrations
7676
Scenario: Delete an AWS integration returns "OK" response
77-
Given new "DeleteAWSAccount" request
78-
And body with value {"account_id": "123456789012", "role_name": "DatadogAWSIntegrationRole"}
77+
Given there is a valid "aws_account" in the system
78+
And new "DeleteAWSAccount" request
79+
And body with value {"account_id": "{{ timestamp("now") }}00", "role_name": "DatadogAWSIntegrationRole"}
7980
When the request is sent
8081
Then the response status is 200 OK
8182

@@ -179,11 +180,12 @@ Feature: AWS Integration
179180
When the request is sent
180181
Then the response status is 409 Conflict Error
181182

182-
@replay-only @skip-typescript @team:DataDog/cloud-integrations
183+
@team:DataDog/cloud-integrations
183184
Scenario: Update an AWS integration returns "OK" response
184-
Given new "UpdateAWSAccount" request
185-
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"}
186-
And request contains "account_id" parameter with value "123456789012"
187-
And request contains "role_name" parameter with value "datadog-role"
185+
Given there is a valid "aws_account" in the system
186+
And new "UpdateAWSAccount" request
187+
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"}
188+
And request contains "account_id" parameter with value "{{ timestamp("now") }}00"
189+
And request contains "role_name" parameter with value "DatadogAWSIntegrationRole"
188190
When the request is sent
189191
Then the response status is 200 OK

tests/v1/features/given.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@
9999
"tag": "Downtimes",
100100
"operationId": "CreateDowntime"
101101
},
102+
{
103+
"parameters": [
104+
{
105+
"name": "body",
106+
"origin": "request",
107+
"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}"
108+
}
109+
],
110+
"step": "there is a valid \"aws_account\" in the system",
111+
"key": "aws_account",
112+
"tag": "AWS Integration",
113+
"operationId": "CreateAWSAccount"
114+
},
102115
{
103116
"parameters": [
104117
{

0 commit comments

Comments
 (0)