diff --git a/.apigentools-info b/.apigentools-info index 35b2248e460..1edbb8b7aff 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-15 13:05:00.164832", - "spec_repo_commit": "174763df" + "regenerated": "2023-06-15 13:52:07.953319", + "spec_repo_commit": "cd68c9b8" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-15 13:05:00.177047", - "spec_repo_commit": "174763df" + "regenerated": "2023-06-15 13:52:07.968139", + "spec_repo_commit": "cd68c9b8" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 231cd373de8..034fe57c313 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.java b/examples/v2/gcp-integration/CreateGCPSTSAccount.java index 527fa2c9b89..2d963a8c266 100644 --- a/examples/v2/gcp-integration/CreateGCPSTSAccount.java +++ b/examples/v2/gcp-integration/CreateGCPSTSAccount.java @@ -20,8 +20,7 @@ public static void main(String[] args) { new GCPSTSServiceAccountData() .attributes( new GCPSTSServiceAccountAttributes() - .clientEmail( - "datadog-service-account@test-project.iam.gserviceaccount.com")) + .clientEmail("252bf553ef04b351@test-project.iam.gserviceaccount.com")) .type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); try { diff --git a/examples/v2/gcp-integration/UpdateGCPSTSAccount.java b/examples/v2/gcp-integration/UpdateGCPSTSAccount.java index 7300f9d9863..b7bd2b7f5a8 100644 --- a/examples/v2/gcp-integration/UpdateGCPSTSAccount.java +++ b/examples/v2/gcp-integration/UpdateGCPSTSAccount.java @@ -8,25 +8,30 @@ import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequest; import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequestData; import com.datadog.api.client.v2.model.GCPServiceAccountType; +import java.util.Collections; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + // there is a valid "gcp_sts_account" in the system + String GCP_STS_ACCOUNT_DATA_ID = System.getenv("GCP_STS_ACCOUNT_DATA_ID"); + GCPSTSServiceAccountUpdateRequest body = new GCPSTSServiceAccountUpdateRequest() .data( new GCPSTSServiceAccountUpdateRequestData() .attributes( new GCPSTSServiceAccountAttributes() - .clientEmail( - "datadog-service-account@test-project.iam.gserviceaccount.com")) - .id("d291291f-12c2-22g4-j290-123456678897") + .clientEmail("252bf553ef04b351@example.com") + .hostFilters(Collections.singletonList("foo:bar"))) + .id(GCP_STS_ACCOUNT_DATA_ID) .type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); try { - GCPSTSServiceAccountResponse result = apiInstance.updateGCPSTSAccount("account_id", body); + GCPSTSServiceAccountResponse result = + apiInstance.updateGCPSTSAccount(GCP_STS_ACCOUNT_DATA_ID, body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount"); diff --git a/src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java b/src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java index f3ad5db2930..518868171ca 100644 --- a/src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java @@ -88,7 +88,7 @@ public CompletableFuture createGCPSTSAccountAsync( * * * - * + * * * * diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.freeze new file mode 100644 index 00000000000..9ed49a65ea6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-06-14T15:44:49.306Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.json new file mode 100644 index 00000000000..585ce1ca760 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_new_entry_for_your_service_account_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"client_email\":\"5a4e63ef9fe94949@test-project.iam.gserviceaccount.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/integration/gcp/accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "45c047d4-5f03-9544-e8c9-31d0d2d72f87" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/integration/gcp/accounts/c86125c9-ee6d-46ba-997a-23006cfd1575", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f0b7b4c8-6a6d-c33c-b630-eaf2b67b1569" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze index 501e5fa0d6b..3ece5d562b3 100644 --- a/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze @@ -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/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json index ce9c2ed1b2f..fa42588419e 100644 --- a/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json @@ -1,4 +1,34 @@ [ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"client_email\":\"64786de2b265b150@example.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/integration/gcp/accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "10386b7f-2533-b647-b9f3-f1a30e6c39a6" + }, { "httpRequest": { "headers": {}, @@ -8,7 +38,7 @@ "secure": true }, "httpResponse": { - "body": "{\"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\"]}}]}\n", + "body": "{\"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\"}]}\n", "headers": { "Content-Type": [ "application/json" @@ -24,5 +54,30 @@ "unlimited": true }, "id": "8fce3338-c2db-c972-fce4-f7d8281a3f46" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/integration/gcp/accounts/00fecf2b-ccf5-4b7f-954c-845173d99179", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f832cb23-1509-e9a0-437f-4f04894f6aa5" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.freeze new file mode 100644 index 00000000000..2dcbdf40ba1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-06-14T16:04:56.302Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.json new file mode 100644 index 00000000000..6074592e6cf --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_STS_Service_Account_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"client_email\":\"876f595d133dac09@example.com\",\"host_filters\":[]},\"type\":\"gcp_service_account\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/integration/gcp/accounts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "edf64f41-2ed3-4016-f3f1-6170b07610f5" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"client_email\":\"876f595d133dac09@example.com\",\"host_filters\":[\"foo:bar\"]},\"id\":\"fa9bd370-fe91-498b-8d02-a25baecc5a60\",\"type\":\"gcp_service_account\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/integration/gcp/accounts/fa9bd370-fe91-498b-8d02-a25baecc5a60", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0901d4b5-81ea-817b-a05c-3c29f6f38677" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/integration/gcp/accounts/fa9bd370-fe91-498b-8d02-a25baecc5a60", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ae59fc4d-ca79-0b1e-48b1-9505ec3f3cab" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature b/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature index 01d85f94e24..c1799d0eb7a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 15db40f70c2..b876dde97dd 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 2905a02059a..9181b393ac8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -411,7 +411,7 @@ "parameters": [ { "name": "account_id", - "source": "id" + "source": "data.id" } ], "type": "unsafe"
Response details
Status Code Description Response Headers
201 OK -
200 OK -
400 Bad Request -
401 Unauthorized -
403 Not Authorized -