Skip to content

Commit 4f97847

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add region_filter_configs and is_global_location_enabled to v2 GCP API (#3497)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8ffdb8c commit 4f97847

3 files changed

Lines changed: 98 additions & 5 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23984,6 +23984,13 @@ components:
2398423984
product for this service account. Note: This requires resource_collection_enabled
2398523985
to be set to true.'
2398623986
type: boolean
23987+
is_global_location_enabled:
23988+
default: true
23989+
description: When enabled, Datadog collects metrics where location is explicitly
23990+
stated as "global" or where location information cannot be deduced from
23991+
GCP labels.
23992+
example: true
23993+
type: boolean
2398723994
is_per_project_quota_enabled:
2398823995
default: false
2398923996
description: When enabled, Datadog applies the `X-Goog-User-Project` header,
@@ -24025,6 +24032,18 @@ components:
2402524032
items:
2402624033
$ref: '#/components/schemas/GCPMonitoredResourceConfig'
2402724034
type: array
24035+
region_filter_configs:
24036+
description: Configurations for GCP location filtering, such as region,
24037+
multi-region, or zone. Only monitored resources that match the specified
24038+
regions are imported into Datadog. By default, Datadog collects from all
24039+
locations.
24040+
example:
24041+
- nam4
24042+
- europe-north1
24043+
items:
24044+
description: Region Filter Configs
24045+
type: string
24046+
type: array
2402824047
resource_collection_enabled:
2402924048
description: When enabled, Datadog scans for all resources in your GCP environment.
2403024049
type: boolean

api/datadogV2/model_gcpsts_service_account_attributes.go

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type GCPSTSServiceAccountAttributes struct {
2828
HostFilters []string `json:"host_filters,omitempty"`
2929
// 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.
3030
IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"`
31+
// When enabled, Datadog collects metrics where location is explicitly stated as "global" or where location information cannot be deduced from GCP labels.
32+
IsGlobalLocationEnabled *bool `json:"is_global_location_enabled,omitempty"`
3133
// 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.
3234
IsPerProjectQuotaEnabled *bool `json:"is_per_project_quota_enabled,omitempty"`
3335
// When enabled, Datadog scans for all resource change data in your Google Cloud environment.
@@ -38,6 +40,8 @@ type GCPSTSServiceAccountAttributes struct {
3840
MetricNamespaceConfigs []GCPMetricNamespaceConfig `json:"metric_namespace_configs,omitempty"`
3941
// Configurations for GCP monitored resources.
4042
MonitoredResourceConfigs []GCPMonitoredResourceConfig `json:"monitored_resource_configs,omitempty"`
43+
// Configurations 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.
44+
RegionFilterConfigs []string `json:"region_filter_configs,omitempty"`
4145
// When enabled, Datadog scans for all resources in your GCP environment.
4246
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
4347
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -51,6 +55,8 @@ type GCPSTSServiceAccountAttributes struct {
5155
// will change when the set of required properties is changed.
5256
func NewGCPSTSServiceAccountAttributes() *GCPSTSServiceAccountAttributes {
5357
this := GCPSTSServiceAccountAttributes{}
58+
var isGlobalLocationEnabled bool = true
59+
this.IsGlobalLocationEnabled = &isGlobalLocationEnabled
5460
var isPerProjectQuotaEnabled bool = false
5561
this.IsPerProjectQuotaEnabled = &isPerProjectQuotaEnabled
5662
var isResourceChangeCollectionEnabled bool = false
@@ -65,6 +71,8 @@ func NewGCPSTSServiceAccountAttributes() *GCPSTSServiceAccountAttributes {
6571
// but it doesn't guarantee that properties required by API are set.
6672
func NewGCPSTSServiceAccountAttributesWithDefaults() *GCPSTSServiceAccountAttributes {
6773
this := GCPSTSServiceAccountAttributes{}
74+
var isGlobalLocationEnabled bool = true
75+
this.IsGlobalLocationEnabled = &isGlobalLocationEnabled
6876
var isPerProjectQuotaEnabled bool = false
6977
this.IsPerProjectQuotaEnabled = &isPerProjectQuotaEnabled
7078
var isResourceChangeCollectionEnabled bool = false
@@ -248,6 +256,34 @@ func (o *GCPSTSServiceAccountAttributes) SetIsCspmEnabled(v bool) {
248256
o.IsCspmEnabled = &v
249257
}
250258

259+
// GetIsGlobalLocationEnabled returns the IsGlobalLocationEnabled field value if set, zero value otherwise.
260+
func (o *GCPSTSServiceAccountAttributes) GetIsGlobalLocationEnabled() bool {
261+
if o == nil || o.IsGlobalLocationEnabled == nil {
262+
var ret bool
263+
return ret
264+
}
265+
return *o.IsGlobalLocationEnabled
266+
}
267+
268+
// GetIsGlobalLocationEnabledOk returns a tuple with the IsGlobalLocationEnabled field value if set, nil otherwise
269+
// and a boolean to check if the value has been set.
270+
func (o *GCPSTSServiceAccountAttributes) GetIsGlobalLocationEnabledOk() (*bool, bool) {
271+
if o == nil || o.IsGlobalLocationEnabled == nil {
272+
return nil, false
273+
}
274+
return o.IsGlobalLocationEnabled, true
275+
}
276+
277+
// HasIsGlobalLocationEnabled returns a boolean if a field has been set.
278+
func (o *GCPSTSServiceAccountAttributes) HasIsGlobalLocationEnabled() bool {
279+
return o != nil && o.IsGlobalLocationEnabled != nil
280+
}
281+
282+
// SetIsGlobalLocationEnabled gets a reference to the given bool and assigns it to the IsGlobalLocationEnabled field.
283+
func (o *GCPSTSServiceAccountAttributes) SetIsGlobalLocationEnabled(v bool) {
284+
o.IsGlobalLocationEnabled = &v
285+
}
286+
251287
// GetIsPerProjectQuotaEnabled returns the IsPerProjectQuotaEnabled field value if set, zero value otherwise.
252288
func (o *GCPSTSServiceAccountAttributes) GetIsPerProjectQuotaEnabled() bool {
253289
if o == nil || o.IsPerProjectQuotaEnabled == nil {
@@ -388,6 +424,34 @@ func (o *GCPSTSServiceAccountAttributes) SetMonitoredResourceConfigs(v []GCPMoni
388424
o.MonitoredResourceConfigs = v
389425
}
390426

427+
// GetRegionFilterConfigs returns the RegionFilterConfigs field value if set, zero value otherwise.
428+
func (o *GCPSTSServiceAccountAttributes) GetRegionFilterConfigs() []string {
429+
if o == nil || o.RegionFilterConfigs == nil {
430+
var ret []string
431+
return ret
432+
}
433+
return o.RegionFilterConfigs
434+
}
435+
436+
// GetRegionFilterConfigsOk returns a tuple with the RegionFilterConfigs field value if set, nil otherwise
437+
// and a boolean to check if the value has been set.
438+
func (o *GCPSTSServiceAccountAttributes) GetRegionFilterConfigsOk() (*[]string, bool) {
439+
if o == nil || o.RegionFilterConfigs == nil {
440+
return nil, false
441+
}
442+
return &o.RegionFilterConfigs, true
443+
}
444+
445+
// HasRegionFilterConfigs returns a boolean if a field has been set.
446+
func (o *GCPSTSServiceAccountAttributes) HasRegionFilterConfigs() bool {
447+
return o != nil && o.RegionFilterConfigs != nil
448+
}
449+
450+
// SetRegionFilterConfigs gets a reference to the given []string and assigns it to the RegionFilterConfigs field.
451+
func (o *GCPSTSServiceAccountAttributes) SetRegionFilterConfigs(v []string) {
452+
o.RegionFilterConfigs = v
453+
}
454+
391455
// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise.
392456
func (o *GCPSTSServiceAccountAttributes) GetResourceCollectionEnabled() bool {
393457
if o == nil || o.ResourceCollectionEnabled == nil {
@@ -440,6 +504,9 @@ func (o GCPSTSServiceAccountAttributes) MarshalJSON() ([]byte, error) {
440504
if o.IsCspmEnabled != nil {
441505
toSerialize["is_cspm_enabled"] = o.IsCspmEnabled
442506
}
507+
if o.IsGlobalLocationEnabled != nil {
508+
toSerialize["is_global_location_enabled"] = o.IsGlobalLocationEnabled
509+
}
443510
if o.IsPerProjectQuotaEnabled != nil {
444511
toSerialize["is_per_project_quota_enabled"] = o.IsPerProjectQuotaEnabled
445512
}
@@ -455,6 +522,9 @@ func (o GCPSTSServiceAccountAttributes) MarshalJSON() ([]byte, error) {
455522
if o.MonitoredResourceConfigs != nil {
456523
toSerialize["monitored_resource_configs"] = o.MonitoredResourceConfigs
457524
}
525+
if o.RegionFilterConfigs != nil {
526+
toSerialize["region_filter_configs"] = o.RegionFilterConfigs
527+
}
458528
if o.ResourceCollectionEnabled != nil {
459529
toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled
460530
}
@@ -474,19 +544,21 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error)
474544
CloudRunRevisionFilters []string `json:"cloud_run_revision_filters,omitempty"`
475545
HostFilters []string `json:"host_filters,omitempty"`
476546
IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"`
547+
IsGlobalLocationEnabled *bool `json:"is_global_location_enabled,omitempty"`
477548
IsPerProjectQuotaEnabled *bool `json:"is_per_project_quota_enabled,omitempty"`
478549
IsResourceChangeCollectionEnabled *bool `json:"is_resource_change_collection_enabled,omitempty"`
479550
IsSecurityCommandCenterEnabled *bool `json:"is_security_command_center_enabled,omitempty"`
480551
MetricNamespaceConfigs []GCPMetricNamespaceConfig `json:"metric_namespace_configs,omitempty"`
481552
MonitoredResourceConfigs []GCPMonitoredResourceConfig `json:"monitored_resource_configs,omitempty"`
553+
RegionFilterConfigs []string `json:"region_filter_configs,omitempty"`
482554
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
483555
}{}
484556
if err = datadog.Unmarshal(bytes, &all); err != nil {
485557
return datadog.Unmarshal(bytes, &o.UnparsedObject)
486558
}
487559
additionalProperties := make(map[string]interface{})
488560
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
489-
datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "automute", "client_email", "cloud_run_revision_filters", "host_filters", "is_cspm_enabled", "is_per_project_quota_enabled", "is_resource_change_collection_enabled", "is_security_command_center_enabled", "metric_namespace_configs", "monitored_resource_configs", "resource_collection_enabled"})
561+
datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "automute", "client_email", "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"})
490562
} else {
491563
return err
492564
}
@@ -496,11 +568,13 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error)
496568
o.CloudRunRevisionFilters = all.CloudRunRevisionFilters
497569
o.HostFilters = all.HostFilters
498570
o.IsCspmEnabled = all.IsCspmEnabled
571+
o.IsGlobalLocationEnabled = all.IsGlobalLocationEnabled
499572
o.IsPerProjectQuotaEnabled = all.IsPerProjectQuotaEnabled
500573
o.IsResourceChangeCollectionEnabled = all.IsResourceChangeCollectionEnabled
501574
o.IsSecurityCommandCenterEnabled = all.IsSecurityCommandCenterEnabled
502575
o.MetricNamespaceConfigs = all.MetricNamespaceConfigs
503576
o.MonitoredResourceConfigs = all.MonitoredResourceConfigs
577+
o.RegionFilterConfigs = all.RegionFilterConfigs
504578
o.ResourceCollectionEnabled = all.ResourceCollectionEnabled
505579

506580
if len(additionalProperties) > 0 {

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": "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"}}
37+
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"}}
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": "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"}}
44+
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"}}
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": "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"}}
154+
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"}}
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": "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"}}
162+
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"}}
163163
When the request is sent
164164
Then the response status is 404 Not Found
165165

0 commit comments

Comments
 (0)