Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22824,6 +22824,13 @@ components:
product for this service account. Note: This requires resource_collection_enabled
to be set to true.'
type: boolean
is_global_location_enabled:
default: true
description: "When enabled, metrics where location is explicitly stated
as \u201Cglobal\u201D or where location information cannot be deduced
from GCP labels is collected."
example: true
type: boolean
is_per_project_quota_enabled:
default: false
description: When enabled, Datadog applies the `X-Goog-User-Project` header,
Expand Down Expand Up @@ -22865,6 +22872,16 @@ components:
items:
$ref: '#/components/schemas/GCPMonitoredResourceConfig'
type: array
region_filter_configs:
description: Filters to limit metric collection by GCP location, such as
region, multi-region, or zone. By default, Datadog collects from all locations.
example:
- nam4
- europe-north1
items:
description: Region Filter Configs
type: string
type: array
resource_collection_enabled:
description: When enabled, Datadog scans for all resources in your GCP environment.
type: boolean
Expand Down
38 changes: 38 additions & 0 deletions src/datadogV2/model/model_gcpsts_service_account_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub struct GCPSTSServiceAccountAttributes {
/// When enabled, Datadog will activate the Cloud Security Monitoring product for this service account. Note: This requires resource_collection_enabled to be set to true.
#[serde(rename = "is_cspm_enabled")]
pub is_cspm_enabled: Option<bool>,
/// When enabled, metrics where location is explicitly stated as “global” or where location information cannot be deduced from GCP labels is collected.
#[serde(rename = "is_global_location_enabled")]
pub is_global_location_enabled: Option<bool>,
/// When 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.
#[serde(rename = "is_per_project_quota_enabled")]
pub is_per_project_quota_enabled: Option<bool>,
Expand All @@ -51,6 +54,9 @@ pub struct GCPSTSServiceAccountAttributes {
#[serde(rename = "monitored_resource_configs")]
pub monitored_resource_configs:
Option<Vec<crate::datadogV2::model::GCPMonitoredResourceConfig>>,
/// Filters to limit metric collection by GCP location, such as region, multi-region, or zone. By default, Datadog collects from all locations.
#[serde(rename = "region_filter_configs")]
pub region_filter_configs: Option<Vec<String>>,
/// When enabled, Datadog scans for all resources in your GCP environment.
#[serde(rename = "resource_collection_enabled")]
pub resource_collection_enabled: Option<bool>,
Expand All @@ -71,11 +77,13 @@ impl GCPSTSServiceAccountAttributes {
cloud_run_revision_filters: None,
host_filters: None,
is_cspm_enabled: None,
is_global_location_enabled: None,
is_per_project_quota_enabled: None,
is_resource_change_collection_enabled: None,
is_security_command_center_enabled: None,
metric_namespace_configs: None,
monitored_resource_configs: None,
region_filter_configs: None,
resource_collection_enabled: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand Down Expand Up @@ -118,6 +126,12 @@ impl GCPSTSServiceAccountAttributes {
self
}

#[allow(deprecated)]
pub fn is_global_location_enabled(mut self, value: bool) -> Self {
self.is_global_location_enabled = Some(value);
self
}

#[allow(deprecated)]
pub fn is_per_project_quota_enabled(mut self, value: bool) -> Self {
self.is_per_project_quota_enabled = Some(value);
Expand Down Expand Up @@ -154,6 +168,12 @@ impl GCPSTSServiceAccountAttributes {
self
}

#[allow(deprecated)]
pub fn region_filter_configs(mut self, value: Vec<String>) -> Self {
self.region_filter_configs = Some(value);
self
}

#[allow(deprecated)]
pub fn resource_collection_enabled(mut self, value: bool) -> Self {
self.resource_collection_enabled = Some(value);
Expand Down Expand Up @@ -198,6 +218,7 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
let mut cloud_run_revision_filters: Option<Vec<String>> = None;
let mut host_filters: Option<Vec<String>> = None;
let mut is_cspm_enabled: Option<bool> = None;
let mut is_global_location_enabled: Option<bool> = None;
let mut is_per_project_quota_enabled: Option<bool> = None;
let mut is_resource_change_collection_enabled: Option<bool> = None;
let mut is_security_command_center_enabled: Option<bool> = None;
Expand All @@ -207,6 +228,7 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
let mut monitored_resource_configs: Option<
Vec<crate::datadogV2::model::GCPMonitoredResourceConfig>,
> = None;
let mut region_filter_configs: Option<Vec<String>> = None;
let mut resource_collection_enabled: Option<bool> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
Expand Down Expand Up @@ -257,6 +279,13 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
is_cspm_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"is_global_location_enabled" => {
if v.is_null() {
continue;
}
is_global_location_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"is_per_project_quota_enabled" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -292,6 +321,13 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
monitored_resource_configs =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"region_filter_configs" => {
if v.is_null() {
continue;
}
region_filter_configs =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"resource_collection_enabled" => {
if v.is_null() {
continue;
Expand All @@ -315,11 +351,13 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
cloud_run_revision_filters,
host_filters,
is_cspm_enabled,
is_global_location_enabled,
is_per_project_quota_enabled,
is_resource_change_collection_enabled,
is_security_command_center_enabled,
metric_namespace_configs,
monitored_resource_configs,
region_filter_configs,
resource_collection_enabled,
additional_properties,
_unparsed,
Expand Down
8 changes: 4 additions & 4 deletions tests/scenarios/features/v2/gcp_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": ["$KEY:$VALUE"], "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "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": ["$KEY:$VALUE"], "is_global_location_enabled": true, "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "region_filter_configs": ["nam4", "europe-north1"]}, "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", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": ["$KEY:$VALUE"], "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "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": ["$KEY:$VALUE"], "is_global_location_enabled": true, "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "region_filter_configs": ["nam4", "europe-north1"]}, "type": "gcp_service_account"}}
When the request is sent
Then the response status is 409 Conflict

Expand Down Expand Up @@ -151,15 +151,15 @@ 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", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": ["$KEY:$VALUE"], "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "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": ["$KEY:$VALUE"], "is_global_location_enabled": true, "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "region_filter_configs": ["nam4", "europe-north1"]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/gcp-integrations
Scenario: Update STS Service Account returns "Not Found" response
Given new "UpdateGCPSTSAccount" request
And request contains "account_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": ["$KEY:$VALUE"], "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "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": ["$KEY:$VALUE"], "is_global_location_enabled": true, "is_per_project_quota_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}, {"filters": ["snapshot.*", "!*_by_region"], "id": "pubsub"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "region_filter_configs": ["nam4", "europe-north1"]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down