From 58bc6dda5d24f4b4ca3ee3376aeaebe451c933e1 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 14 Jun 2023 16:12:16 +0000 Subject: [PATCH] Regenerate client from commit 53e4100f of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 2 +- .../v2/gcp-integration/CreateGCPSTSAccount.py | 2 +- .../v2/gcp-integration/UpdateGCPSTSAccount.py | 14 +++-- ...service_account_returns_ok_response.frozen | 1 + ...r_service_account_returns_ok_response.yaml | 38 ++++++++++++ ...ervice_accounts_returns_ok_response.frozen | 2 +- ..._service_accounts_returns_ok_response.yaml | 38 +++++++++++- ...service_account_returns_ok_response.frozen | 1 + ...s_service_account_returns_ok_response.yaml | 58 +++++++++++++++++++ tests/v2/features/gcp_integration.feature | 20 ++++--- tests/v2/features/given.json | 12 ++++ tests/v2/features/undo.json | 2 +- 13 files changed, 177 insertions(+), 21 deletions(-) create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.yaml diff --git a/.apigentools-info b/.apigentools-info index d8363c41ed..a4f6aebe3b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-14 14:30:34.005418", - "spec_repo_commit": "23362011" + "regenerated": "2023-06-14 16:10:55.745274", + "spec_repo_commit": "53e4100f" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-14 14:30:34.017315", - "spec_repo_commit": "23362011" + "regenerated": "2023-06-14 16:10:55.765259", + "spec_repo_commit": "53e4100f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 231cd373de..034fe57c31 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17988,7 +17988,7 @@ paths: $ref: '#/components/schemas/GCPSTSServiceAccountCreateRequest' required: true responses: - '201': + '200': content: application/json: schema: diff --git a/examples/v2/gcp-integration/CreateGCPSTSAccount.py b/examples/v2/gcp-integration/CreateGCPSTSAccount.py index c7213e7308..2f0aa3ea93 100644 --- a/examples/v2/gcp-integration/CreateGCPSTSAccount.py +++ b/examples/v2/gcp-integration/CreateGCPSTSAccount.py @@ -12,7 +12,7 @@ body = GCPSTSServiceAccountCreateRequest( data=GCPSTSServiceAccountData( attributes=GCPSTSServiceAccountAttributes( - client_email="datadog-service-account@test-project.iam.gserviceaccount.com", + client_email="252bf553ef04b351@test-project.iam.gserviceaccount.com", host_filters=[], ), type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT, diff --git a/examples/v2/gcp-integration/UpdateGCPSTSAccount.py b/examples/v2/gcp-integration/UpdateGCPSTSAccount.py index 0eba0e6c10..f31ba90ea6 100644 --- a/examples/v2/gcp-integration/UpdateGCPSTSAccount.py +++ b/examples/v2/gcp-integration/UpdateGCPSTSAccount.py @@ -2,6 +2,7 @@ Update STS Service Account returns "OK" response """ +from os import environ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType @@ -9,13 +10,18 @@ from datadog_api_client.v2.model.gcpsts_service_account_update_request import GCPSTSServiceAccountUpdateRequest from datadog_api_client.v2.model.gcpsts_service_account_update_request_data import GCPSTSServiceAccountUpdateRequestData +# there is a valid "gcp_sts_account" in the system +GCP_STS_ACCOUNT_DATA_ID = environ["GCP_STS_ACCOUNT_DATA_ID"] + body = GCPSTSServiceAccountUpdateRequest( data=GCPSTSServiceAccountUpdateRequestData( attributes=GCPSTSServiceAccountAttributes( - client_email="datadog-service-account@test-project.iam.gserviceaccount.com", - host_filters=[], + client_email="252bf553ef04b351@example.com", + host_filters=[ + "foo:bar", + ], ), - id="d291291f-12c2-22g4-j290-123456678897", + id=GCP_STS_ACCOUNT_DATA_ID, type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT, ), ) @@ -23,6 +29,6 @@ configuration = Configuration() with ApiClient(configuration) as api_client: api_instance = GCPIntegrationApi(api_client) - response = api_instance.update_gcpsts_account(account_id="account_id", body=body) + response = api_instance.update_gcpsts_account(account_id=GCP_STS_ACCOUNT_DATA_ID, body=body) print(response) diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.frozen new file mode 100644 index 0000000000..9ed49a65ea --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-14T15:44:49.306Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.yaml new file mode 100644 index 0000000000..6cb46c1479 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_new_entry_for_your_service_account_returns_ok_response.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"data":{"attributes":{"client_email":"5a4e63ef9fe94949@test-project.iam.gserviceaccount.com","host_filters":[]},"type":"gcp_service_account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts + response: + body: + string: '{"data":{"type":"gcp_service_account","attributes":{"automute":false,"client_email":"5a4e63ef9fe94949@test-project.iam.gserviceaccount.com","host_filters":[],"is_cspm_enabled":false},"id":"c86125c9-ee6d-46ba-997a-23006cfd1575"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/c86125c9-ee6d-46ba-997a-23006cfd1575 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.frozen index 501e5fa0d6..3ece5d562b 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.frozen @@ -1 +1 @@ -2023-05-18T15:03:23.705Z \ No newline at end of file +2023-06-14T15:52:33.117Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.yaml index d4f75df945..d087dbfc63 100644 --- a/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_list_all_gcp_stsenabled_service_accounts_returns_ok_response.yaml @@ -1,4 +1,24 @@ interactions: +- request: + body: '{"data":{"attributes":{"client_email":"64786de2b265b150@example.com","host_filters":[]},"type":"gcp_service_account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts + response: + body: + string: '{"data":{"type":"gcp_service_account","attributes":{"client_email":"64786de2b265b150@example.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"00fecf2b-ccf5-4b7f-954c-845173d99179"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK - request: body: null headers: @@ -8,7 +28,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts response: body: - string: '{"data":[{"type":"gcp_service_account","attributes":{"client_email":"mitchdoingtests@lookatthismitchtest.edu","host_filters":["lots","of","filters"],"automute":true,"is_cspm_enabled":true},"id":"4287ec45-bd6b-40d5-b378-de5b3c569155","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"d4738a71-7f23-4af4-a5bf-ad6143b3a5f0","meta":{"accessible_projects":["datadog-staging"]}},{"type":"gcp_service_account","attributes":{"client_email":"joshua-delete-me-terraform-testing-2","host_filters":[],"automute":true,"is_cspm_enabled":true},"id":"f96f39ea-77b0-4886-a46d-2612e5290664","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"c5a7ebfd-c4fd-4542-86f0-9eafc413589e","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-7@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"0828a7c8-d9c0-4d62-bd8e-f05b71ac3f6f","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-8@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"9a505da5-e01e-4f8a-963f-f8d8302f7cd6","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"testing_v2_endpoint_josh_2","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"1fee30d3-2432-4145-9e1a-9ded9a311d2a","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"joshuatesting","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"6a274bbb-fd4e-4864-9afc-36d19a7d7fb5","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"josh.testing@hi.bye.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"3e4a32a5-158a-4441-9040-bf2fdcb7b655","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"reference-tables@datadog-sandbox.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"3d723d45-04ee-46f5-a699-c35a39c4b5a3","meta":{"accessible_projects":["datadog-sandbox"]}},{"type":"gcp_service_account","attributes":{"client_email":"alejandro-test-gcp@datadog-sandbox.iam.gserviceaccount.com","host_filters":["test:true"],"automute":false,"is_cspm_enabled":true},"id":"17a82d20-1a7f-47b8-8342-7b8f42c1ea89","meta":{"accessible_projects":["datadog-sandbox"]}},{"type":"gcp_service_account","attributes":{"client_email":"ricky-staging-test@datadog-sandbox.iam.gserviceaccount.com","host_filters":["potato:potahto"],"automute":false,"is_cspm_enabled":true},"id":"950b23da-adb7-4625-825d-20ec6118803a","meta":{"accessible_projects":["datadog-sandbox"]}},{"type":"gcp_service_account","attributes":{"client_email":"mitch-hierarchy-test-account@datadog-gcp-ints-test-b.iam.gserviceaccount.com","host_filters":[],"automute":true,"is_cspm_enabled":true},"id":"b7bd7831-26c0-426b-a72f-797fc2a35514","meta":{"accessible_projects":["datadog-gcp-ints-test-b"]}},{"type":"gcp_service_account","attributes":{"client_email":"staging-crawl-account@datadog-gcp-ints-test-c.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"c71fc786-2ee3-4643-9b2b-753f0c59e04e","meta":{"accessible_projects":["datadog-gcp-ints-test-c"]}},{"type":"gcp_service_account","attributes":{"client_email":"staging-crawl@datadog-eventarc-dev.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"fe6926ed-3ec8-477a-993d-7b960f4c6da4","meta":{"accessible_projects":["datadog-eventarc-dev"]}},{"type":"gcp_service_account","attributes":{"client_email":"joshuahuietestingaccount@datadog-sandbox.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"b85bb514-e997-4b50-88b5-d3c38a44d84d","meta":{"accessible_projects":["datadog-sandbox"]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-2@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"064f8cd5-2545-46d2-a21d-dad13b637d24","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-6@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"e45e015c-13d7-4b03-bae5-a79bc7c55706","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-9@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"7e638eed-f4b4-4b2b-a854-5a50d6b25325","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"josh-testing-v2","host_filters":[],"automute":true,"is_cspm_enabled":false},"id":"173a52cb-4218-42ef-b977-08ffd7c49d88","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-13@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"6df000a2-515e-4541-845d-54dd475a6b4c","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-14@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"cf0f3638-bb5d-4d05-81cd-1c8c0d038ffb","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-15@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"cd896a52-f6c2-4c89-a060-fba960e6d847","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"graytest@datadog-gcp-ints-test-b.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"ae5a0b9d-1ddf-4a87-b9f2-562f7fde8364","meta":{"accessible_projects":["datadog-gcp-ints-test-b","datadog-gcp-ints-test-c"]}},{"type":"gcp_service_account","attributes":{"client_email":"56425@test.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"47f9fa86-0854-441d-b2b4-1e7e0c721de3","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"staging-crawl-account@cspm-terraform.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"d3a64dfc-60cb-4765-9d8d-c5cba145be71","meta":{"accessible_projects":["cspm-terraform"]}},{"type":"gcp_service_account","attributes":{"client_email":"rachel-test@test.com","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"dbc365c2-108b-45ec-8b32-da9c817ef116","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"mitchTestingANotRealEmail@notMitchsEmail.com","host_filters":["brand","new"],"automute":false,"is_cspm_enabled":false},"id":"fac2c99e-7ba8-4a13-9558-003a13d019da","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"rachel-test-2@test.com","host_filters":["k:v"],"automute":false,"is_cspm_enabled":false},"id":"d8e508ec-546f-407a-b16f-08f525a0a8d8","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-testing@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"7b325857-bfb5-477f-a1dd-84386590b76d","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"testing_v2_endpoint_josh_3","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"2056ea74-f0b1-42f0-91d0-7e3bf73224c7","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"joshua-delete-me-terraform-testing-3","host_filters":[],"automute":false,"is_cspm_enabled":true},"id":"c590766f-fef1-46e9-9b25-a84d27ab1882","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-3@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"68140f7e-8f70-4a67-a3b9-88f0c2594a31","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-4@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"a80dd4b7-beed-4152-a13a-e5b4e5ce225f","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-5@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"18009dfa-0dce-4e8b-a16f-4156c0a5ceae","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-10@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"9ce798c8-9703-4e72-ad86-00f85ededd4c","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-11@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"91e006f6-38bf-46aa-93d4-09987cb8cf71","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"audrey-yuan@datadog-cloud-ints-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"8724c8b2-f186-4471-8be1-44ccbd33d3b0","meta":{"accessible_projects":["datadog-cloud-ints-staging"]}},{"type":"gcp_service_account","attributes":{"client_email":"sri-may8-qa@datadog-sandbox.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"d88004c8-221b-4d28-922f-9a124f8b508a","meta":{"accessible_projects":["datadog-sandbox"]}},{"type":"gcp_service_account","attributes":{"client_email":"dd-integration-test-12@datadog-staging.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"a0c294d2-f57b-4cf7-8944-8739b1566f8e","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"testing_v2_endpoint_josh","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"9e690d47-d975-4c40-9900-6d5eae6dd3d6","meta":{"accessible_projects":[]}},{"type":"gcp_service_account","attributes":{"client_email":"sri-beta-gcp-service@datadog-sandbox.iam.gserviceaccount.com","host_filters":[],"automute":false,"is_cspm_enabled":false},"id":"b46c7744-b4ad-4b3b-b521-0114960b935b","meta":{"accessible_projects":["datadog-sandbox"]}}]} + string: '{"data":[{"type":"gcp_service_account","attributes":{"client_email":"datadog-service-account@test-project.iam.gserviceaccount.com","automute":false,"is_cspm_enabled":false,"host_filters":[]},"meta":{"accessible_projects":[]},"id":"3acadf04-13a2-4422-995b-1b8780dd23e6"},{"type":"gcp_service_account","attributes":{"client_email":"5347bd1ea052f252@test-project.iam.gserviceaccount.com","automute":false,"is_cspm_enabled":false,"host_filters":[]},"meta":{"accessible_projects":[]},"id":"bfef2d23-0d85-4735-850a-c8f77407bcda"},{"type":"gcp_service_account","attributes":{"client_email":"64786de2b265b150@example.com","automute":false,"is_cspm_enabled":false,"host_filters":[]},"meta":{"accessible_projects":[]},"id":"00fecf2b-ccf5-4b7f-954c-845173d99179"}]} ' headers: @@ -17,4 +37,20 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/00fecf2b-ccf5-4b7f-954c-845173d99179 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.frozen new file mode 100644 index 0000000000..2dcbdf40ba --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-14T16:04:56.302Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.yaml new file mode 100644 index 0000000000..3e6aacbc73 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_sts_service_account_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"data":{"attributes":{"client_email":"876f595d133dac09@example.com","host_filters":[]},"type":"gcp_service_account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts + response: + body: + string: '{"data":{"type":"gcp_service_account","attributes":{"is_cspm_enabled":false,"host_filters":[],"automute":false,"client_email":"876f595d133dac09@example.com"},"id":"fa9bd370-fe91-498b-8d02-a25baecc5a60"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"client_email":"876f595d133dac09@example.com","host_filters":["foo:bar"]},"id":"fa9bd370-fe91-498b-8d02-a25baecc5a60","type":"gcp_service_account"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/fa9bd370-fe91-498b-8d02-a25baecc5a60 + response: + body: + string: '{"data":{"type":"gcp_service_account","attributes":{"automute":false,"client_email":"876f595d133dac09@example.com","host_filters":["foo:bar"],"is_cspm_enabled":false},"id":"fa9bd370-fe91-498b-8d02-a25baecc5a60"}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/fa9bd370-fe91-498b-8d02-a25baecc5a60 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/gcp_integration.feature b/tests/v2/features/gcp_integration.feature index 01d85f94e2..c1799d0eb7 100644 --- a/tests/v2/features/gcp_integration.feature +++ b/tests/v2/features/gcp_integration.feature @@ -45,12 +45,14 @@ Feature: GCP Integration When the request is sent Then the response status is 409 Conflict - @generated @skip @team:DataDog/gcp-integrations + @team:DataDog/gcp-integrations Scenario: Create a new entry for your service account returns "OK" response Given new "CreateGCPSTSAccount" request - And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}} + And body with value {"data": {"attributes": {"client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}} When the request is sent - Then the response status is 201 OK + Then the response status is 200 OK + And the response "data.type" is equal to "gcp_service_account" + And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com" @generated @skip @team:DataDog/gcp-integrations Scenario: Delete an STS enabled GCP Account returns "Bad Request" response @@ -74,7 +76,8 @@ Feature: GCP Integration @team:DataDog/gcp-integrations Scenario: List all GCP STS-enabled service accounts returns "OK" response - Given new "ListGCPSTSAccounts" request + Given there is a valid "gcp_sts_account" in the system + And new "ListGCPSTSAccounts" request When the request is sent Then the response status is 200 OK And the response "data" has item with field "type" with value "gcp_service_account" @@ -102,10 +105,11 @@ Feature: GCP Integration When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/gcp-integrations + @team:DataDog/gcp-integrations Scenario: Update STS Service Account returns "OK" response - Given new "UpdateGCPSTSAccount" request - And request contains "account_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": []}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} + Given there is a valid "gcp_sts_account" in the system + And new "UpdateGCPSTSAccount" request + And request contains "account_id" parameter from "gcp_sts_account.data.id" + And body with value {"data": {"attributes": {"client_email": "{{ unique_hash }}@example.com", "host_filters": ["foo:bar"]}, "id": "{{ gcp_sts_account.data.id }}", "type": "gcp_service_account"}} When the request is sent Then the response status is 201 OK diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 15db40f70c..b876dde97d 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -139,6 +139,18 @@ "tag": "Incidents", "operationId": "CreateIncidentTodo" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"client_email\": \"{{ unique_hash }}@example.com\",\n \"host_filters\": []\n },\n \"type\": \"gcp_service_account\"\n }\n}" + } + ], + "step": "there is a valid \"gcp_sts_account\" in the system", + "key": "gcp_sts_account", + "tag": "GCP Integration", + "operationId": "CreateGCPSTSAccount" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 2905a02059..9181b393ac 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -411,7 +411,7 @@ "parameters": [ { "name": "account_id", - "source": "id" + "source": "data.id" } ], "type": "unsafe"