Mettre à jour un compte de service STS
https://api.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.us3.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.us5.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.datadoghq.eu/api/v2/integration/gcp/accounts/{account_id}https://api.ap1.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.ap2.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.uk1.datadoghq.com/api/v2/integration/gcp/accounts/{account_id}https://api.ddog-gov.com/api/v2/integration/gcp/accounts/{account_id}https://api.us2.ddog-gov.com/api/v2/integration/gcp/accounts/{account_id}Présentation
Mettez à jour un compte de service STS.
Arguments
Paramètres du chemin
account_id [required]Your GCP STS enabled service account's unique ID.
Requête
Body Data (required)
dataInformations du compte de service.
attributesAttributes associated with your service account.
account_tagsTags to be associated with GCP metrics and service checks from your account.
automuteSilence monitors for expected GCE instance shutdowns.
client_emailYour service account email address.
cloud_run_revision_filtersDEPRECATED 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.
Note: This field is deprecated. Instead, use monitored_resource_configs with type=cloud_run_revision
host_filtersDEPRECATED List of filters to limit the VM instances that are pulled into Datadog by using tags.
Only VM instance resources that apply to specified filters are imported into Datadog.
Note: This field is deprecated. Instead, use monitored_resource_configs with type=gce_instance
is_cspm_enabledWhen enabled, Datadog will activate the Cloud Security Monitoring product for this service account. Note: This requires resource_collection_enabled to be set to true.
is_global_location_enabledWhen enabled, Datadog collects metrics where location is explicitly stated as "global" or where location information cannot be deduced from GCP labels.
trueis_org_folder_resource_collection_enabledWhen enabled, Datadog scans for organization and folder-level resources under the organization the service account belongs to.
falseis_per_project_quota_enabledWhen enabled, Datadog applies the X-Goog-User-Project header, attributing Google Cloud billing and quota usage to the project being monitored rather than the default service account project.
falseis_resource_change_collection_enabledWhen enabled, Datadog scans for all resource change data in your Google Cloud environment.
falseis_security_command_center_enabledWhen enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
falsemetric_namespace_configsConfigurations for GCP metric namespaces.
disabledWhen disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
falsefiltersWhen enabled, Datadog applies these additional filters to limit metric collection. A metric is collected only if it does not match all exclusion filters and matches at least one allow filter.
idThe id of the GCP metric namespace.
monitored_resource_configsConfigurations for GCP monitored resources.
filtersList of filters to limit the monitored resources that are pulled into Datadog by using tags. Only monitored resources that apply to specified filters are imported into Datadog.
typeThe GCP monitored resource type. Only a subset of resource types are supported.
cloud_function, cloud_run_revision, gce_instanceregion_filter_configsConfigurations for GCP location filtering, such as region, multi-region, or zone. Only monitored resources that match the specified regions are imported into Datadog. By default, Datadog collects from all locations.
resource_collection_enabledWhen enabled, Datadog scans for all project-level resources in your GCP environment.
idYour service account's unique ID.
typeThe type of account.
gcp_service_accountgcp_service_accountUpdate STS Service Account returns "OK" response
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}Update STS Service Account returns "OK" response with cloud run revision filters
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}Update STS Service Account returns "OK" response with enable resource collection turned on
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}Réponse
OK
The account creation response.
dataInfo on your service account.
attributesAttributes associated with your service account.
account_tagsTags to be associated with GCP metrics and service checks from your account.
automuteSilence monitors for expected GCE instance shutdowns.
client_emailYour service account email address.
cloud_run_revision_filtersDEPRECATED 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.
Note: This field is deprecated. Instead, use monitored_resource_configs with type=cloud_run_revision
host_filtersDEPRECATED List of filters to limit the VM instances that are pulled into Datadog by using tags.
Only VM instance resources that apply to specified filters are imported into Datadog.
Note: This field is deprecated. Instead, use monitored_resource_configs with type=gce_instance
is_cspm_enabledWhen enabled, Datadog will activate the Cloud Security Monitoring product for this service account. Note: This requires resource_collection_enabled to be set to true.
is_global_location_enabledWhen enabled, Datadog collects metrics where location is explicitly stated as "global" or where location information cannot be deduced from GCP labels.
trueis_org_folder_resource_collection_enabledWhen enabled, Datadog scans for organization and folder-level resources under the organization the service account belongs to.
falseis_per_project_quota_enabledWhen enabled, Datadog applies the X-Goog-User-Project header, attributing Google Cloud billing and quota usage to the project being monitored rather than the default service account project.
falseis_resource_change_collection_enabledWhen enabled, Datadog scans for all resource change data in your Google Cloud environment.
falseis_security_command_center_enabledWhen enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
falsemetric_namespace_configsConfigurations for GCP metric namespaces.
disabledWhen disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
falsefiltersWhen enabled, Datadog applies these additional filters to limit metric collection. A metric is collected only if it does not match all exclusion filters and matches at least one allow filter.
idThe id of the GCP metric namespace.
monitored_resource_configsConfigurations for GCP monitored resources.
filtersList of filters to limit the monitored resources that are pulled into Datadog by using tags. Only monitored resources that apply to specified filters are imported into Datadog.
typeThe GCP monitored resource type. Only a subset of resource types are supported.
cloud_function, cloud_run_revision, gce_instanceregion_filter_configsConfigurations for GCP location filtering, such as region, multi-region, or zone. Only monitored resources that match the specified regions are imported into Datadog. By default, Datadog collects from all locations.
resource_collection_enabledWhen enabled, Datadog scans for all project-level resources in your GCP environment.
idYour service account's unique ID.
metaAdditional information related to your service account.
accessible_projectsThe current list of projects accessible from your service account.
typeThe type of account.
gcp_service_accountgcp_service_account{
"data": {
"attributes": {
"account_tags": [],
"automute": false,
"client_email": "datadog-service-account@test-project.iam.gserviceaccount.com",
"cloud_run_revision_filters": [
"$KEY:$VALUE"
],
"host_filters": [
"$KEY:$VALUE"
],
"is_cspm_enabled": false,
"is_global_location_enabled": true,
"is_org_folder_resource_collection_enabled": false,
"is_per_project_quota_enabled": true,
"is_resource_change_collection_enabled": true,
"is_security_command_center_enabled": true,
"metric_namespace_configs": [
{
"disabled": true,
"filters": [
"snapshot.*",
"!*_by_region"
],
"id": "pubsub"
}
],
"monitored_resource_configs": [
{
"filters": [
"$KEY:$VALUE"
],
"type": "gce_instance"
}
],
"region_filter_configs": [
"nam4",
"europe-north1"
],
"resource_collection_enabled": false
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"meta": {
"accessible_projects": []
},
"type": "gcp_service_account"
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Authorized
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Exemple de code
Update STS Service Account returns "OK" response
# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"host_filters": [
"foo:bar"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOFUpdate STS Service Account returns "OK" response with cloud run revision filters
# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"cloud_run_revision_filters": [
"merp:derp"
]
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOFUpdate STS Service Account returns "OK" response with enable resource collection turned on
# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOF# Path parameters
export account_id="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/integration/gcp/accounts/${account_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"client_email": "Test-252bf553ef04b351@example.com",
"resource_collection_enabled": true
},
"id": "d291291f-12c2-22g4-j290-123456678897",
"type": "gcp_service_account"
}
}
EOFUpdate STS Service Account returns "OK" response
// Update STS Service Account returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
// there is a valid "gcp_sts_account" in the system
GcpStsAccountDataID := os.Getenv("GCP_STS_ACCOUNT_DATA_ID")
body := datadogV2.GCPSTSServiceAccountUpdateRequest{
Data: &datadogV2.GCPSTSServiceAccountUpdateRequestData{
Attributes: &datadogV2.GCPSTSServiceAccountAttributes{
ClientEmail: datadog.PtrString("Test-252bf553ef04b351@example.com"),
HostFilters: []string{
"foo:bar",
},
},
Id: datadog.PtrString(GcpStsAccountDataID),
Type: datadogV2.GCPSERVICEACCOUNTTYPE_GCP_SERVICE_ACCOUNT.Ptr(),
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewGCPIntegrationApi(apiClient)
resp, r, err := api.UpdateGCPSTSAccount(ctx, GcpStsAccountDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `GCPIntegrationApi.UpdateGCPSTSAccount`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `GCPIntegrationApi.UpdateGCPSTSAccount`:\n%s\n", responseContent)
}
Update STS Service Account returns "OK" response with cloud run revision filters
// Update STS Service Account returns "OK" response with cloud run revision filters
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
// there is a valid "gcp_sts_account" in the system
GcpStsAccountDataID := os.Getenv("GCP_STS_ACCOUNT_DATA_ID")
body := datadogV2.GCPSTSServiceAccountUpdateRequest{
Data: &datadogV2.GCPSTSServiceAccountUpdateRequestData{
Attributes: &datadogV2.GCPSTSServiceAccountAttributes{
ClientEmail: datadog.PtrString("Test-252bf553ef04b351@example.com"),
CloudRunRevisionFilters: []string{
"merp:derp",
},
},
Id: datadog.PtrString(GcpStsAccountDataID),
Type: datadogV2.GCPSERVICEACCOUNTTYPE_GCP_SERVICE_ACCOUNT.Ptr(),
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewGCPIntegrationApi(apiClient)
resp, r, err := api.UpdateGCPSTSAccount(ctx, GcpStsAccountDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `GCPIntegrationApi.UpdateGCPSTSAccount`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `GCPIntegrationApi.UpdateGCPSTSAccount`:\n%s\n", responseContent)
}
Update STS Service Account returns "OK" response with enable resource collection turned on
// Update STS Service Account returns "OK" response with enable resource collection turned on
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
// there is a valid "gcp_sts_account" in the system
GcpStsAccountDataID := os.Getenv("GCP_STS_ACCOUNT_DATA_ID")
body := datadogV2.GCPSTSServiceAccountUpdateRequest{
Data: &datadogV2.GCPSTSServiceAccountUpdateRequestData{
Attributes: &datadogV2.GCPSTSServiceAccountAttributes{
ClientEmail: datadog.PtrString("Test-252bf553ef04b351@example.com"),
ResourceCollectionEnabled: datadog.PtrBool(true),
},
Id: datadog.PtrString(GcpStsAccountDataID),
Type: datadogV2.GCPSERVICEACCOUNTTYPE_GCP_SERVICE_ACCOUNT.Ptr(),
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewGCPIntegrationApi(apiClient)
resp, r, err := api.UpdateGCPSTSAccount(ctx, GcpStsAccountDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `GCPIntegrationApi.UpdateGCPSTSAccount`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `GCPIntegrationApi.UpdateGCPSTSAccount`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"Update STS Service Account returns "OK" response
// 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;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient);
// there is a valid "gcp_sts_account" in the system
String GCP_STS_ACCOUNT_DATA_ID = System.getenv("GCP_STS_ACCOUNT_DATA_ID");
GCPSTSServiceAccountUpdateRequest body =
new GCPSTSServiceAccountUpdateRequest()
.data(
new GCPSTSServiceAccountUpdateRequestData()
.attributes(
new GCPSTSServiceAccountAttributes()
.clientEmail("Test-252bf553ef04b351@example.com")
.hostFilters(Collections.singletonList("foo:bar")))
.id(GCP_STS_ACCOUNT_DATA_ID)
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT));
try {
GCPSTSServiceAccountResponse result =
apiInstance.updateGCPSTSAccount(GCP_STS_ACCOUNT_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Update STS Service Account returns "OK" response with cloud run revision filters
// Update STS Service Account returns "OK" response with cloud run revision filters
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;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient);
// there is a valid "gcp_sts_account" in the system
String GCP_STS_ACCOUNT_DATA_ID = System.getenv("GCP_STS_ACCOUNT_DATA_ID");
GCPSTSServiceAccountUpdateRequest body =
new GCPSTSServiceAccountUpdateRequest()
.data(
new GCPSTSServiceAccountUpdateRequestData()
.attributes(
new GCPSTSServiceAccountAttributes()
.clientEmail("Test-252bf553ef04b351@example.com")
.cloudRunRevisionFilters(Collections.singletonList("merp:derp")))
.id(GCP_STS_ACCOUNT_DATA_ID)
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT));
try {
GCPSTSServiceAccountResponse result =
apiInstance.updateGCPSTSAccount(GCP_STS_ACCOUNT_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Update STS Service Account returns "OK" response with enable resource collection turned on
// Update STS Service Account returns "OK" response with enable resource collection turned on
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();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient);
// there is a valid "gcp_sts_account" in the system
String GCP_STS_ACCOUNT_DATA_ID = System.getenv("GCP_STS_ACCOUNT_DATA_ID");
GCPSTSServiceAccountUpdateRequest body =
new GCPSTSServiceAccountUpdateRequest()
.data(
new GCPSTSServiceAccountUpdateRequestData()
.attributes(
new GCPSTSServiceAccountAttributes()
.clientEmail("Test-252bf553ef04b351@example.com")
.resourceCollectionEnabled(true))
.id(GCP_STS_ACCOUNT_DATA_ID)
.type(GCPServiceAccountType.GCP_SERVICE_ACCOUNT));
try {
GCPSTSServiceAccountResponse result =
apiInstance.updateGCPSTSAccount(GCP_STS_ACCOUNT_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GcpIntegrationApi#updateGCPSTSAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"Update STS Service Account returns "OK" response
"""
Update STS Service Account returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi
from datadog_api_client.v2.model.gcp_service_account_type import GCPServiceAccountType
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="Test-252bf553ef04b351@example.com",
host_filters=[
"foo:bar",
],
),
id=GCP_STS_ACCOUNT_DATA_ID,
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
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)
Update STS Service Account returns "OK" response with cloud run revision filters
"""
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="Test-252bf553ef04b351@example.com",
cloud_run_revision_filters=[
"merp:derp",
],
),
id=GCP_STS_ACCOUNT_DATA_ID,
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
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)
Update STS Service Account returns "OK" response with enable resource collection turned on
"""
Update STS Service Account returns "OK" response with enable resource collection turned on
"""
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="Test-252bf553ef04b351@example.com",
resource_collection_enabled=True,
),
id=GCP_STS_ACCOUNT_DATA_ID,
type=GCPServiceAccountType.GCP_SERVICE_ACCOUNT,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
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)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"Update STS Service Account returns "OK" response
# Update STS Service Account returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
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: "Test-252bf553ef04b351@example.com",
host_filters: [
"foo:bar",
],
}),
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)
Update STS Service Account returns "OK" response with cloud run revision filters
# Update STS Service Account returns "OK" response with cloud run revision filters
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
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: "Test-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)
Update STS Service Account returns "OK" response with enable resource collection turned on
# Update STS Service Account returns "OK" response with enable resource collection turned on
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
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: "Test-252bf553ef04b351@example.com",
resource_collection_enabled: true,
}),
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)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"Update STS Service Account returns "OK" response
// Update STS Service Account returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_gcp_integration::GCPIntegrationAPI;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountAttributes;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequest;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequestData;
use datadog_api_client::datadogV2::model::GCPServiceAccountType;
#[tokio::main]
async fn main() {
// there is a valid "gcp_sts_account" in the system
let gcp_sts_account_data_id = std::env::var("GCP_STS_ACCOUNT_DATA_ID").unwrap();
let body = GCPSTSServiceAccountUpdateRequest::new().data(
GCPSTSServiceAccountUpdateRequestData::new()
.attributes(
GCPSTSServiceAccountAttributes::new()
.client_email("Test-252bf553ef04b351@example.com".to_string())
.host_filters(vec!["foo:bar".to_string()]),
)
.id(gcp_sts_account_data_id.clone())
.type_(GCPServiceAccountType::GCP_SERVICE_ACCOUNT),
);
let configuration = datadog::Configuration::new();
let api = GCPIntegrationAPI::with_config(configuration);
let resp = api
.update_gcpsts_account(gcp_sts_account_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Update STS Service Account returns "OK" response with cloud run revision filters
// Update STS Service Account returns "OK" response with cloud run revision filters
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_gcp_integration::GCPIntegrationAPI;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountAttributes;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequest;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequestData;
use datadog_api_client::datadogV2::model::GCPServiceAccountType;
#[tokio::main]
async fn main() {
// there is a valid "gcp_sts_account" in the system
let gcp_sts_account_data_id = std::env::var("GCP_STS_ACCOUNT_DATA_ID").unwrap();
let body = GCPSTSServiceAccountUpdateRequest::new().data(
GCPSTSServiceAccountUpdateRequestData::new()
.attributes(
GCPSTSServiceAccountAttributes::new()
.client_email("Test-252bf553ef04b351@example.com".to_string())
.cloud_run_revision_filters(vec!["merp:derp".to_string()]),
)
.id(gcp_sts_account_data_id.clone())
.type_(GCPServiceAccountType::GCP_SERVICE_ACCOUNT),
);
let configuration = datadog::Configuration::new();
let api = GCPIntegrationAPI::with_config(configuration);
let resp = api
.update_gcpsts_account(gcp_sts_account_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Update STS Service Account returns "OK" response with enable resource collection turned on
// Update STS Service Account returns "OK" response with enable resource
// collection turned on
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_gcp_integration::GCPIntegrationAPI;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountAttributes;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequest;
use datadog_api_client::datadogV2::model::GCPSTSServiceAccountUpdateRequestData;
use datadog_api_client::datadogV2::model::GCPServiceAccountType;
#[tokio::main]
async fn main() {
// there is a valid "gcp_sts_account" in the system
let gcp_sts_account_data_id = std::env::var("GCP_STS_ACCOUNT_DATA_ID").unwrap();
let body = GCPSTSServiceAccountUpdateRequest::new().data(
GCPSTSServiceAccountUpdateRequestData::new()
.attributes(
GCPSTSServiceAccountAttributes::new()
.client_email("Test-252bf553ef04b351@example.com".to_string())
.resource_collection_enabled(true),
)
.id(gcp_sts_account_data_id.clone())
.type_(GCPServiceAccountType::GCP_SERVICE_ACCOUNT),
);
let configuration = datadog::Configuration::new();
let api = GCPIntegrationAPI::with_config(configuration);
let resp = api
.update_gcpsts_account(gcp_sts_account_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runUpdate STS Service Account returns "OK" response
/**
* Update STS Service Account returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.GCPIntegrationApi(configuration);
// there is a valid "gcp_sts_account" in the system
const GCP_STS_ACCOUNT_DATA_ID = process.env.GCP_STS_ACCOUNT_DATA_ID as string;
const params: v2.GCPIntegrationApiUpdateGCPSTSAccountRequest = {
body: {
data: {
attributes: {
clientEmail: "Test-252bf553ef04b351@example.com",
hostFilters: ["foo:bar"],
},
id: GCP_STS_ACCOUNT_DATA_ID,
type: "gcp_service_account",
},
},
accountId: GCP_STS_ACCOUNT_DATA_ID,
};
apiInstance
.updateGCPSTSAccount(params)
.then((data: v2.GCPSTSServiceAccountResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Update STS Service Account returns "OK" response with cloud run revision filters
/**
* Update STS Service Account returns "OK" response with cloud run revision filters
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.GCPIntegrationApi(configuration);
// there is a valid "gcp_sts_account" in the system
const GCP_STS_ACCOUNT_DATA_ID = process.env.GCP_STS_ACCOUNT_DATA_ID as string;
const params: v2.GCPIntegrationApiUpdateGCPSTSAccountRequest = {
body: {
data: {
attributes: {
clientEmail: "Test-252bf553ef04b351@example.com",
cloudRunRevisionFilters: ["merp:derp"],
},
id: GCP_STS_ACCOUNT_DATA_ID,
type: "gcp_service_account",
},
},
accountId: GCP_STS_ACCOUNT_DATA_ID,
};
apiInstance
.updateGCPSTSAccount(params)
.then((data: v2.GCPSTSServiceAccountResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Update STS Service Account returns "OK" response with enable resource collection turned on
/**
* Update STS Service Account returns "OK" response with enable resource collection turned on
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.GCPIntegrationApi(configuration);
// there is a valid "gcp_sts_account" in the system
const GCP_STS_ACCOUNT_DATA_ID = process.env.GCP_STS_ACCOUNT_DATA_ID as string;
const params: v2.GCPIntegrationApiUpdateGCPSTSAccountRequest = {
body: {
data: {
attributes: {
clientEmail: "Test-252bf553ef04b351@example.com",
resourceCollectionEnabled: true,
},
id: GCP_STS_ACCOUNT_DATA_ID,
type: "gcp_service_account",
},
},
accountId: GCP_STS_ACCOUNT_DATA_ID,
};
apiInstance
.updateGCPSTSAccount(params)
.then((data: v2.GCPSTSServiceAccountResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"