From c7e3dbc150c28ee4a5b425e40fce6d6b5addd688 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 30 May 2023 14:30:19 +0000 Subject: [PATCH] Regenerate client from commit adf5379f of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 297 ++++++ .../gcp-integration/CreateGCPSTSAccount.java | 38 + .../gcp-integration/DeleteGCPSTSAccount.java | 22 + .../v2/gcp-integration/GetGCPSTSDelegate.java | 24 + .../gcp-integration/ListGCPSTSAccounts.java | 24 + .../gcp-integration/MakeGCPSTSDelegate.java | 24 + .../MakeGCPSTSDelegate_962598975.java | 28 + .../gcp-integration/UpdateGCPSTSAccount.java | 39 + .../api/client/v2/api/GcpIntegrationApi.java | 867 ++++++++++++++++++ .../v2/model/GCPSTSDelegateAccount.java | 142 +++ .../GCPSTSDelegateAccountAttributes.java | 85 ++ .../model/GCPSTSDelegateAccountResponse.java | 82 ++ .../v2/model/GCPSTSDelegateAccountType.java | 95 ++ .../client/v2/model/GCPSTSServiceAccount.java | 170 ++++ .../model/GCPSTSServiceAccountAttributes.java | 176 ++++ .../GCPSTSServiceAccountCreateRequest.java | 83 ++ .../v2/model/GCPSTSServiceAccountData.java | 115 +++ .../model/GCPSTSServiceAccountResponse.java | 82 ++ .../GCPSTSServiceAccountUpdateRequest.java | 83 ++ ...GCPSTSServiceAccountUpdateRequestData.java | 144 +++ .../model/GCPSTSServiceAccountsResponse.java | 95 ++ .../v2/model/GCPServiceAccountMeta.java | 91 ++ .../v2/model/GCPServiceAccountType.java | 94 ++ ...g_GCP_principal_returns_OK_response.freeze | 1 + ...dog_GCP_principal_returns_OK_response.json | 28 + ...with_empty_body_returns_OK_response.freeze | 1 + ...l_with_empty_body_returns_OK_response.json | 32 + ...ervice_accounts_returns_OK_response.freeze | 1 + ..._service_accounts_returns_OK_response.json | 28 + ...elegate_account_returns_OK_response.freeze | 1 + ..._delegate_account_returns_OK_response.json | 28 + .../api/client/v2/api/gcp_integration.feature | 111 +++ .../com/datadog/api/client/v2/api/undo.json | 43 + 34 files changed, 3178 insertions(+), 4 deletions(-) create mode 100644 examples/v2/gcp-integration/CreateGCPSTSAccount.java create mode 100644 examples/v2/gcp-integration/DeleteGCPSTSAccount.java create mode 100644 examples/v2/gcp-integration/GetGCPSTSDelegate.java create mode 100644 examples/v2/gcp-integration/ListGCPSTSAccounts.java create mode 100644 examples/v2/gcp-integration/MakeGCPSTSDelegate.java create mode 100644 examples/v2/gcp-integration/MakeGCPSTSDelegate_962598975.java create mode 100644 examples/v2/gcp-integration/UpdateGCPSTSAccount.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccount.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccount.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountType.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.json create mode 100644 src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature diff --git a/.apigentools-info b/.apigentools-info index 48693e53e66..a5e5fcf77ff 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-05-26 17:55:31.638628", - "spec_repo_commit": "c4844513" + "regenerated": "2023-05-30 14:28:54.949701", + "spec_repo_commit": "adf5379f" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-05-26 17:55:31.651767", - "spec_repo_commit": "c4844513" + "regenerated": "2023-05-30 14:28:54.964144", + "spec_repo_commit": "adf5379f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 477b8484b0d..451b9081000 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -173,6 +173,13 @@ components: required: true schema: type: string + GCPSTSServiceAccountID: + description: Your GCP STS enabled service account's unique ID. + in: path + name: account_id + required: true + schema: + type: string IncidentAttachmentFilterQueryParameter: description: Specifies which types of attachments are included in the response. explode: false @@ -3929,6 +3936,142 @@ components: nullable: true type: array type: object + GCPSTSDelegateAccount: + description: Datadog principal service account info. + properties: + attributes: + $ref: '#/components/schemas/GCPSTSDelegateAccountAttributes' + id: + description: The ID of the delegate service account. + example: ddgci-1a19n28hb1a812221893@datadog-gci-sts-us5-prod.iam.gserviceaccount.com + type: string + type: + $ref: '#/components/schemas/GCPSTSDelegateAccountType' + type: object + GCPSTSDelegateAccountAttributes: + description: Your delegate account attributes. + properties: + delegate_account_email: + description: Your organization's Datadog principal email address. + example: ddgci-1a19n28hb1a812221893@datadog-gci-sts-us5-prod.iam.gserviceaccount.com + type: string + type: object + GCPSTSDelegateAccountResponse: + description: Your delegate service account response data. + properties: + data: + $ref: '#/components/schemas/GCPSTSDelegateAccount' + type: object + GCPSTSDelegateAccountType: + default: gcp_sts_delegate + description: The type of account. + enum: + - gcp_sts_delegate + example: gcp_sts_delegate + type: string + x-enum-varnames: + - GCP_STS_DELEGATE + GCPSTSServiceAccount: + description: Info on your service account. + properties: + attributes: + $ref: '#/components/schemas/GCPSTSServiceAccountAttributes' + id: + description: Your service account's unique ID. + example: d291291f-12c2-22g4-j290-123456678897 + type: string + meta: + $ref: '#/components/schemas/GCPServiceAccountMeta' + type: + $ref: '#/components/schemas/GCPServiceAccountType' + type: object + GCPSTSServiceAccountAttributes: + description: Attributes associated with your service account. + properties: + automute: + description: Silence monitors for expected GCE instance shutdowns. + type: boolean + client_email: + description: Your service account email address. + example: datadog-service-account@test-project.iam.gserviceaccount.com + type: string + host_filters: + description: Your Host Filters. + items: + description: Host Filters + type: string + type: array + is_cspm_enabled: + description: When enabled, Datadog performs configuration checks across + your Google Cloud environment by continuously scanning every resource. + type: boolean + type: object + GCPSTSServiceAccountCreateRequest: + description: Data on your newly generated service account. + properties: + data: + $ref: '#/components/schemas/GCPSTSServiceAccountData' + type: object + GCPSTSServiceAccountData: + description: Additional metadata on your generated service account. + properties: + attributes: + $ref: '#/components/schemas/GCPSTSServiceAccountAttributes' + type: + $ref: '#/components/schemas/GCPServiceAccountType' + type: object + GCPSTSServiceAccountResponse: + description: The account creation response. + properties: + data: + $ref: '#/components/schemas/GCPSTSServiceAccount' + type: object + GCPSTSServiceAccountUpdateRequest: + description: Service account info. + properties: + data: + $ref: '#/components/schemas/GCPSTSServiceAccountUpdateRequestData' + type: object + GCPSTSServiceAccountUpdateRequestData: + description: Data on your service account. + properties: + attributes: + $ref: '#/components/schemas/GCPSTSServiceAccountAttributes' + id: + description: Your service account's unique ID. + example: d291291f-12c2-22g4-j290-123456678897 + type: string + type: + $ref: '#/components/schemas/GCPServiceAccountType' + type: object + GCPSTSServiceAccountsResponse: + description: Object containing all your STS enabled accounts. + properties: + data: + description: Array of GCP STS enabled service accounts. + items: + $ref: '#/components/schemas/GCPSTSServiceAccount' + type: array + type: object + GCPServiceAccountMeta: + description: Additional information related to your service account. + properties: + accessible_projects: + description: The current list of projects accessible from your service account. + items: + description: List of GCP projects. + type: string + type: array + type: object + GCPServiceAccountType: + default: gcp_service_account + description: The type of account. + enum: + - gcp_service_account + example: gcp_service_account + type: string + x-enum-varnames: + - GCP_SERVICE_ACCOUNT GetFindingResponse: description: The expected response schema when getting a finding. properties: @@ -16844,6 +16987,154 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/integration/gcp/accounts: + get: + description: List all GCP STS-enabled service accounts configured in your Datadog + account. + operationId: ListGCPSTSAccounts + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSServiceAccountsResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List all GCP STS-enabled service accounts + tags: + - GCP Integration + post: + description: Create a new entry within Datadog for your STS enabled service + account. + operationId: CreateGCPSTSAccount + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSServiceAccountCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSServiceAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a new entry for your service account + tags: + - GCP Integration + x-codegen-request-body-name: body + /api/v2/integration/gcp/accounts/{account_id}: + delete: + description: Delete an STS enabled GCP account from within Datadog. + operationId: DeleteGCPSTSAccount + parameters: + - $ref: '#/components/parameters/GCPSTSServiceAccountID' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an STS enabled GCP Account + tags: + - GCP Integration + patch: + description: Update an STS enabled service account. + operationId: UpdateGCPSTSAccount + parameters: + - $ref: '#/components/parameters/GCPSTSServiceAccountID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSServiceAccountUpdateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSServiceAccountResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update STS Service Account + tags: + - GCP Integration + x-codegen-request-body-name: body + /api/v2/integration/gcp/sts_delegate: + get: + description: List your Datadog-GCP STS delegate account configured in your Datadog + account. + operationId: GetGCPSTSDelegate + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSDelegateAccountResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List delegate account + tags: + - GCP Integration + x-codegen-request-body-name: body + post: + description: Create a Datadog GCP principal. + operationId: MakeGCPSTSDelegate + requestBody: + content: + application/json: + schema: + example: {} + type: object + description: Create a delegate service account within Datadog. + required: false + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GCPSTSDelegateAccountResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a Datadog GCP principal + tags: + - GCP Integration + x-codegen-request-body-name: body /api/v2/integration/opsgenie/services: get: description: Get a list of all services from the Datadog Opsgenie integration. @@ -24352,6 +24643,12 @@ tags: - description: Configure your Datadog Fastly integration directly through the Datadog API. name: Fastly Integration +- description: 'Configure your Datadog-Google Cloud Platform (GCP) integration directly + + through the Datadog API. Read more about the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google_cloud_platform).' + externalDocs: + url: https://docs.datadoghq.com/integrations/google_cloud_platform + name: GCP Integration - description: 'The IP allowlist API is used to manage the IP addresses that can access the Datadog API and web UI. It does not block diff --git a/examples/v2/gcp-integration/CreateGCPSTSAccount.java b/examples/v2/gcp-integration/CreateGCPSTSAccount.java new file mode 100644 index 00000000000..527fa2c9b89 --- /dev/null +++ b/examples/v2/gcp-integration/CreateGCPSTSAccount.java @@ -0,0 +1,38 @@ +// Create a new entry for your service account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountAttributes; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountCreateRequest; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountData; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse; +import com.datadog.api.client.v2.model.GCPServiceAccountType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + GCPSTSServiceAccountCreateRequest body = + new GCPSTSServiceAccountCreateRequest() + .data( + new GCPSTSServiceAccountData() + .attributes( + new GCPSTSServiceAccountAttributes() + .clientEmail( + "datadog-service-account@test-project.iam.gserviceaccount.com")) + .type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); + + try { + GCPSTSServiceAccountResponse result = apiInstance.createGCPSTSAccount(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#createGCPSTSAccount"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/DeleteGCPSTSAccount.java b/examples/v2/gcp-integration/DeleteGCPSTSAccount.java new file mode 100644 index 00000000000..9865da9e558 --- /dev/null +++ b/examples/v2/gcp-integration/DeleteGCPSTSAccount.java @@ -0,0 +1,22 @@ +// Delete an STS enabled GCP Account returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + try { + apiInstance.deleteGCPSTSAccount("account_id"); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#deleteGCPSTSAccount"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/GetGCPSTSDelegate.java b/examples/v2/gcp-integration/GetGCPSTSDelegate.java new file mode 100644 index 00000000000..6abf0eb09fc --- /dev/null +++ b/examples/v2/gcp-integration/GetGCPSTSDelegate.java @@ -0,0 +1,24 @@ +// List delegate account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.model.GCPSTSDelegateAccountResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + try { + GCPSTSDelegateAccountResponse result = apiInstance.getGCPSTSDelegate(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#getGCPSTSDelegate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/ListGCPSTSAccounts.java b/examples/v2/gcp-integration/ListGCPSTSAccounts.java new file mode 100644 index 00000000000..2c62f194e41 --- /dev/null +++ b/examples/v2/gcp-integration/ListGCPSTSAccounts.java @@ -0,0 +1,24 @@ +// List all GCP STS-enabled service accounts returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + try { + GCPSTSServiceAccountsResponse result = apiInstance.listGCPSTSAccounts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#listGCPSTSAccounts"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/MakeGCPSTSDelegate.java b/examples/v2/gcp-integration/MakeGCPSTSDelegate.java new file mode 100644 index 00000000000..9f6ccd3c542 --- /dev/null +++ b/examples/v2/gcp-integration/MakeGCPSTSDelegate.java @@ -0,0 +1,24 @@ +// Create a Datadog GCP principal returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.model.GCPSTSDelegateAccountResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + try { + GCPSTSDelegateAccountResponse result = apiInstance.makeGCPSTSDelegate(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#makeGCPSTSDelegate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/MakeGCPSTSDelegate_962598975.java b/examples/v2/gcp-integration/MakeGCPSTSDelegate_962598975.java new file mode 100644 index 00000000000..79f37f988f2 --- /dev/null +++ b/examples/v2/gcp-integration/MakeGCPSTSDelegate_962598975.java @@ -0,0 +1,28 @@ +// Create a Datadog GCP principal with empty body returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.api.GcpIntegrationApi.MakeGCPSTSDelegateOptionalParameters; +import com.datadog.api.client.v2.model.GCPSTSDelegateAccountResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + Object body = new Object(); + + try { + GCPSTSDelegateAccountResponse result = + apiInstance.makeGCPSTSDelegate(new MakeGCPSTSDelegateOptionalParameters().body(body)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#makeGCPSTSDelegate"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/gcp-integration/UpdateGCPSTSAccount.java b/examples/v2/gcp-integration/UpdateGCPSTSAccount.java new file mode 100644 index 00000000000..7300f9d9863 --- /dev/null +++ b/examples/v2/gcp-integration/UpdateGCPSTSAccount.java @@ -0,0 +1,39 @@ +// Update STS Service Account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GcpIntegrationApi; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountAttributes; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequest; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequestData; +import com.datadog.api.client.v2.model.GCPServiceAccountType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient); + + 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") + .type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT)); + + try { + GCPSTSServiceAccountResponse result = apiInstance.updateGCPSTSAccount("account_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} 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 new file mode 100644 index 00000000000..f3ad5db2930 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/GcpIntegrationApi.java @@ -0,0 +1,867 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.GCPSTSDelegateAccountResponse; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountCreateRequest; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountResponse; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountUpdateRequest; +import com.datadog.api.client.v2.model.GCPSTSServiceAccountsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GcpIntegrationApi { + private ApiClient apiClient; + + public GcpIntegrationApi() { + this(ApiClient.getDefaultApiClient()); + } + + public GcpIntegrationApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create a new entry for your service account. + * + *

