diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0f6baca4241b..a1335722ca47 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -3288,15 +3288,19 @@ components: example: https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL type: string cloud_run_revision_filters: - description: 'Limit the Cloud Run revisions that are pulled into Datadog - by using tags. + deprecated: true + description: '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.' + imported into Datadog. + + **Note:** This field is deprecated. Instead, use `monitored_resource_configs` + with `type=cloud_run_revision`' example: - $KEY:$VALUE items: - description: Cloud Run Filters + description: Cloud Run revision filters type: string type: array errors: @@ -3309,11 +3313,16 @@ components: type: string type: array host_filters: - description: 'Limit the GCE instances that are pulled into Datadog by using - tags. + deprecated: true + description: 'A comma-separated list of filters to limit the VM instances + that are pulled into Datadog by using tags. - Only hosts that match one of the defined tags are imported into Datadog.' - example: key:value,filter:example + 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`' + example: $KEY1:$VALUE1,$KEY2:$VALUE2 type: string is_cspm_enabled: description: 'When enabled, Datadog will activate the Cloud Security Monitoring @@ -3334,6 +3343,15 @@ components: account.' example: true type: boolean + monitored_resource_configs: + description: Configurations for GCP monitored resources. + example: + - filters: + - $KEY:$VALUE + type: gce_instance + items: + $ref: '#/components/schemas/GCPMonitoredResourceConfig' + type: array private_key: description: Your private key name found in your JSON service account key. example: private_key @@ -3366,6 +3384,37 @@ components: items: $ref: '#/components/schemas/GCPAccount' type: array + GCPMonitoredResourceConfig: + description: Configuration for a GCP monitored resource. + properties: + filters: + description: 'List 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.' + example: + - $KEY:$VALUE + items: + description: A monitored resource filter + type: string + type: array + type: + $ref: '#/components/schemas/GCPMonitoredResourceConfigType' + type: object + GCPMonitoredResourceConfigType: + description: The GCP monitored resource type. Only a subset of resource types + are supported. + enum: + - cloud_function + - cloud_run_revision + - gce_instance + example: gce_instance + type: string + x-enum-varnames: + - CLOUD_FUNCTION + - CLOUD_RUN_REVISION + - GCE_INSTANCE GeomapWidgetDefinition: description: This visualization displays a series of values by country on a world map. diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c22e59325667..085c5aa51a75 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17694,6 +17694,37 @@ components: example: aiplatform type: string type: object + GCPMonitoredResourceConfig: + description: Configuration for a GCP monitored resource. + properties: + filters: + description: 'List 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.' + example: + - $KEY:$VALUE + items: + description: A monitored resource filter + type: string + type: array + type: + $ref: '#/components/schemas/GCPMonitoredResourceConfigType' + type: object + GCPMonitoredResourceConfigType: + description: The GCP monitored resource type. Only a subset of resource types + are supported. + enum: + - cloud_function + - cloud_run_revision + - gce_instance + example: gce_instance + type: string + x-enum-varnames: + - CLOUD_FUNCTION + - CLOUD_RUN_REVISION + - GCE_INSTANCE GCPSTSDelegateAccount: description: Datadog principal service account info. properties: @@ -17761,21 +17792,35 @@ components: example: datadog-service-account@test-project.iam.gserviceaccount.com type: string cloud_run_revision_filters: + deprecated: true description: '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.' + imported into Datadog. + + **Note:** This field is deprecated. Instead, use `monitored_resource_configs` + with `type=cloud_run_revision`' example: - $KEY:$VALUE items: - description: Cloud Run Filters + description: Cloud Run revision filters type: string type: array host_filters: - description: Your Host Filters. + deprecated: true + description: '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`' + example: + - $KEY:$VALUE items: - description: Host Filters + description: VM instance filters type: string type: array is_cspm_enabled: @@ -17811,6 +17856,15 @@ components: items: $ref: '#/components/schemas/GCPMetricNamespaceConfig' type: array + monitored_resource_configs: + description: Configurations for GCP monitored resources. + example: + - filters: + - $KEY:$VALUE + type: gce_instance + items: + $ref: '#/components/schemas/GCPMonitoredResourceConfig' + type: array resource_collection_enabled: description: When enabled, Datadog scans for all resources in your GCP environment. type: boolean diff --git a/features/v1/gcp_integration.feature b/features/v1/gcp_integration.feature index 33a06d39fe92..5e6bccf3a7ce 100644 --- a/features/v1/gcp_integration.feature +++ b/features/v1/gcp_integration.feature @@ -13,7 +13,7 @@ Feature: GCP Integration @generated @skip @team:DataDog/gcp-integrations Scenario: Create a GCP integration returns "Bad Request" response Given new "CreateGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "$KEY1:$VALUE1,$KEY2:$VALUE2", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request @@ -27,7 +27,7 @@ Feature: GCP Integration @generated @skip @team:DataDog/gcp-integrations Scenario: Delete a GCP integration returns "Bad Request" response Given new "DeleteGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "$KEY1:$VALUE1,$KEY2:$VALUE2", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request @@ -62,7 +62,7 @@ Feature: GCP Integration @generated @skip @team:DataDog/gcp-integrations Scenario: Update a GCP integration returns "Bad Request" response Given new "UpdateGCPIntegration" request - And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "key:value,filter:example", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} + And body with value {"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "api-dev@datadog-sandbox.iam.gserviceaccount.com", "client_id": "123456712345671234567", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL", "cloud_run_revision_filters": ["$KEY:$VALUE"], "errors": ["*"], "host_filters": "$KEY1:$VALUE1,$KEY2:$VALUE2", "is_cspm_enabled": true, "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}], "private_key": "private_key", "private_key_id": "123456789abcdefghi123456789abcdefghijklm", "project_id": "datadog-apitest", "resource_collection_enabled": true, "token_uri": "https://accounts.google.com/o/oauth2/token", "type": "service_account"} When the request is sent Then the response status is 400 Bad Request diff --git a/features/v2/gcp_integration.feature b/features/v2/gcp_integration.feature index eecbb4747ec5..935adb2d93bf 100644 --- a/features/v2/gcp_integration.feature +++ b/features/v2/gcp_integration.feature @@ -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": [], "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"}} + 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"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "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": [], "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"}} + 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"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "type": "gcp_service_account"}} When the request is sent Then the response status is 409 Conflict @@ -151,7 +151,7 @@ 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": [], "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"}} + 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"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} When the request is sent Then the response status is 400 Bad Request @@ -159,7 +159,7 @@ Feature: GCP Integration 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": [], "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"}} + 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"}], "monitored_resource_configs": [{"filters": ["$KEY:$VALUE"], "type": "gce_instance"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}} When the request is sent Then the response status is 404 Not Found diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bfa46ed1d75b..34c7bfa4ff17 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -154,6 +154,8 @@ def overrides "v1.funnel_widget_definition_type" => "FunnelWidgetDefinitionType", "v1.funnel_widget_request" => "FunnelWidgetRequest", "v1.gcp_account" => "GCPAccount", + "v1.gcp_monitored_resource_config" => "GCPMonitoredResourceConfig", + "v1.gcp_monitored_resource_config_type" => "GCPMonitoredResourceConfigType", "v1.geomap_widget_definition" => "GeomapWidgetDefinition", "v1.geomap_widget_definition_style" => "GeomapWidgetDefinitionStyle", "v1.geomap_widget_definition_type" => "GeomapWidgetDefinitionType", @@ -1993,6 +1995,8 @@ def overrides "v2.gcp_integration_type" => "GCPIntegrationType", "v2.gcp_integration_update" => "GCPIntegrationUpdate", "v2.gcp_metric_namespace_config" => "GCPMetricNamespaceConfig", + "v2.gcp_monitored_resource_config" => "GCPMonitoredResourceConfig", + "v2.gcp_monitored_resource_config_type" => "GCPMonitoredResourceConfigType", "v2.gcp_service_account" => "GCPServiceAccount", "v2.gcp_service_account_credential_type" => "GCPServiceAccountCredentialType", "v2.gcp_service_account_meta" => "GCPServiceAccountMeta", diff --git a/lib/datadog_api_client/v1/models/gcp_account.rb b/lib/datadog_api_client/v1/models/gcp_account.rb index 5c0d2a04fa04..c423b8256b6f 100644 --- a/lib/datadog_api_client/v1/models/gcp_account.rb +++ b/lib/datadog_api_client/v1/models/gcp_account.rb @@ -40,15 +40,17 @@ class GCPAccount # where `$CLIENT_EMAIL` is the email found in your JSON service account key. attr_accessor :client_x509_cert_url - # Limit the Cloud Run revisions that are pulled into Datadog by using tags. + # 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` attr_accessor :cloud_run_revision_filters # An array of errors. attr_accessor :errors - # Limit the GCE instances that are pulled into Datadog by using tags. - # Only hosts that match one of the defined tags are imported into Datadog. + # A comma-separated 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` attr_accessor :host_filters # 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. @@ -60,6 +62,9 @@ class GCPAccount # When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account. attr_accessor :is_security_command_center_enabled + # Configurations for GCP monitored resources. + attr_accessor :monitored_resource_configs + # Your private key name found in your JSON service account key. attr_accessor :private_key @@ -96,6 +101,7 @@ def self.attribute_map :'is_cspm_enabled' => :'is_cspm_enabled', :'is_resource_change_collection_enabled' => :'is_resource_change_collection_enabled', :'is_security_command_center_enabled' => :'is_security_command_center_enabled', + :'monitored_resource_configs' => :'monitored_resource_configs', :'private_key' => :'private_key', :'private_key_id' => :'private_key_id', :'project_id' => :'project_id', @@ -121,6 +127,7 @@ def self.openapi_types :'is_cspm_enabled' => :'Boolean', :'is_resource_change_collection_enabled' => :'Boolean', :'is_security_command_center_enabled' => :'Boolean', + :'monitored_resource_configs' => :'Array', :'private_key' => :'String', :'private_key_id' => :'String', :'project_id' => :'String', @@ -200,6 +207,12 @@ def initialize(attributes = {}) self.is_security_command_center_enabled = attributes[:'is_security_command_center_enabled'] end + if attributes.key?(:'monitored_resource_configs') + if (value = attributes[:'monitored_resource_configs']).is_a?(Array) + self.monitored_resource_configs = value + end + end + if attributes.key?(:'private_key') self.private_key = attributes[:'private_key'] end @@ -263,6 +276,7 @@ def ==(o) is_cspm_enabled == o.is_cspm_enabled && is_resource_change_collection_enabled == o.is_resource_change_collection_enabled && is_security_command_center_enabled == o.is_security_command_center_enabled && + monitored_resource_configs == o.monitored_resource_configs && private_key == o.private_key && private_key_id == o.private_key_id && project_id == o.project_id && @@ -276,7 +290,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [auth_provider_x509_cert_url, auth_uri, automute, client_email, client_id, client_x509_cert_url, cloud_run_revision_filters, errors, host_filters, is_cspm_enabled, is_resource_change_collection_enabled, is_security_command_center_enabled, private_key, private_key_id, project_id, resource_collection_enabled, token_uri, type, additional_properties].hash + [auth_provider_x509_cert_url, auth_uri, automute, client_email, client_id, client_x509_cert_url, cloud_run_revision_filters, errors, host_filters, is_cspm_enabled, is_resource_change_collection_enabled, is_security_command_center_enabled, monitored_resource_configs, private_key, private_key_id, project_id, resource_collection_enabled, token_uri, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/gcp_monitored_resource_config.rb b/lib/datadog_api_client/v1/models/gcp_monitored_resource_config.rb new file mode 100644 index 000000000000..e0118357919d --- /dev/null +++ b/lib/datadog_api_client/v1/models/gcp_monitored_resource_config.rb @@ -0,0 +1,118 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Configuration for a GCP monitored resource. + class GCPMonitoredResourceConfig + include BaseGenericModel + + # List 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. + attr_accessor :filters + + # The GCP monitored resource type. Only a subset of resource types are supported. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filters' => :'filters', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filters' => :'Array', + :'type' => :'GCPMonitoredResourceConfigType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::GCPMonitoredResourceConfig` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'filters') + if (value = attributes[:'filters']).is_a?(Array) + self.filters = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filters == o.filters && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filters, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/gcp_monitored_resource_config_type.rb b/lib/datadog_api_client/v1/models/gcp_monitored_resource_config_type.rb new file mode 100644 index 000000000000..2a87f597608b --- /dev/null +++ b/lib/datadog_api_client/v1/models/gcp_monitored_resource_config_type.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # The GCP monitored resource type. Only a subset of resource types are supported. + class GCPMonitoredResourceConfigType + include BaseEnumModel + + CLOUD_FUNCTION = "cloud_function".freeze + CLOUD_RUN_REVISION = "cloud_run_revision".freeze + GCE_INSTANCE = "gce_instance".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/gcp_monitored_resource_config.rb b/lib/datadog_api_client/v2/models/gcp_monitored_resource_config.rb new file mode 100644 index 000000000000..d1f3952a4c3a --- /dev/null +++ b/lib/datadog_api_client/v2/models/gcp_monitored_resource_config.rb @@ -0,0 +1,118 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Configuration for a GCP monitored resource. + class GCPMonitoredResourceConfig + include BaseGenericModel + + # List 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. + attr_accessor :filters + + # The GCP monitored resource type. Only a subset of resource types are supported. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filters' => :'filters', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filters' => :'Array', + :'type' => :'GCPMonitoredResourceConfigType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GCPMonitoredResourceConfig` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'filters') + if (value = attributes[:'filters']).is_a?(Array) + self.filters = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filters == o.filters && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filters, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/gcp_monitored_resource_config_type.rb b/lib/datadog_api_client/v2/models/gcp_monitored_resource_config_type.rb new file mode 100644 index 000000000000..8cde20dd3819 --- /dev/null +++ b/lib/datadog_api_client/v2/models/gcp_monitored_resource_config_type.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The GCP monitored resource type. Only a subset of resource types are supported. + class GCPMonitoredResourceConfigType + include BaseEnumModel + + CLOUD_FUNCTION = "cloud_function".freeze + CLOUD_RUN_REVISION = "cloud_run_revision".freeze + GCE_INSTANCE = "gce_instance".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb b/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb index 6b0c62534692..f35f2baf5f2f 100644 --- a/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb +++ b/lib/datadog_api_client/v2/models/gcpsts_service_account_attributes.rb @@ -32,9 +32,12 @@ class GCPSTSServiceAccountAttributes # 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` attr_accessor :cloud_run_revision_filters - # Your Host Filters. + # 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` attr_accessor :host_filters # 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. @@ -52,6 +55,9 @@ class GCPSTSServiceAccountAttributes # Configurations for GCP metric namespaces. attr_accessor :metric_namespace_configs + # Configurations for GCP monitored resources. + attr_accessor :monitored_resource_configs + # When enabled, Datadog scans for all resources in your GCP environment. attr_accessor :resource_collection_enabled @@ -71,6 +77,7 @@ def self.attribute_map :'is_resource_change_collection_enabled' => :'is_resource_change_collection_enabled', :'is_security_command_center_enabled' => :'is_security_command_center_enabled', :'metric_namespace_configs' => :'metric_namespace_configs', + :'monitored_resource_configs' => :'monitored_resource_configs', :'resource_collection_enabled' => :'resource_collection_enabled' } end @@ -89,6 +96,7 @@ def self.openapi_types :'is_resource_change_collection_enabled' => :'Boolean', :'is_security_command_center_enabled' => :'Boolean', :'metric_namespace_configs' => :'Array', + :'monitored_resource_configs' => :'Array', :'resource_collection_enabled' => :'Boolean' } end @@ -159,6 +167,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'monitored_resource_configs') + if (value = attributes[:'monitored_resource_configs']).is_a?(Array) + self.monitored_resource_configs = value + end + end + if attributes.key?(:'resource_collection_enabled') self.resource_collection_enabled = attributes[:'resource_collection_enabled'] end @@ -200,6 +214,7 @@ def ==(o) is_resource_change_collection_enabled == o.is_resource_change_collection_enabled && is_security_command_center_enabled == o.is_security_command_center_enabled && metric_namespace_configs == o.metric_namespace_configs && + monitored_resource_configs == o.monitored_resource_configs && resource_collection_enabled == o.resource_collection_enabled && additional_properties == o.additional_properties end @@ -208,7 +223,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [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, resource_collection_enabled, additional_properties].hash + [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, additional_properties].hash end end end