From d992abcde144cf5fc17bb86c9bacbcffc22660a5 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 16 Feb 2024 18:03:25 +0000 Subject: [PATCH] Regenerate client from commit dc02d0d0 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 12 +++ .generator/schemas/v2/openapi.yaml | 12 +++ ...GCP-integration-returns-OK-response.frozen | 2 +- ...-a-GCP-integration-returns-OK-response.yml | 8 +- ...evision-filters-returns-OK-response.frozen | 1 + ...n-revision-filters-returns-OK-response.yml | 74 +++++++++++++++++++ ...filters-enabled-returns-OK-response.frozen | 1 + ...on-filters-enabled-returns-OK-response.yml | 44 +++++++++++ ...nse-with-cloud-run-revision-filters.frozen | 1 + ...sponse-with-cloud-run-revision-filters.yml | 68 +++++++++++++++++ .../gcp-integration/CreateGCPIntegration.rb | 3 + .../UpdateGCPIntegration_3544259255.rb | 25 +++++++ .../CreateGCPSTSAccount_194782945.rb | 18 +++++ .../UpdateGCPSTSAccount_2241994060.rb | 21 ++++++ features/v1/gcp_integration.feature | 16 +++- features/v2/gcp_integration.feature | 27 ++++++- .../v1/models/gcp_account.rb | 15 +++- .../gcpsts_service_account_attributes.rb | 15 +++- 19 files changed, 352 insertions(+), 19 deletions(-) create mode 100644 cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.frozen create mode 100644 cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.yml create mode 100644 cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.frozen create mode 100644 cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.yml create mode 100644 cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.frozen create mode 100644 cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.yml create mode 100644 examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.rb create mode 100644 examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.rb create mode 100644 examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.rb diff --git a/.apigentools-info b/.apigentools-info index a7194614babd..b7a95bb6b4ad 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-02-15 17:39:50.157283", - "spec_repo_commit": "45fd84e5" + "regenerated": "2024-02-16 18:02:54.553421", + "spec_repo_commit": "dc02d0d0" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-02-15 17:39:50.172445", - "spec_repo_commit": "45fd84e5" + "regenerated": "2024-02-16 18:02:54.571669", + "spec_repo_commit": "dc02d0d0" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index c887fc9ec04f..89e57a83cb63 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -3207,6 +3207,18 @@ components: key.' example: https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL type: string + cloud_run_revision_filters: + description: 'Limit the Cloud Run revisions that are pulled into Datadog + by using tags. + + Only Cloud Run revision resources that apply to specified filters are + imported into Datadog.' + example: + - $KEY:$VALUE + items: + description: Cloud Run Filters + type: string + type: array errors: description: An array of errors. example: diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 88f59f7fce6b..fed2ffd9be76 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7388,6 +7388,18 @@ components: description: Your service account email address. example: datadog-service-account@test-project.iam.gserviceaccount.com type: string + cloud_run_revision_filters: + description: 'List of filters to limit the Cloud Run revisions that are + pulled into Datadog by using tags. + + Only Cloud Run revision resources that apply to specified filters are + imported into Datadog.' + example: + - $KEY:$VALUE + items: + description: Cloud Run Filters + type: string + type: array host_filters: description: Your Host Filters. items: diff --git a/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.frozen b/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.frozen index 3677f3cb1d10..3898833e13c5 100644 --- a/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.frozen +++ b/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.frozen @@ -1 +1 @@ -2023-12-20T13:18:07.717Z \ No newline at end of file +2024-01-31T21:16:03.254Z \ No newline at end of file diff --git a/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.yml b/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.yml index 0701436ed070..d18b0bfffc74 100644 --- a/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.yml +++ b/cassettes/features/v1/gcp_integration/Create-a-GCP-integration-returns-OK-response.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Wed, 20 Dec 2023 13:18:07 GMT +- recorded_at: Wed, 31 Jan 2024 21:16:03 GMT request: body: encoding: UTF-8 - string: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"e5bbc86fb86ab202@example.com","client_id":"170307828717030782870","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL","host_filters":"key:value,filter:example","is_cspm_enabled":true,"is_security_command_center_enabled":true,"private_key":"private_key","private_key_id":"123456789abcdefghi123456789abcdefghijklm","project_id":"datadog-apitest","resource_collection_enabled":true,"token_uri":"https://accounts.google.com/o/oauth2/token","type":"service_account"}' + string: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"3af93b0f1c973838@example.com","client_id":"170673576317067357630","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL","cloud_run_revision_filters":["dr:dre"],"host_filters":"key:value,filter:example","is_cspm_enabled":true,"is_security_command_center_enabled":true,"private_key":"private_key","private_key_id":"123456789abcdefghi123456789abcdefghijklm","project_id":"datadog-apitest","resource_collection_enabled":true,"token_uri":"https://accounts.google.com/o/oauth2/token","type":"service_account"}' headers: Accept: - application/json @@ -23,11 +23,11 @@ http_interactions: status: code: 200 message: OK -- recorded_at: Wed, 20 Dec 2023 13:18:07 GMT +- recorded_at: Wed, 31 Jan 2024 21:16:03 GMT request: body: encoding: UTF-8 - string: '{"client_email":"e5bbc86fb86ab202@example.com","client_id":"170307828717030782870","project_id":"datadog-apitest"}' + string: '{"client_email":"3af93b0f1c973838@example.com","client_id":"170673576317067357630","project_id":"datadog-apitest"}' headers: Accept: - application/json diff --git a/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.frozen b/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.frozen new file mode 100644 index 000000000000..6f951f6ba55f --- /dev/null +++ b/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-01-31T21:16:03.829Z \ No newline at end of file diff --git a/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.yml b/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.yml new file mode 100644 index 000000000000..952113baa617 --- /dev/null +++ b/cassettes/features/v1/gcp_integration/Update-a-GCP-integration-cloud-run-revision-filters-returns-OK-response.yml @@ -0,0 +1,74 @@ +http_interactions: +- recorded_at: Wed, 31 Jan 2024 21:16:03 GMT + request: + body: + encoding: UTF-8 + string: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"edcdf6542ac6e6b6@example.com","client_id":"170673576317067357630","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL","host_filters":"key:value,filter:example","is_cspm_enabled":true,"is_security_command_center_enabled":true,"private_key":"private_key","private_key_id":"123456789abcdefghi123456789abcdefghijklm","project_id":"datadog-apitest","resource_collection_enabled":true,"token_uri":"https://accounts.google.com/o/oauth2/token","type":"service_account"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/integration/gcp + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 31 Jan 2024 21:16:03 GMT + request: + body: + encoding: UTF-8 + string: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"edcdf6542ac6e6b6@example.com","client_id":"170673576317067357630","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL","cloud_run_revision_filters":["merp:derp"],"host_filters":"key:value,filter:example","is_cspm_enabled":true,"is_security_command_center_enabled":true,"private_key":"private_key","private_key_id":"123456789abcdefghi123456789abcdefghijklm","project_id":"datadog-apitest","resource_collection_enabled":true,"token_uri":"https://accounts.google.com/o/oauth2/token","type":"service_account"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v1/integration/gcp + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Wed, 31 Jan 2024 21:16:03 GMT + request: + body: + encoding: UTF-8 + string: '{"client_email":"edcdf6542ac6e6b6@example.com","client_id":"170673576317067357630","project_id":"datadog-apitest"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/integration/gcp + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.frozen b/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.frozen new file mode 100644 index 000000000000..5078f78fe6df --- /dev/null +++ b/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-01-31T21:16:04.924Z \ No newline at end of file diff --git a/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.yml b/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.yml new file mode 100644 index 000000000000..7e04f518ec81 --- /dev/null +++ b/cassettes/features/v2/gcp_integration/Create-a-new-entry-for-your-service-account-with-cloud-run-revision-filters-enabled-returns-OK-response.yml @@ -0,0 +1,44 @@ +http_interactions: +- recorded_at: Wed, 31 Jan 2024 21:16:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"client_email":"feb37f50ee7be467@test-project.iam.gserviceaccount.com","cloud_run_revision_filters":["meh:bleh"],"host_filters":[]},"type":"gcp_service_account"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"gcp_service_account","attributes":{"cloud_run_revision_filters":["meh:bleh"],"resource_collection_enabled":false,"host_filters":[],"automute":false,"is_cspm_enabled":false,"account_tags":[],"client_email":"feb37f50ee7be467@test-project.iam.gserviceaccount.com","is_security_command_center_enabled":false},"id":"e1157377-8d5c-4a94-9730-10c3fa9d6ff5"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 31 Jan 2024 21:16:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/e1157377-8d5c-4a94-9730-10c3fa9d6ff5 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.frozen b/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.frozen new file mode 100644 index 000000000000..92757ea39aa3 --- /dev/null +++ b/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.frozen @@ -0,0 +1 @@ +2024-01-31T21:16:05.705Z \ No newline at end of file diff --git a/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.yml b/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.yml new file mode 100644 index 000000000000..8c42952d3c82 --- /dev/null +++ b/cassettes/features/v2/gcp_integration/Update-STS-Service-Account-returns-OK-response-with-cloud-run-revision-filters.yml @@ -0,0 +1,68 @@ +http_interactions: +- recorded_at: Wed, 31 Jan 2024 21:16:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"client_email":"a8e08a7fa29a1adb@example.com","host_filters":[]},"type":"gcp_service_account"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"gcp_service_account","id":"3e6ad31b-2da5-4ad4-878a-4d290520173b","attributes":{"account_tags":[],"resource_collection_enabled":false,"is_cspm_enabled":false,"automute":false,"host_filters":[],"is_security_command_center_enabled":false,"cloud_run_revision_filters":[],"client_email":"a8e08a7fa29a1adb@example.com"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 31 Jan 2024 21:16:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"client_email":"a8e08a7fa29a1adb@example.com","cloud_run_revision_filters":["merp:derp"]},"id":"3e6ad31b-2da5-4ad4-878a-4d290520173b","type":"gcp_service_account"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/3e6ad31b-2da5-4ad4-878a-4d290520173b + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"gcp_service_account","id":"3e6ad31b-2da5-4ad4-878a-4d290520173b","attributes":{"cloud_run_revision_filters":["merp:derp"],"host_filters":[],"automute":false,"is_security_command_center_enabled":false,"account_tags":[],"client_email":"a8e08a7fa29a1adb@example.com","is_cspm_enabled":false,"resource_collection_enabled":false}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Wed, 31 Jan 2024 21:16:05 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/integration/gcp/accounts/3e6ad31b-2da5-4ad4-878a-4d290520173b + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v1/gcp-integration/CreateGCPIntegration.rb b/examples/v1/gcp-integration/CreateGCPIntegration.rb index f9d4fdd2d6e9..02e66eb398af 100644 --- a/examples/v1/gcp-integration/CreateGCPIntegration.rb +++ b/examples/v1/gcp-integration/CreateGCPIntegration.rb @@ -10,6 +10,9 @@ client_id: "163662907116366290710", client_x509_cert_url: "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", host_filters: "key:value,filter:example", + cloud_run_revision_filters: [ + "dr:dre", + ], is_cspm_enabled: true, is_security_command_center_enabled: true, private_key: "private_key", diff --git a/examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.rb b/examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.rb new file mode 100644 index 000000000000..3813fd923848 --- /dev/null +++ b/examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.rb @@ -0,0 +1,25 @@ +# Update a GCP integration cloud run revision filters returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::GCPIntegrationAPI.new + +body = DatadogAPIClient::V1::GCPAccount.new({ + auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs", + auth_uri: "https://accounts.google.com/o/oauth2/auth", + client_email: "252bf553ef04b351@example.com", + client_id: "163662907116366290710", + client_x509_cert_url: "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", + host_filters: "key:value,filter:example", + cloud_run_revision_filters: [ + "merp:derp", + ], + is_cspm_enabled: true, + is_security_command_center_enabled: true, + private_key: "private_key", + private_key_id: "123456789abcdefghi123456789abcdefghijklm", + project_id: "datadog-apitest", + resource_collection_enabled: true, + token_uri: "https://accounts.google.com/o/oauth2/token", + type: "service_account", +}) +p api_instance.update_gcp_integration(body) diff --git a/examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.rb b/examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.rb new file mode 100644 index 000000000000..5eba3dabff22 --- /dev/null +++ b/examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.rb @@ -0,0 +1,18 @@ +# Create a new entry for your service account with cloud run revision filters enabled returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::GCPIntegrationAPI.new + +body = DatadogAPIClient::V2::GCPSTSServiceAccountCreateRequest.new({ + data: DatadogAPIClient::V2::GCPSTSServiceAccountData.new({ + attributes: DatadogAPIClient::V2::GCPSTSServiceAccountAttributes.new({ + cloud_run_revision_filters: [ + "meh:bleh", + ], + client_email: "252bf553ef04b351@test-project.iam.gserviceaccount.com", + host_filters: [], + }), + type: DatadogAPIClient::V2::GCPServiceAccountType::GCP_SERVICE_ACCOUNT, + }), +}) +p api_instance.create_gcpsts_account(body) diff --git a/examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.rb b/examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.rb new file mode 100644 index 000000000000..bca962dbb96b --- /dev/null +++ b/examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.rb @@ -0,0 +1,21 @@ +# Update STS Service Account returns "OK" response with cloud run revision filters + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::GCPIntegrationAPI.new + +# there is a valid "gcp_sts_account" in the system +GCP_STS_ACCOUNT_DATA_ID = ENV["GCP_STS_ACCOUNT_DATA_ID"] + +body = DatadogAPIClient::V2::GCPSTSServiceAccountUpdateRequest.new({ + data: DatadogAPIClient::V2::GCPSTSServiceAccountUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::GCPSTSServiceAccountAttributes.new({ + client_email: "252bf553ef04b351@example.com", + cloud_run_revision_filters: [ + "merp:derp", + ], + }), + id: GCP_STS_ACCOUNT_DATA_ID, + type: DatadogAPIClient::V2::GCPServiceAccountType::GCP_SERVICE_ACCOUNT, + }), +}) +p api_instance.update_gcpsts_account(GCP_STS_ACCOUNT_DATA_ID, body) diff --git a/features/v1/gcp_integration.feature b/features/v1/gcp_integration.feature index cc078be2f030..2b656ab20230 100644 --- a/features/v1/gcp_integration.feature +++ b/features/v1/gcp_integration.feature @@ -13,21 +13,21 @@ Feature: GCP Integration @generated @skip @team:DataDog/gcp-integrations Scenario: Create a GCP integration returns "Bad Request" response Given new "CreateGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request @team:DataDog/gcp-integrations Scenario: Create a GCP integration returns "OK" response Given new "CreateGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "{{unique_hash}}@example.com", "client_id": "{{ timestamp("now") }}{{ timestamp("now") }}0", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "{{unique_hash}}@example.com", "client_id": "{{ timestamp("now") }}{{ timestamp("now") }}0", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "host_filters": "key:value,filter:example", "cloud_run_revision_filters": ["dr:dre"], "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 200 OK @generated @skip @team:DataDog/gcp-integrations Scenario: Delete a GCP integration returns "Bad Request" response Given new "DeleteGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request @@ -51,10 +51,18 @@ Feature: GCP Integration When the request is sent Then the response status is 200 OK + @team:DataDog/gcp-integrations + Scenario: Update a GCP integration cloud run revision filters returns "OK" response + Given there is a valid "gcp_account" in the system + And new "UpdateGCPIntegration" request + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "{{unique_hash}}@example.com", "client_id": "{{ timestamp("now") }}{{ timestamp("now") }}0", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "host_filters": "key:value,filter:example", "cloud_run_revision_filters": ["merp:derp"], "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/gcp-integrations Scenario: Update a GCP integration returns "Bad Request" response Given new "UpdateGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request diff --git a/features/v2/gcp_integration.feature b/features/v2/gcp_integration.feature index e18714ba2e89..6085d6ed2f8d 100644 --- a/features/v2/gcp_integration.feature +++ b/features/v2/gcp_integration.feature @@ -34,14 +34,14 @@ Feature: GCP Integration @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": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": [], "is_security_command_center_enabled": true}, "type": "gcp_service_account"}} + And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_security_command_center_enabled": true}, "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": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": [], "is_security_command_center_enabled": true}, "type": "gcp_service_account"}} + And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_security_command_center_enabled": true}, "type": "gcp_service_account"}} When the request is sent Then the response status is 409 Conflict @@ -64,6 +64,16 @@ Feature: GCP Integration And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com" And the response "data.attributes.account_tags" is equal to ["lorem", "ipsum"] + @team:DataDog/gcp-integrations + Scenario: Create a new entry for your service account with cloud run revision filters enabled returns "OK" response + Given new "CreateGCPSTSAccount" request + And body with value {"data": {"attributes": {"cloud_run_revision_filters": ["meh:bleh"], "client_email": "{{ unique_hash }}@test-project.iam.gserviceaccount.com", "host_filters": []}, "type": "gcp_service_account"}} + When the request is sent + Then the response status is 201 OK + And the response "data.type" is equal to "gcp_service_account" + And the response "data.attributes.client_email" is equal to "{{ unique_hash }}@test-project.iam.gserviceaccount.com" + And the response "data.attributes.cloud_run_revision_filters" is equal to ["meh:bleh"] + @team:DataDog/gcp-integrations Scenario: Create a new entry for your service account with cspm enabled returns "OK" response Given new "CreateGCPSTSAccount" request @@ -140,7 +150,7 @@ Feature: GCP Integration 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": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": [], "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} + And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} When the request is sent Then the response status is 400 Bad Request @@ -148,7 +158,7 @@ Feature: GCP Integration 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": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "host_filters": [], "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} + And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} When the request is sent Then the response status is 404 Not Found @@ -161,6 +171,15 @@ Feature: GCP Integration When the request is sent Then the response status is 201 OK + @team:DataDog/gcp-integrations + Scenario: Update STS Service Account returns "OK" response with cloud run revision filters + Given there is a valid "gcp_sts_account" in the system + And new "UpdateGCPSTSAccount" request + And request contains "account_id" parameter from "gcp_sts_account.data.id" + And body with value {"data": {"attributes": {"client_email": "{{ unique_hash }}@example.com", "cloud_run_revision_filters": ["merp:derp"]}, "id": "{{ gcp_sts_account.data.id }}", "type": "gcp_service_account"}} + When the request is sent + Then the response status is 201 OK + @team:DataDog/gcp-integrations Scenario: Update STS Service Account returns "OK" response with enable resource collection turned on Given there is a valid "gcp_sts_account" in the system diff --git a/lib/datadog_api_client/v1/models/gcp_account.rb b/lib/datadog_api_client/v1/models/gcp_account.rb index 2e1e84acc64f..36a4c2de71cb 100644 --- a/lib/datadog_api_client/v1/models/gcp_account.rb +++ b/lib/datadog_api_client/v1/models/gcp_account.rb @@ -40,6 +40,10 @@ class GCPAccount # where `$CLIENT_EMAIL` is the email found in your JSON service account key. attr_accessor :client_x509_cert_url + # Limit the Cloud Run revisions that are pulled into Datadog by using tags. + # Only Cloud Run revision resources that apply to specified filters are imported into Datadog. + attr_accessor :cloud_run_revision_filters + # An array of errors. attr_accessor :errors @@ -81,6 +85,7 @@ def self.attribute_map :'client_email' => :'client_email', :'client_id' => :'client_id', :'client_x509_cert_url' => :'client_x509_cert_url', + :'cloud_run_revision_filters' => :'cloud_run_revision_filters', :'errors' => :'errors', :'host_filters' => :'host_filters', :'is_cspm_enabled' => :'is_cspm_enabled', @@ -104,6 +109,7 @@ def self.openapi_types :'client_email' => :'String', :'client_id' => :'String', :'client_x509_cert_url' => :'String', + :'cloud_run_revision_filters' => :'Array', :'errors' => :'Array', :'host_filters' => :'String', :'is_cspm_enabled' => :'Boolean', @@ -157,6 +163,12 @@ def initialize(attributes = {}) self.client_x509_cert_url = attributes[:'client_x509_cert_url'] end + if attributes.key?(:'cloud_run_revision_filters') + if (value = attributes[:'cloud_run_revision_filters']).is_a?(Array) + self.cloud_run_revision_filters = value + end + end + if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value @@ -212,6 +224,7 @@ def ==(o) client_email == o.client_email && client_id == o.client_id && client_x509_cert_url == o.client_x509_cert_url && + cloud_run_revision_filters == o.cloud_run_revision_filters && errors == o.errors && host_filters == o.host_filters && is_cspm_enabled == o.is_cspm_enabled && @@ -228,7 +241,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [auth_provider_x509_cert_url, auth_uri, automute, client_email, client_id, client_x509_cert_url, errors, host_filters, is_cspm_enabled, is_security_command_center_enabled, private_key, private_key_id, project_id, resource_collection_enabled, token_uri, type].hash + [auth_provider_x509_cert_url, auth_uri, automute, client_email, client_id, client_x509_cert_url, cloud_run_revision_filters, errors, host_filters, is_cspm_enabled, is_security_command_center_enabled, private_key, private_key_id, project_id, resource_collection_enabled, token_uri, type].hash end end end diff --git a/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb b/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb index 5cee4800e5a8..0dcbf300f62b 100644 --- a/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb +++ b/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb @@ -30,6 +30,10 @@ class GCPSTSServiceAccountAttributes # Your service account email address. attr_accessor :client_email + # List of filters to limit the Cloud Run revisions that are pulled into Datadog by using tags. + # Only Cloud Run revision resources that apply to specified filters are imported into Datadog. + attr_accessor :cloud_run_revision_filters + # Your Host Filters. attr_accessor :host_filters @@ -49,6 +53,7 @@ def self.attribute_map :'account_tags' => :'account_tags', :'automute' => :'automute', :'client_email' => :'client_email', + :'cloud_run_revision_filters' => :'cloud_run_revision_filters', :'host_filters' => :'host_filters', :'is_cspm_enabled' => :'is_cspm_enabled', :'is_security_command_center_enabled' => :'is_security_command_center_enabled', @@ -63,6 +68,7 @@ def self.openapi_types :'account_tags' => :'Array', :'automute' => :'Boolean', :'client_email' => :'String', + :'cloud_run_revision_filters' => :'Array', :'host_filters' => :'Array', :'is_cspm_enabled' => :'Boolean', :'is_security_command_center_enabled' => :'Boolean', @@ -100,6 +106,12 @@ def initialize(attributes = {}) self.client_email = attributes[:'client_email'] end + if attributes.key?(:'cloud_run_revision_filters') + if (value = attributes[:'cloud_run_revision_filters']).is_a?(Array) + self.cloud_run_revision_filters = value + end + end + if attributes.key?(:'host_filters') if (value = attributes[:'host_filters']).is_a?(Array) self.host_filters = value @@ -128,6 +140,7 @@ def ==(o) account_tags == o.account_tags && automute == o.automute && client_email == o.client_email && + cloud_run_revision_filters == o.cloud_run_revision_filters && host_filters == o.host_filters && is_cspm_enabled == o.is_cspm_enabled && is_security_command_center_enabled == o.is_security_command_center_enabled && @@ -138,7 +151,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [account_tags, automute, client_email, host_filters, is_cspm_enabled, is_security_command_center_enabled, resource_collection_enabled].hash + [account_tags, automute, client_email, cloud_run_revision_filters, host_filters, is_cspm_enabled, is_security_command_center_enabled, resource_collection_enabled].hash end end end