diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 364018c47d5..47cd948788a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -20406,9 +20406,20 @@ components: to this GCP metric namespace. example: true type: boolean + filters: + description: When enabled, Datadog applies these additional filters to limit + metric collection. A metric is collected only if it does not match all + exclusion filters and matches at least one allow filter. + example: + - snapshot.* + - '!*_by_region' + items: + description: A metric namespace filter + type: string + type: array id: description: The id of the GCP metric namespace. - example: aiplatform + example: pubsub type: string type: object GCPMonitoredResourceConfig: @@ -20570,6 +20581,10 @@ components: example: - disabled: true id: aiplatform + - filters: + - snapshot.* + - '!*_by_region' + id: pubsub items: $ref: '#/components/schemas/GCPMetricNamespaceConfig' type: array diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPMetricNamespaceConfig.java b/src/main/java/com/datadog/api/client/v2/model/GCPMetricNamespaceConfig.java index 0ed3cfb3b20..9d1c4769c57 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GCPMetricNamespaceConfig.java +++ b/src/main/java/com/datadog/api/client/v2/model/GCPMetricNamespaceConfig.java @@ -12,13 +12,16 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; /** Configuration for a GCP metric namespace. */ @JsonPropertyOrder({ GCPMetricNamespaceConfig.JSON_PROPERTY_DISABLED, + GCPMetricNamespaceConfig.JSON_PROPERTY_FILTERS, GCPMetricNamespaceConfig.JSON_PROPERTY_ID }) @jakarta.annotation.Generated( @@ -28,6 +31,9 @@ public class GCPMetricNamespaceConfig { public static final String JSON_PROPERTY_DISABLED = "disabled"; private Boolean disabled = false; + public static final String JSON_PROPERTY_FILTERS = "filters"; + private List filters = null; + public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -52,6 +58,37 @@ public void setDisabled(Boolean disabled) { this.disabled = disabled; } + public GCPMetricNamespaceConfig filters(List filters) { + this.filters = filters; + return this; + } + + public GCPMetricNamespaceConfig addFiltersItem(String filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * When enabled, Datadog applies these additional filters to limit metric collection. A metric is + * collected only if it does not match all exclusion filters and matches at least one allow + * filter. + * + * @return filters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getFilters() { + return filters; + } + + public void setFilters(List filters) { + this.filters = filters; + } + public GCPMetricNamespaceConfig id(String id) { this.id = id; return this; @@ -130,13 +167,14 @@ public boolean equals(Object o) { } GCPMetricNamespaceConfig gcpMetricNamespaceConfig = (GCPMetricNamespaceConfig) o; return Objects.equals(this.disabled, gcpMetricNamespaceConfig.disabled) + && Objects.equals(this.filters, gcpMetricNamespaceConfig.filters) && Objects.equals(this.id, gcpMetricNamespaceConfig.id) && Objects.equals(this.additionalProperties, gcpMetricNamespaceConfig.additionalProperties); } @Override public int hashCode() { - return Objects.hash(disabled, id, additionalProperties); + return Objects.hash(disabled, filters, id, additionalProperties); } @Override @@ -144,6 +182,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GCPMetricNamespaceConfig {\n"); sb.append(" disabled: ").append(toIndentedString(disabled)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature b/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature index 935adb2d93b..6d47a1508eb 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/gcp_integration.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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": ["$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"}} + 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"}} 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"}], "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_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"}} 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": ["$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"}} + 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"}} 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": ["$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"}} + 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"}} When the request is sent Then the response status is 404 Not Found