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
76 changes: 75 additions & 1 deletion api/datadogV2/model_gcpsts_service_account_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type GCPSTSServiceAccountAttributes struct {
HostFilters []string `json:"host_filters,omitempty"`
// 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.
IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"`
// When enabled, metrics where location is explicitly stated as “global” or where location information cannot be deduced from GCP labels is collected.
IsGlobalLocationEnabled *bool `json:"is_global_location_enabled,omitempty"`
// 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.
IsPerProjectQuotaEnabled *bool `json:"is_per_project_quota_enabled,omitempty"`
// When enabled, Datadog scans for all resource change data in your Google Cloud environment.
Expand All @@ -38,6 +40,8 @@ type GCPSTSServiceAccountAttributes struct {
MetricNamespaceConfigs []GCPMetricNamespaceConfig `json:"metric_namespace_configs,omitempty"`
// Configurations for GCP monitored resources.
MonitoredResourceConfigs []GCPMonitoredResourceConfig `json:"monitored_resource_configs,omitempty"`
// Filters to limit metric collection by GCP location, such as region, multi-region, or zone. By default, Datadog collects from all locations.
RegionFilterConfigs []string `json:"region_filter_configs,omitempty"`
// When enabled, Datadog scans for all resources in your GCP environment.
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand All @@ -51,6 +55,8 @@ type GCPSTSServiceAccountAttributes struct {
// will change when the set of required properties is changed.
func NewGCPSTSServiceAccountAttributes() *GCPSTSServiceAccountAttributes {
this := GCPSTSServiceAccountAttributes{}
var isGlobalLocationEnabled bool = true
this.IsGlobalLocationEnabled = &isGlobalLocationEnabled
var isPerProjectQuotaEnabled bool = false
this.IsPerProjectQuotaEnabled = &isPerProjectQuotaEnabled
var isResourceChangeCollectionEnabled bool = false
Expand All @@ -65,6 +71,8 @@ func NewGCPSTSServiceAccountAttributes() *GCPSTSServiceAccountAttributes {
// but it doesn't guarantee that properties required by API are set.
func NewGCPSTSServiceAccountAttributesWithDefaults() *GCPSTSServiceAccountAttributes {
this := GCPSTSServiceAccountAttributes{}
var isGlobalLocationEnabled bool = true
this.IsGlobalLocationEnabled = &isGlobalLocationEnabled
var isPerProjectQuotaEnabled bool = false
this.IsPerProjectQuotaEnabled = &isPerProjectQuotaEnabled
var isResourceChangeCollectionEnabled bool = false
Expand Down Expand Up @@ -248,6 +256,34 @@ func (o *GCPSTSServiceAccountAttributes) SetIsCspmEnabled(v bool) {
o.IsCspmEnabled = &v
}

// GetIsGlobalLocationEnabled returns the IsGlobalLocationEnabled field value if set, zero value otherwise.
func (o *GCPSTSServiceAccountAttributes) GetIsGlobalLocationEnabled() bool {
if o == nil || o.IsGlobalLocationEnabled == nil {
var ret bool
return ret
}
return *o.IsGlobalLocationEnabled
}

// GetIsGlobalLocationEnabledOk returns a tuple with the IsGlobalLocationEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GCPSTSServiceAccountAttributes) GetIsGlobalLocationEnabledOk() (*bool, bool) {
if o == nil || o.IsGlobalLocationEnabled == nil {
return nil, false
}
return o.IsGlobalLocationEnabled, true
}

// HasIsGlobalLocationEnabled returns a boolean if a field has been set.
func (o *GCPSTSServiceAccountAttributes) HasIsGlobalLocationEnabled() bool {
return o != nil && o.IsGlobalLocationEnabled != nil
}

// SetIsGlobalLocationEnabled gets a reference to the given bool and assigns it to the IsGlobalLocationEnabled field.
func (o *GCPSTSServiceAccountAttributes) SetIsGlobalLocationEnabled(v bool) {
o.IsGlobalLocationEnabled = &v
}

// GetIsPerProjectQuotaEnabled returns the IsPerProjectQuotaEnabled field value if set, zero value otherwise.
func (o *GCPSTSServiceAccountAttributes) GetIsPerProjectQuotaEnabled() bool {
if o == nil || o.IsPerProjectQuotaEnabled == nil {
Expand Down Expand Up @@ -388,6 +424,34 @@ func (o *GCPSTSServiceAccountAttributes) SetMonitoredResourceConfigs(v []GCPMoni
o.MonitoredResourceConfigs = v
}

// GetRegionFilterConfigs returns the RegionFilterConfigs field value if set, zero value otherwise.
func (o *GCPSTSServiceAccountAttributes) GetRegionFilterConfigs() []string {
if o == nil || o.RegionFilterConfigs == nil {
var ret []string
return ret
}
return o.RegionFilterConfigs
}

// GetRegionFilterConfigsOk returns a tuple with the RegionFilterConfigs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GCPSTSServiceAccountAttributes) GetRegionFilterConfigsOk() (*[]string, bool) {
if o == nil || o.RegionFilterConfigs == nil {
return nil, false
}
return &o.RegionFilterConfigs, true
}

// HasRegionFilterConfigs returns a boolean if a field has been set.
func (o *GCPSTSServiceAccountAttributes) HasRegionFilterConfigs() bool {
return o != nil && o.RegionFilterConfigs != nil
}

// SetRegionFilterConfigs gets a reference to the given []string and assigns it to the RegionFilterConfigs field.
func (o *GCPSTSServiceAccountAttributes) SetRegionFilterConfigs(v []string) {
o.RegionFilterConfigs = v
}

// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise.
func (o *GCPSTSServiceAccountAttributes) GetResourceCollectionEnabled() bool {
if o == nil || o.ResourceCollectionEnabled == nil {
Expand Down Expand Up @@ -440,6 +504,9 @@ func (o GCPSTSServiceAccountAttributes) MarshalJSON() ([]byte, error) {
if o.IsCspmEnabled != nil {
toSerialize["is_cspm_enabled"] = o.IsCspmEnabled
}
if o.IsGlobalLocationEnabled != nil {
toSerialize["is_global_location_enabled"] = o.IsGlobalLocationEnabled
}
if o.IsPerProjectQuotaEnabled != nil {
toSerialize["is_per_project_quota_enabled"] = o.IsPerProjectQuotaEnabled
}
Expand All @@ -455,6 +522,9 @@ func (o GCPSTSServiceAccountAttributes) MarshalJSON() ([]byte, error) {
if o.MonitoredResourceConfigs != nil {
toSerialize["monitored_resource_configs"] = o.MonitoredResourceConfigs
}
if o.RegionFilterConfigs != nil {
toSerialize["region_filter_configs"] = o.RegionFilterConfigs
}
if o.ResourceCollectionEnabled != nil {
toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled
}
Expand All @@ -474,19 +544,21 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error)
CloudRunRevisionFilters []string `json:"cloud_run_revision_filters,omitempty"`
HostFilters []string `json:"host_filters,omitempty"`
IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"`
IsGlobalLocationEnabled *bool `json:"is_global_location_enabled,omitempty"`
IsPerProjectQuotaEnabled *bool `json:"is_per_project_quota_enabled,omitempty"`
IsResourceChangeCollectionEnabled *bool `json:"is_resource_change_collection_enabled,omitempty"`
IsSecurityCommandCenterEnabled *bool `json:"is_security_command_center_enabled,omitempty"`
MetricNamespaceConfigs []GCPMetricNamespaceConfig `json:"metric_namespace_configs,omitempty"`
MonitoredResourceConfigs []GCPMonitoredResourceConfig `json:"monitored_resource_configs,omitempty"`
RegionFilterConfigs []string `json:"region_filter_configs,omitempty"`
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
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"})
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"})
} else {
return err
}
Expand All @@ -496,11 +568,13 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error)
o.CloudRunRevisionFilters = all.CloudRunRevisionFilters
o.HostFilters = all.HostFilters
o.IsCspmEnabled = all.IsCspmEnabled
o.IsGlobalLocationEnabled = all.IsGlobalLocationEnabled
o.IsPerProjectQuotaEnabled = all.IsPerProjectQuotaEnabled
o.IsResourceChangeCollectionEnabled = all.IsResourceChangeCollectionEnabled
o.IsSecurityCommandCenterEnabled = all.IsSecurityCommandCenterEnabled
o.MetricNamespaceConfigs = all.MetricNamespaceConfigs
o.MonitoredResourceConfigs = all.MonitoredResourceConfigs
o.RegionFilterConfigs = all.RegionFilterConfigs
o.ResourceCollectionEnabled = all.ResourceCollectionEnabled

if len(additionalProperties) > 0 {
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