Skip to content

Commit 8151410

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
datadog_integration_gcp_sts Add Support for IsPerProjectQuotaEnabled for GCP STS Service Accounts (#616)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 23ecfb2 commit 8151410

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-04-17 13:26:14.663007",
8-
"spec_repo_commit": "12ab5180"
7+
"regenerated": "2025-04-22 18:27:59.783493",
8+
"spec_repo_commit": "2b6fa951"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-17 13:26:14.680427",
13-
"spec_repo_commit": "12ab5180"
12+
"regenerated": "2025-04-22 18:27:59.799536",
13+
"spec_repo_commit": "2b6fa951"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14676,6 +14676,13 @@ components:
1467614676
product for this service account. Note: This requires resource_collection_enabled
1467714677
to be set to true.'
1467814678
type: boolean
14679+
is_per_project_quota_enabled:
14680+
default: false
14681+
description: When enabled, Datadog applies the `X-Goog-User-Project` header,
14682+
attributing Google Cloud billing and quota usage to the project being
14683+
monitored rather than the default service account project.
14684+
example: true
14685+
type: boolean
1467914686
is_resource_change_collection_enabled:
1468014687
default: false
1468114688
description: When enabled, Datadog scans for all resource change data in

src/datadogV2/model/model_gcpsts_service_account_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ pub struct GCPSTSServiceAccountAttributes {
3030
/// 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.
3131
#[serde(rename = "is_cspm_enabled")]
3232
pub is_cspm_enabled: Option<bool>,
33+
/// 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.
34+
#[serde(rename = "is_per_project_quota_enabled")]
35+
pub is_per_project_quota_enabled: Option<bool>,
3336
/// When enabled, Datadog scans for all resource change data in your Google Cloud environment.
3437
#[serde(rename = "is_resource_change_collection_enabled")]
3538
pub is_resource_change_collection_enabled: Option<bool>,
@@ -58,6 +61,7 @@ impl GCPSTSServiceAccountAttributes {
5861
cloud_run_revision_filters: None,
5962
host_filters: None,
6063
is_cspm_enabled: None,
64+
is_per_project_quota_enabled: None,
6165
is_resource_change_collection_enabled: None,
6266
is_security_command_center_enabled: None,
6367
metric_namespace_configs: None,
@@ -97,6 +101,11 @@ impl GCPSTSServiceAccountAttributes {
97101
self
98102
}
99103

104+
pub fn is_per_project_quota_enabled(mut self, value: bool) -> Self {
105+
self.is_per_project_quota_enabled = Some(value);
106+
self
107+
}
108+
100109
pub fn is_resource_change_collection_enabled(mut self, value: bool) -> Self {
101110
self.is_resource_change_collection_enabled = Some(value);
102111
self
@@ -158,6 +167,7 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
158167
let mut cloud_run_revision_filters: Option<Vec<String>> = None;
159168
let mut host_filters: Option<Vec<String>> = None;
160169
let mut is_cspm_enabled: Option<bool> = None;
170+
let mut is_per_project_quota_enabled: Option<bool> = None;
161171
let mut is_resource_change_collection_enabled: Option<bool> = None;
162172
let mut is_security_command_center_enabled: Option<bool> = None;
163173
let mut metric_namespace_configs: Option<
@@ -213,6 +223,13 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
213223
is_cspm_enabled =
214224
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
215225
}
226+
"is_per_project_quota_enabled" => {
227+
if v.is_null() {
228+
continue;
229+
}
230+
is_per_project_quota_enabled =
231+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
232+
}
216233
"is_resource_change_collection_enabled" => {
217234
if v.is_null() {
218235
continue;
@@ -256,6 +273,7 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
256273
cloud_run_revision_filters,
257274
host_filters,
258275
is_cspm_enabled,
276+
is_per_project_quota_enabled,
259277
is_resource_change_collection_enabled,
260278
is_security_command_center_enabled,
261279
metric_namespace_configs,

tests/scenarios/features/v2/gcp_integration.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Feature: GCP Integration
3434
@generated @skip @team:DataDog/gcp-integrations
3535
Scenario: Create a new entry for your service account returns "Bad Request" response
3636
Given new "CreateGCPSTSAccount" request
37-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
37+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "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"}]}, "type": "gcp_service_account"}}
3838
When the request is sent
3939
Then the response status is 400 Bad Request
4040

4141
@generated @skip @team:DataDog/gcp-integrations
4242
Scenario: Create a new entry for your service account returns "Conflict" response
4343
Given new "CreateGCPSTSAccount" request
44-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
44+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "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"}]}, "type": "gcp_service_account"}}
4545
When the request is sent
4646
Then the response status is 409 Conflict
4747

@@ -151,15 +151,15 @@ Feature: GCP Integration
151151
Scenario: Update STS Service Account returns "Bad Request" response
152152
Given new "UpdateGCPSTSAccount" request
153153
And request contains "account_id" parameter from "REPLACE.ME"
154-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
154+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "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"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
155155
When the request is sent
156156
Then the response status is 400 Bad Request
157157

158158
@generated @skip @team:DataDog/gcp-integrations
159159
Scenario: Update STS Service Account returns "Not Found" response
160160
Given new "UpdateGCPSTSAccount" request
161161
And request contains "account_id" parameter from "REPLACE.ME"
162-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
162+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "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"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
163163
When the request is sent
164164
Then the response status is 404 Not Found
165165

0 commit comments

Comments
 (0)