-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cloud run filter to GCP v1 and v2 spec (#1845)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c8fea3e
commit d25cd73
Showing
19 changed files
with
346 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7388,6 +7388,18 @@ components: | |
description: Your service account email address. | ||
example: [email protected] | ||
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
examples/v1/gcp-integration/UpdateGCPIntegration_3544259255.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
Update a GCP integration cloud run revision filters returns "OK" response | ||
""" | ||
|
||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v1.api.gcp_integration_api import GCPIntegrationApi | ||
from datadog_api_client.v1.model.gcp_account import GCPAccount | ||
|
||
body = GCPAccount( | ||
auth_provider_x509_cert_url="https://www.googleapis.com/oauth2/v1/certs", | ||
auth_uri="https://accounts.google.com/o/oauth2/auth", | ||
client_email="[email protected]", | ||
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", | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = GCPIntegrationApi(api_client) | ||
response = api_instance.update_gcp_integration(body=body) | ||
|
||
print(response) |
30 changes: 30 additions & 0 deletions
30
examples/v2/gcp-integration/CreateGCPSTSAccount_194782945.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Create a new entry for your service account with cloud run revision filters enabled returns "OK" response | ||
""" | ||
|
||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi | ||
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType | ||
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes | ||
from datadog_api_client.v2.model.gcpsts_service_account_create_request import GCPSTSServiceAccountCreateRequest | ||
from datadog_api_client.v2.model.gcpsts_service_account_data import GCPSTSServiceAccountData | ||
|
||
body = GCPSTSServiceAccountCreateRequest( | ||
data=GCPSTSServiceAccountData( | ||
attributes=GCPSTSServiceAccountAttributes( | ||
cloud_run_revision_filters=[ | ||
"meh:bleh", | ||
], | ||
client_email="[email protected]", | ||
host_filters=[], | ||
), | ||
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT, | ||
), | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = GCPIntegrationApi(api_client) | ||
response = api_instance.create_gcpsts_account(body=body) | ||
|
||
print(response) |
34 changes: 34 additions & 0 deletions
34
examples/v2/gcp-integration/UpdateGCPSTSAccount_2241994060.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
Update STS Service Account returns "OK" response with cloud run revision filters | ||
""" | ||
|
||
from os import environ | ||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi | ||
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType | ||
from datadog_api_client.v2.model.gcpsts_service_account_attributes import GCPSTSServiceAccountAttributes | ||
from datadog_api_client.v2.model.gcpsts_service_account_update_request import GCPSTSServiceAccountUpdateRequest | ||
from datadog_api_client.v2.model.gcpsts_service_account_update_request_data import GCPSTSServiceAccountUpdateRequestData | ||
|
||
# there is a valid "gcp_sts_account" in the system | ||
GCP_STS_ACCOUNT_DATA_ID = environ["GCP_STS_ACCOUNT_DATA_ID"] | ||
|
||
body = GCPSTSServiceAccountUpdateRequest( | ||
data=GCPSTSServiceAccountUpdateRequestData( | ||
attributes=GCPSTSServiceAccountAttributes( | ||
client_email="[email protected]", | ||
cloud_run_revision_filters=[ | ||
"merp:derp", | ||
], | ||
), | ||
id=GCP_STS_ACCOUNT_DATA_ID, | ||
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT, | ||
), | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = GCPIntegrationApi(api_client) | ||
response = api_instance.update_gcpsts_account(account_id=GCP_STS_ACCOUNT_DATA_ID, body=body) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/v1/cassettes/test_scenarios/test_create_a_gcp_integration_returns_ok_response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-12-20T13:18:07.717Z | ||
2024-01-31T21:16:03.254Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...arios/test_update_a_gcp_integration_cloud_run_revision_filters_returns_ok_response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024-01-31T21:16:03.829Z |
62 changes: 62 additions & 0 deletions
62
...enarios/test_update_a_gcp_integration_cloud_run_revision_filters_returns_ok_response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
interactions: | ||
- request: | ||
body: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"[email protected]","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: | ||
string: '{} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: '{"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","auth_uri":"https://accounts.google.com/o/oauth2/auth","client_email":"[email protected]","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: | ||
string: '{} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: '{"client_email":"[email protected]","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: | ||
string: '{} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
Oops, something went wrong.