See {@link #createGCPSTSAccountWithHttpInfo}. + * + * @param body (required) + * @return GCPSTSServiceAccountResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSServiceAccountResponse createGCPSTSAccount(GCPSTSServiceAccountCreateRequest body) + throws ApiException { + return createGCPSTSAccountWithHttpInfo(body).getData(); + } + + /** + * Create a new entry for your service account. + * + *

See {@link #createGCPSTSAccountWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<GCPSTSServiceAccountResponse> + */ + public CompletableFuture createGCPSTSAccountAsync( + GCPSTSServiceAccountCreateRequest body) { + return createGCPSTSAccountWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new entry within Datadog for your STS enabled service account. + * + * @param body (required) + * @return ApiResponse<GCPSTSServiceAccountResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 OK -
400 Bad Request -
401 Unauthorized -
403 Not Authorized -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createGCPSTSAccountWithHttpInfo( + GCPSTSServiceAccountCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createGCPSTSAccount"); + } + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.createGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a new entry for your service account. + * + *

See {@link #createGCPSTSAccountWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<GCPSTSServiceAccountResponse>> + */ + public CompletableFuture> + createGCPSTSAccountWithHttpInfoAsync(GCPSTSServiceAccountCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createGCPSTSAccount")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.createGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete an STS enabled GCP Account. + * + *

See {@link #deleteGCPSTSAccountWithHttpInfo}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @throws ApiException if fails to make API call + */ + public void deleteGCPSTSAccount(String accountId) throws ApiException { + deleteGCPSTSAccountWithHttpInfo(accountId); + } + + /** + * Delete an STS enabled GCP Account. + * + *

See {@link #deleteGCPSTSAccountWithHttpInfoAsync}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteGCPSTSAccountAsync(String accountId) { + return deleteGCPSTSAccountWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an STS enabled GCP account from within Datadog. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse deleteGCPSTSAccountWithHttpInfo(String accountId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, "Missing the required parameter 'accountId' when calling deleteGCPSTSAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/gcp/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.deleteGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an STS enabled GCP Account. + * + *

See {@link #deleteGCPSTSAccountWithHttpInfo}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteGCPSTSAccountWithHttpInfoAsync( + String accountId) { + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'accountId' when calling deleteGCPSTSAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/gcp/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.deleteGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * List delegate account. + * + *

See {@link #getGCPSTSDelegateWithHttpInfo}. + * + * @return GCPSTSDelegateAccountResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSDelegateAccountResponse getGCPSTSDelegate() throws ApiException { + return getGCPSTSDelegateWithHttpInfo().getData(); + } + + /** + * List delegate account. + * + *

See {@link #getGCPSTSDelegateWithHttpInfoAsync}. + * + * @return CompletableFuture<GCPSTSDelegateAccountResponse> + */ + public CompletableFuture getGCPSTSDelegateAsync() { + return getGCPSTSDelegateWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List your Datadog-GCP STS delegate account configured in your Datadog account. + * + * @return ApiResponse<GCPSTSDelegateAccountResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse getGCPSTSDelegateWithHttpInfo() + throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/sts_delegate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.getGCPSTSDelegate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List delegate account. + * + *

See {@link #getGCPSTSDelegateWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GCPSTSDelegateAccountResponse>> + */ + public CompletableFuture> + getGCPSTSDelegateWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/sts_delegate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.getGCPSTSDelegate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all GCP STS-enabled service accounts. + * + *

See {@link #listGCPSTSAccountsWithHttpInfo}. + * + * @return GCPSTSServiceAccountsResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSServiceAccountsResponse listGCPSTSAccounts() throws ApiException { + return listGCPSTSAccountsWithHttpInfo().getData(); + } + + /** + * List all GCP STS-enabled service accounts. + * + *

See {@link #listGCPSTSAccountsWithHttpInfoAsync}. + * + * @return CompletableFuture<GCPSTSServiceAccountsResponse> + */ + public CompletableFuture listGCPSTSAccountsAsync() { + return listGCPSTSAccountsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all GCP STS-enabled service accounts configured in your Datadog account. + * + * @return ApiResponse<GCPSTSServiceAccountsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listGCPSTSAccountsWithHttpInfo() + throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.listGCPSTSAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all GCP STS-enabled service accounts. + * + *

See {@link #listGCPSTSAccountsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GCPSTSServiceAccountsResponse>> + */ + public CompletableFuture> + listGCPSTSAccountsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.listGCPSTSAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to makeGCPSTSDelegate. */ + public static class MakeGCPSTSDelegateOptionalParameters { + private Object body; + + /** + * Set body. + * + * @param body Create a delegate service account within Datadog. (optional) + * @return MakeGCPSTSDelegateOptionalParameters + */ + public MakeGCPSTSDelegateOptionalParameters body(Object body) { + this.body = body; + return this; + } + } + + /** + * Create a Datadog GCP principal. + * + *

See {@link #makeGCPSTSDelegateWithHttpInfo}. + * + * @return GCPSTSDelegateAccountResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSDelegateAccountResponse makeGCPSTSDelegate() throws ApiException { + return makeGCPSTSDelegateWithHttpInfo(new MakeGCPSTSDelegateOptionalParameters()).getData(); + } + + /** + * Create a Datadog GCP principal. + * + *

See {@link #makeGCPSTSDelegateWithHttpInfoAsync}. + * + * @return CompletableFuture<GCPSTSDelegateAccountResponse> + */ + public CompletableFuture makeGCPSTSDelegateAsync() { + return makeGCPSTSDelegateWithHttpInfoAsync(new MakeGCPSTSDelegateOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a Datadog GCP principal. + * + *

See {@link #makeGCPSTSDelegateWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return GCPSTSDelegateAccountResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSDelegateAccountResponse makeGCPSTSDelegate( + MakeGCPSTSDelegateOptionalParameters parameters) throws ApiException { + return makeGCPSTSDelegateWithHttpInfo(parameters).getData(); + } + + /** + * Create a Datadog GCP principal. + * + *

See {@link #makeGCPSTSDelegateWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<GCPSTSDelegateAccountResponse> + */ + public CompletableFuture makeGCPSTSDelegateAsync( + MakeGCPSTSDelegateOptionalParameters parameters) { + return makeGCPSTSDelegateWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a Datadog GCP principal. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<GCPSTSDelegateAccountResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse makeGCPSTSDelegateWithHttpInfo( + MakeGCPSTSDelegateOptionalParameters parameters) throws ApiException { + Object localVarPostBody = parameters.body; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/sts_delegate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.makeGCPSTSDelegate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a Datadog GCP principal. + * + *

See {@link #makeGCPSTSDelegateWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<GCPSTSDelegateAccountResponse>> + */ + public CompletableFuture> + makeGCPSTSDelegateWithHttpInfoAsync(MakeGCPSTSDelegateOptionalParameters parameters) { + Object localVarPostBody = parameters.body; + // create path and map variables + String localVarPath = "/api/v2/integration/gcp/sts_delegate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.makeGCPSTSDelegate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update STS Service Account. + * + *

See {@link #updateGCPSTSAccountWithHttpInfo}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @param body (required) + * @return GCPSTSServiceAccountResponse + * @throws ApiException if fails to make API call + */ + public GCPSTSServiceAccountResponse updateGCPSTSAccount( + String accountId, GCPSTSServiceAccountUpdateRequest body) throws ApiException { + return updateGCPSTSAccountWithHttpInfo(accountId, body).getData(); + } + + /** + * Update STS Service Account. + * + *

See {@link #updateGCPSTSAccountWithHttpInfoAsync}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @param body (required) + * @return CompletableFuture<GCPSTSServiceAccountResponse> + */ + public CompletableFuture updateGCPSTSAccountAsync( + String accountId, GCPSTSServiceAccountUpdateRequest body) { + return updateGCPSTSAccountWithHttpInfoAsync(accountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an STS enabled service account. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @param body (required) + * @return ApiResponse<GCPSTSServiceAccountResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 OK -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateGCPSTSAccountWithHttpInfo( + String accountId, GCPSTSServiceAccountUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, "Missing the required parameter 'accountId' when calling updateGCPSTSAccount"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateGCPSTSAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/gcp/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.updateGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update STS Service Account. + * + *

See {@link #updateGCPSTSAccountWithHttpInfo}. + * + * @param accountId Your GCP STS enabled service account's unique ID. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GCPSTSServiceAccountResponse>> + */ + public CompletableFuture> + updateGCPSTSAccountWithHttpInfoAsync( + String accountId, GCPSTSServiceAccountUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'accountId' when calling updateGCPSTSAccount")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateGCPSTSAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/gcp/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GcpIntegrationApi.updateGCPSTSAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccount.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccount.java new file mode 100644 index 00000000000..36dbff2d403 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccount.java @@ -0,0 +1,142 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Datadog principal service account info. */ +@JsonPropertyOrder({ + GCPSTSDelegateAccount.JSON_PROPERTY_ATTRIBUTES, + GCPSTSDelegateAccount.JSON_PROPERTY_ID, + GCPSTSDelegateAccount.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSDelegateAccount { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPSTSDelegateAccountAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPSTSDelegateAccountType type = GCPSTSDelegateAccountType.GCP_STS_DELEGATE; + + public GCPSTSDelegateAccount attributes(GCPSTSDelegateAccountAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Your delegate account attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSDelegateAccountAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPSTSDelegateAccountAttributes attributes) { + this.attributes = attributes; + } + + public GCPSTSDelegateAccount id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the delegate service account. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GCPSTSDelegateAccount type(GCPSTSDelegateAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of account. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSDelegateAccountType getType() { + return type; + } + + public void setType(GCPSTSDelegateAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this GCPSTSDelegateAccount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSDelegateAccount gcpstsDelegateAccount = (GCPSTSDelegateAccount) o; + return Objects.equals(this.attributes, gcpstsDelegateAccount.attributes) + && Objects.equals(this.id, gcpstsDelegateAccount.id) + && Objects.equals(this.type, gcpstsDelegateAccount.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSDelegateAccount {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountAttributes.java new file mode 100644 index 00000000000..17c3b4e69d9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountAttributes.java @@ -0,0 +1,85 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Your delegate account attributes. */ +@JsonPropertyOrder({GCPSTSDelegateAccountAttributes.JSON_PROPERTY_DELEGATE_ACCOUNT_EMAIL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSDelegateAccountAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELEGATE_ACCOUNT_EMAIL = "delegate_account_email"; + private String delegateAccountEmail; + + public GCPSTSDelegateAccountAttributes delegateAccountEmail(String delegateAccountEmail) { + this.delegateAccountEmail = delegateAccountEmail; + return this; + } + + /** + * Your organization's Datadog principal email address. + * + * @return delegateAccountEmail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELEGATE_ACCOUNT_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDelegateAccountEmail() { + return delegateAccountEmail; + } + + public void setDelegateAccountEmail(String delegateAccountEmail) { + this.delegateAccountEmail = delegateAccountEmail; + } + + /** Return true if this GCPSTSDelegateAccountAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSDelegateAccountAttributes gcpstsDelegateAccountAttributes = + (GCPSTSDelegateAccountAttributes) o; + return Objects.equals( + this.delegateAccountEmail, gcpstsDelegateAccountAttributes.delegateAccountEmail); + } + + @Override + public int hashCode() { + return Objects.hash(delegateAccountEmail); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSDelegateAccountAttributes {\n"); + sb.append(" delegateAccountEmail: ") + .append(toIndentedString(delegateAccountEmail)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountResponse.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountResponse.java new file mode 100644 index 00000000000..d6f078a49c6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountResponse.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Your delegate service account response data. */ +@JsonPropertyOrder({GCPSTSDelegateAccountResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSDelegateAccountResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPSTSDelegateAccount data; + + public GCPSTSDelegateAccountResponse data(GCPSTSDelegateAccount data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Datadog principal service account info. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSDelegateAccount getData() { + return data; + } + + public void setData(GCPSTSDelegateAccount data) { + this.data = data; + } + + /** Return true if this GCPSTSDelegateAccountResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSDelegateAccountResponse gcpstsDelegateAccountResponse = (GCPSTSDelegateAccountResponse) o; + return Objects.equals(this.data, gcpstsDelegateAccountResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSDelegateAccountResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountType.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountType.java new file mode 100644 index 00000000000..c5246d71bc2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSDelegateAccountType.java @@ -0,0 +1,95 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** The type of account. */ +@JsonSerialize(using = GCPSTSDelegateAccountType.GCPSTSDelegateAccountTypeSerializer.class) +public class GCPSTSDelegateAccountType { + + public static final GCPSTSDelegateAccountType GCP_STS_DELEGATE = + new GCPSTSDelegateAccountType("gcp_sts_delegate"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_sts_delegate")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + GCPSTSDelegateAccountType(String value) { + this.value = value; + } + + public static class GCPSTSDelegateAccountTypeSerializer + extends StdSerializer { + public GCPSTSDelegateAccountTypeSerializer(Class t) { + super(t); + } + + public GCPSTSDelegateAccountTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPSTSDelegateAccountType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this GCPSTSDelegateAccountType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((GCPSTSDelegateAccountType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static GCPSTSDelegateAccountType fromValue(String value) { + return new GCPSTSDelegateAccountType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccount.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccount.java new file mode 100644 index 00000000000..70bc63b177b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccount.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Info on your service account. */ +@JsonPropertyOrder({ + GCPSTSServiceAccount.JSON_PROPERTY_ATTRIBUTES, + GCPSTSServiceAccount.JSON_PROPERTY_ID, + GCPSTSServiceAccount.JSON_PROPERTY_META, + GCPSTSServiceAccount.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccount { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPSTSServiceAccountAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_META = "meta"; + private GCPServiceAccountMeta meta; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPServiceAccountType type = GCPServiceAccountType.GCP_SERVICE_ACCOUNT; + + public GCPSTSServiceAccount attributes(GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes associated with your service account. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccountAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + } + + public GCPSTSServiceAccount id(String id) { + this.id = id; + return this; + } + + /** + * Your service account's unique ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GCPSTSServiceAccount meta(GCPServiceAccountMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Additional information related to your service account. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPServiceAccountMeta getMeta() { + return meta; + } + + public void setMeta(GCPServiceAccountMeta meta) { + this.meta = meta; + } + + public GCPSTSServiceAccount type(GCPServiceAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of account. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPServiceAccountType getType() { + return type; + } + + public void setType(GCPServiceAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this GCPSTSServiceAccount object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccount gcpstsServiceAccount = (GCPSTSServiceAccount) o; + return Objects.equals(this.attributes, gcpstsServiceAccount.attributes) + && Objects.equals(this.id, gcpstsServiceAccount.id) + && Objects.equals(this.meta, gcpstsServiceAccount.meta) + && Objects.equals(this.type, gcpstsServiceAccount.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, meta, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccount {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java new file mode 100644 index 00000000000..9859e9f1604 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java @@ -0,0 +1,176 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Attributes associated with your service account. */ +@JsonPropertyOrder({ + GCPSTSServiceAccountAttributes.JSON_PROPERTY_AUTOMUTE, + GCPSTSServiceAccountAttributes.JSON_PROPERTY_CLIENT_EMAIL, + GCPSTSServiceAccountAttributes.JSON_PROPERTY_HOST_FILTERS, + GCPSTSServiceAccountAttributes.JSON_PROPERTY_IS_CSPM_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTOMUTE = "automute"; + private Boolean automute; + + public static final String JSON_PROPERTY_CLIENT_EMAIL = "client_email"; + private String clientEmail; + + public static final String JSON_PROPERTY_HOST_FILTERS = "host_filters"; + private List hostFilters = null; + + public static final String JSON_PROPERTY_IS_CSPM_ENABLED = "is_cspm_enabled"; + private Boolean isCspmEnabled; + + public GCPSTSServiceAccountAttributes automute(Boolean automute) { + this.automute = automute; + return this; + } + + /** + * Silence monitors for expected GCE instance shutdowns. + * + * @return automute + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTOMUTE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAutomute() { + return automute; + } + + public void setAutomute(Boolean automute) { + this.automute = automute; + } + + public GCPSTSServiceAccountAttributes clientEmail(String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * Your service account email address. + * + * @return clientEmail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientEmail() { + return clientEmail; + } + + public void setClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + } + + public GCPSTSServiceAccountAttributes hostFilters(List hostFilters) { + this.hostFilters = hostFilters; + return this; + } + + public GCPSTSServiceAccountAttributes addHostFiltersItem(String hostFiltersItem) { + if (this.hostFilters == null) { + this.hostFilters = new ArrayList<>(); + } + this.hostFilters.add(hostFiltersItem); + return this; + } + + /** + * Your Host Filters. + * + * @return hostFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HOST_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getHostFilters() { + return hostFilters; + } + + public void setHostFilters(List hostFilters) { + this.hostFilters = hostFilters; + } + + public GCPSTSServiceAccountAttributes isCspmEnabled(Boolean isCspmEnabled) { + this.isCspmEnabled = isCspmEnabled; + return this; + } + + /** + * When enabled, Datadog performs configuration checks across your Google Cloud environment by + * continuously scanning every resource. + * + * @return isCspmEnabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_CSPM_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsCspmEnabled() { + return isCspmEnabled; + } + + public void setIsCspmEnabled(Boolean isCspmEnabled) { + this.isCspmEnabled = isCspmEnabled; + } + + /** Return true if this GCPSTSServiceAccountAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountAttributes gcpstsServiceAccountAttributes = + (GCPSTSServiceAccountAttributes) o; + return Objects.equals(this.automute, gcpstsServiceAccountAttributes.automute) + && Objects.equals(this.clientEmail, gcpstsServiceAccountAttributes.clientEmail) + && Objects.equals(this.hostFilters, gcpstsServiceAccountAttributes.hostFilters) + && Objects.equals(this.isCspmEnabled, gcpstsServiceAccountAttributes.isCspmEnabled); + } + + @Override + public int hashCode() { + return Objects.hash(automute, clientEmail, hostFilters, isCspmEnabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountAttributes {\n"); + sb.append(" automute: ").append(toIndentedString(automute)).append("\n"); + sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n"); + sb.append(" hostFilters: ").append(toIndentedString(hostFilters)).append("\n"); + sb.append(" isCspmEnabled: ").append(toIndentedString(isCspmEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountCreateRequest.java new file mode 100644 index 00000000000..40d6239e40e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountCreateRequest.java @@ -0,0 +1,83 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Data on your newly generated service account. */ +@JsonPropertyOrder({GCPSTSServiceAccountCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPSTSServiceAccountData data; + + public GCPSTSServiceAccountCreateRequest data(GCPSTSServiceAccountData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Additional metadata on your generated service account. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccountData getData() { + return data; + } + + public void setData(GCPSTSServiceAccountData data) { + this.data = data; + } + + /** Return true if this GCPSTSServiceAccountCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountCreateRequest gcpstsServiceAccountCreateRequest = + (GCPSTSServiceAccountCreateRequest) o; + return Objects.equals(this.data, gcpstsServiceAccountCreateRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountData.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountData.java new file mode 100644 index 00000000000..77f0eb8fb44 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountData.java @@ -0,0 +1,115 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Additional metadata on your generated service account. */ +@JsonPropertyOrder({ + GCPSTSServiceAccountData.JSON_PROPERTY_ATTRIBUTES, + GCPSTSServiceAccountData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPSTSServiceAccountAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPServiceAccountType type = GCPServiceAccountType.GCP_SERVICE_ACCOUNT; + + public GCPSTSServiceAccountData attributes(GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes associated with your service account. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccountAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + } + + public GCPSTSServiceAccountData type(GCPServiceAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of account. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPServiceAccountType getType() { + return type; + } + + public void setType(GCPServiceAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this GCPSTSServiceAccountData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountData gcpstsServiceAccountData = (GCPSTSServiceAccountData) o; + return Objects.equals(this.attributes, gcpstsServiceAccountData.attributes) + && Objects.equals(this.type, gcpstsServiceAccountData.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountResponse.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountResponse.java new file mode 100644 index 00000000000..e97de6e2b90 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountResponse.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** The account creation response. */ +@JsonPropertyOrder({GCPSTSServiceAccountResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPSTSServiceAccount data; + + public GCPSTSServiceAccountResponse data(GCPSTSServiceAccount data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Info on your service account. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccount getData() { + return data; + } + + public void setData(GCPSTSServiceAccount data) { + this.data = data; + } + + /** Return true if this GCPSTSServiceAccountResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountResponse gcpstsServiceAccountResponse = (GCPSTSServiceAccountResponse) o; + return Objects.equals(this.data, gcpstsServiceAccountResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequest.java new file mode 100644 index 00000000000..319e7a40968 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequest.java @@ -0,0 +1,83 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Service account info. */ +@JsonPropertyOrder({GCPSTSServiceAccountUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GCPSTSServiceAccountUpdateRequestData data; + + public GCPSTSServiceAccountUpdateRequest data(GCPSTSServiceAccountUpdateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data on your service account. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccountUpdateRequestData getData() { + return data; + } + + public void setData(GCPSTSServiceAccountUpdateRequestData data) { + this.data = data; + } + + /** Return true if this GCPSTSServiceAccountUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountUpdateRequest gcpstsServiceAccountUpdateRequest = + (GCPSTSServiceAccountUpdateRequest) o; + return Objects.equals(this.data, gcpstsServiceAccountUpdateRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequestData.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequestData.java new file mode 100644 index 00000000000..4cb7e5f1f50 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountUpdateRequestData.java @@ -0,0 +1,144 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Data on your service account. */ +@JsonPropertyOrder({ + GCPSTSServiceAccountUpdateRequestData.JSON_PROPERTY_ATTRIBUTES, + GCPSTSServiceAccountUpdateRequestData.JSON_PROPERTY_ID, + GCPSTSServiceAccountUpdateRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountUpdateRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GCPSTSServiceAccountAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPServiceAccountType type = GCPServiceAccountType.GCP_SERVICE_ACCOUNT; + + public GCPSTSServiceAccountUpdateRequestData attributes( + GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes associated with your service account. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPSTSServiceAccountAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GCPSTSServiceAccountAttributes attributes) { + this.attributes = attributes; + } + + public GCPSTSServiceAccountUpdateRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Your service account's unique ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GCPSTSServiceAccountUpdateRequestData type(GCPServiceAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of account. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPServiceAccountType getType() { + return type; + } + + public void setType(GCPServiceAccountType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this GCPSTSServiceAccountUpdateRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountUpdateRequestData gcpstsServiceAccountUpdateRequestData = + (GCPSTSServiceAccountUpdateRequestData) o; + return Objects.equals(this.attributes, gcpstsServiceAccountUpdateRequestData.attributes) + && Objects.equals(this.id, gcpstsServiceAccountUpdateRequestData.id) + && Objects.equals(this.type, gcpstsServiceAccountUpdateRequestData.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountUpdateRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountsResponse.java new file mode 100644 index 00000000000..bbde962a290 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountsResponse.java @@ -0,0 +1,95 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Object containing all your STS enabled accounts. */ +@JsonPropertyOrder({GCPSTSServiceAccountsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPSTSServiceAccountsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public GCPSTSServiceAccountsResponse data(List data) { + this.data = data; + for (GCPSTSServiceAccount item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GCPSTSServiceAccountsResponse addDataItem(GCPSTSServiceAccount dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of GCP STS enabled service accounts. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** Return true if this GCPSTSServiceAccountsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPSTSServiceAccountsResponse gcpstsServiceAccountsResponse = (GCPSTSServiceAccountsResponse) o; + return Objects.equals(this.data, gcpstsServiceAccountsResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPSTSServiceAccountsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountMeta.java b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountMeta.java new file mode 100644 index 00000000000..d014d70e649 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountMeta.java @@ -0,0 +1,91 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Additional information related to your service account. */ +@JsonPropertyOrder({GCPServiceAccountMeta.JSON_PROPERTY_ACCESSIBLE_PROJECTS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPServiceAccountMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESSIBLE_PROJECTS = "accessible_projects"; + private List accessibleProjects = null; + + public GCPServiceAccountMeta accessibleProjects(List accessibleProjects) { + this.accessibleProjects = accessibleProjects; + return this; + } + + public GCPServiceAccountMeta addAccessibleProjectsItem(String accessibleProjectsItem) { + if (this.accessibleProjects == null) { + this.accessibleProjects = new ArrayList<>(); + } + this.accessibleProjects.add(accessibleProjectsItem); + return this; + } + + /** + * The current list of projects accessible from your service account. + * + * @return accessibleProjects + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCESSIBLE_PROJECTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAccessibleProjects() { + return accessibleProjects; + } + + public void setAccessibleProjects(List accessibleProjects) { + this.accessibleProjects = accessibleProjects; + } + + /** Return true if this GCPServiceAccountMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPServiceAccountMeta gcpServiceAccountMeta = (GCPServiceAccountMeta) o; + return Objects.equals(this.accessibleProjects, gcpServiceAccountMeta.accessibleProjects); + } + + @Override + public int hashCode() { + return Objects.hash(accessibleProjects); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPServiceAccountMeta {\n"); + sb.append(" accessibleProjects: ").append(toIndentedString(accessibleProjects)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountType.java b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountType.java new file mode 100644 index 00000000000..01418fadf77 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPServiceAccountType.java @@ -0,0 +1,94 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** The type of account. */ +@JsonSerialize(using = GCPServiceAccountType.GCPServiceAccountTypeSerializer.class) +public class GCPServiceAccountType { + + public static final GCPServiceAccountType GCP_SERVICE_ACCOUNT = + new GCPServiceAccountType("gcp_service_account"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_service_account")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + GCPServiceAccountType(String value) { + this.value = value; + } + + public static class GCPServiceAccountTypeSerializer extends StdSerializer { + public GCPServiceAccountTypeSerializer(Class t) { + super(t); + } + + public GCPServiceAccountTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPServiceAccountType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this GCPServiceAccountType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((GCPServiceAccountType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static GCPServiceAccountType fromValue(String value) { + return new GCPServiceAccountType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.freeze new file mode 100644 index 00000000000..de4e11086ac --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-05-18T15:02:26.265Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.json new file mode 100644 index 00000000000..f8b9f17d5e4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "POST", + "path": "/api/v2/integration/gcp/sts_delegate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"gcp_sts_delegate\",\"attributes\":{\"delegate_account_email\":\"ddgci-b5ee8760a0ff148b3056@datadog-cloud-ints-staging.iam.gserviceaccount.com\"},\"id\":\"ddgci-b5ee8760a0ff148b3056@datadog-cloud-ints-staging.iam.gserviceaccount.com\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "50dfed7f-66d5-c971-c029-801605985747" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.freeze new file mode 100644 index 00000000000..b105fff4c83 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-05-25T17:14:37.896Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.json new file mode 100644 index 00000000000..e5d0fb2ddcc --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Datadog_GCP_principal_with_empty_body_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/integration/gcp/sts_delegate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"gcp_sts_delegate\",\"attributes\":{\"delegate_account_email\":\"ddgci-b5ee8760a0ff148b3056@datadog-cloud-ints-staging.iam.gserviceaccount.com\"},\"id\":\"ddgci-b5ee8760a0ff148b3056@datadog-cloud-ints-staging.iam.gserviceaccount.com\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "377ed13a-564d-792f-0ccd-c9d6ba77f429" + } +] \ 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 new file mode 100644 index 00000000000..501e5fa0d6b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-05-18T15:03:23.705Z \ 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 new file mode 100644 index 00000000000..ce9c2ed1b2f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_all_GCP_STS_enabled_service_accounts_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/integration/gcp/accounts", + "keepAlive": false, + "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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8fce3338-c2db-c972-fce4-f7d8281a3f46" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.freeze new file mode 100644 index 00000000000..77dbc565156 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-05-23T13:50:44.429Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.json new file mode 100644 index 00000000000..ca3c930e530 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_delegate_account_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/integration/gcp/sts_delegate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"gcp_sts_delegate\",\"attributes\":{\"delegate_account_email\":\"ddgci-d427c1b4a96cca3986b2@datadog-gci-sts-us1-prod.iam.gserviceaccount.com\"},\"id\":\"ddgci-d427c1b4a96cca3986b2@datadog-gci-sts-us1-prod.iam.gserviceaccount.com\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9821866c-32c8-36f0-3cb9-5e541c68f7b6" + } +] \ 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 new file mode 100644 index 00000000000..01d85f94e24 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature @@ -0,0 +1,111 @@ +@endpoint(gcp-integration) @endpoint(gcp-integration-v2) +Feature: GCP Integration + Configure your Datadog-Google Cloud Platform (GCP) integration directly + through the Datadog API. Read more about the [Datadog-Google Cloud + Platform integration](https://docs.datadoghq.com/integrations/google_cloud + _platform). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GCPIntegration" API + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Create a Datadog GCP principal returns "Conflict" response + Given new "MakeGCPSTSDelegate" request + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/gcp-integrations + Scenario: Create a Datadog GCP principal returns "OK" response + Given new "MakeGCPSTSDelegate" request + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "gcp_sts_delegate" + + @team:DataDog/gcp-integrations + Scenario: Create a Datadog GCP principal with empty body returns "OK" response + Given new "MakeGCPSTSDelegate" request + And body with value {} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "gcp_sts_delegate" + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Create a new entry for your service account returns "Bad Request" 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Create a new entry for your service account returns "Conflict" 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"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @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"}} + When the request is sent + Then the response status is 201 OK + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Delete an STS enabled GCP Account returns "Bad Request" response + Given new "DeleteGCPSTSAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Delete an STS enabled GCP Account returns "No Content" response + Given new "DeleteGCPSTSAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/gcp-integrations + Scenario: List all GCP STS-enabled service accounts returns "Not Found" response + Given new "ListGCPSTSAccounts" request + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/gcp-integrations + Scenario: List all GCP STS-enabled service accounts returns "OK" response + Given 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" + + @team:DataDog/gcp-integrations + Scenario: List delegate account returns "OK" response + Given new "GetGCPSTSDelegate" request + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "gcp_sts_delegate" + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Update STS Service Account returns "Bad Request" 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/gcp-integrations + Scenario: Update STS Service Account returns "Not Found" 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"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @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"}} + When the request is sent + Then the response status is 201 OK 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 30378f78d53..6a3bd0e0492 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 @@ -392,6 +392,49 @@ "type": "idempotent" } }, + "ListGCPSTSAccounts": { + "tag": "GCP Integration", + "undo": { + "type": "safe" + } + }, + "CreateGCPSTSAccount": { + "tag": "GCP Integration", + "undo": { + "operationId": "DeleteGCPSTSAccount", + "parameters": [ + { + "name": "account_id", + "source": "id" + } + ], + "type": "unsafe" + } + }, + "DeleteGCPSTSAccount": { + "tag": "GCP Integration", + "undo": { + "type": "idempotent" + } + }, + "UpdateGCPSTSAccount": { + "tag": "GCP Integration", + "undo": { + "type": "idempotent" + } + }, + "GetGCPSTSDelegate": { + "tag": "GCP Integration", + "undo": { + "type": "safe" + } + }, + "MakeGCPSTSDelegate": { + "tag": "GCP Integration", + "undo": { + "type": "idempotent" + } + }, "ListOpsgenieServices": { "tag": "Opsgenie Integration", "undo": {