From 31af81032fea951e6121b195598a7be06707d4c8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 10 Sep 2025 16:35:20 +0000 Subject: [PATCH] Regenerate client from commit 401807f of spec repo --- .generator/schemas/v1/openapi.yaml | 65 ++++++- .generator/schemas/v2/openapi.yaml | 62 +++++- .../api/client/v1/model/GCPAccount.java | 64 ++++++- .../v1/model/GCPMonitoredResourceConfig.java | 180 ++++++++++++++++++ .../model/GCPMonitoredResourceConfigType.java | 62 ++++++ .../v2/model/GCPMonitoredResourceConfig.java | 180 ++++++++++++++++++ .../model/GCPMonitoredResourceConfigType.java | 62 ++++++ .../model/GCPSTSServiceAccountAttributes.java | 60 +++++- .../api/client/v1/api/gcp_integration.feature | 6 +- .../api/client/v2/api/gcp_integration.feature | 8 +- 10 files changed, 725 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfig.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfigType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfig.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfigType.java diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0f6baca4241..a1335722ca4 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 c22e5932566..085c5aa51a7 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/src/main/java/com/datadog/api/client/v1/model/GCPAccount.java b/src/main/java/com/datadog/api/client/v1/model/GCPAccount.java index 20b1b4f2bb1..2692c9fe317 100644 --- a/src/main/java/com/datadog/api/client/v1/model/GCPAccount.java +++ b/src/main/java/com/datadog/api/client/v1/model/GCPAccount.java @@ -32,6 +32,7 @@ GCPAccount.JSON_PROPERTY_IS_CSPM_ENABLED, GCPAccount.JSON_PROPERTY_IS_RESOURCE_CHANGE_COLLECTION_ENABLED, GCPAccount.JSON_PROPERTY_IS_SECURITY_COMMAND_CENTER_ENABLED, + GCPAccount.JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS, GCPAccount.JSON_PROPERTY_PRIVATE_KEY, GCPAccount.JSON_PROPERTY_PRIVATE_KEY_ID, GCPAccount.JSON_PROPERTY_PROJECT_ID, @@ -83,6 +84,10 @@ public class GCPAccount { "is_security_command_center_enabled"; private Boolean isSecurityCommandCenterEnabled = false; + public static final String JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS = + "monitored_resource_configs"; + private List monitoredResourceConfigs = null; + public static final String JSON_PROPERTY_PRIVATE_KEY = "private_key"; private String privateKey; @@ -243,11 +248,15 @@ public GCPAccount addCloudRunRevisionFiltersItem(String cloudRunRevisionFiltersI } /** - * 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. + * 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 * * @return cloudRunRevisionFilters + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -255,6 +264,7 @@ public List getCloudRunRevisionFilters() { return cloudRunRevisionFilters; } + @Deprecated public void setCloudRunRevisionFilters(List cloudRunRevisionFilters) { this.cloudRunRevisionFilters = cloudRunRevisionFilters; } @@ -294,11 +304,15 @@ public GCPAccount hostFilters(String hostFilters) { } /** - * 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 * * @return hostFilters + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_HOST_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -306,6 +320,7 @@ public String getHostFilters() { return hostFilters; } + @Deprecated public void setHostFilters(String hostFilters) { this.hostFilters = hostFilters; } @@ -375,6 +390,42 @@ public void setIsSecurityCommandCenterEnabled(Boolean isSecurityCommandCenterEna this.isSecurityCommandCenterEnabled = isSecurityCommandCenterEnabled; } + public GCPAccount monitoredResourceConfigs( + List monitoredResourceConfigs) { + this.monitoredResourceConfigs = monitoredResourceConfigs; + for (GCPMonitoredResourceConfig item : monitoredResourceConfigs) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GCPAccount addMonitoredResourceConfigsItem( + GCPMonitoredResourceConfig monitoredResourceConfigsItem) { + if (this.monitoredResourceConfigs == null) { + this.monitoredResourceConfigs = new ArrayList<>(); + } + this.monitoredResourceConfigs.add(monitoredResourceConfigsItem); + this.unparsed |= monitoredResourceConfigsItem.unparsed; + return this; + } + + /** + * Configurations for GCP monitored resources. + * + * @return monitoredResourceConfigs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getMonitoredResourceConfigs() { + return monitoredResourceConfigs; + } + + public void setMonitoredResourceConfigs( + List monitoredResourceConfigs) { + this.monitoredResourceConfigs = monitoredResourceConfigs; + } + public GCPAccount privateKey(String privateKey) { this.privateKey = privateKey; return this; @@ -571,6 +622,7 @@ public boolean equals(Object o) { this.isResourceChangeCollectionEnabled, gcpAccount.isResourceChangeCollectionEnabled) && Objects.equals( this.isSecurityCommandCenterEnabled, gcpAccount.isSecurityCommandCenterEnabled) + && Objects.equals(this.monitoredResourceConfigs, gcpAccount.monitoredResourceConfigs) && Objects.equals(this.privateKey, gcpAccount.privateKey) && Objects.equals(this.privateKeyId, gcpAccount.privateKeyId) && Objects.equals(this.projectId, gcpAccount.projectId) @@ -595,6 +647,7 @@ public int hashCode() { isCspmEnabled, isResourceChangeCollectionEnabled, isSecurityCommandCenterEnabled, + monitoredResourceConfigs, privateKey, privateKeyId, projectId, @@ -628,6 +681,9 @@ public String toString() { sb.append(" isSecurityCommandCenterEnabled: ") .append(toIndentedString(isSecurityCommandCenterEnabled)) .append("\n"); + sb.append(" monitoredResourceConfigs: ") + .append(toIndentedString(monitoredResourceConfigs)) + .append("\n"); sb.append(" privateKey: ").append(toIndentedString(privateKey)).append("\n"); sb.append(" privateKeyId: ").append(toIndentedString(privateKeyId)).append("\n"); sb.append(" projectId: ").append(toIndentedString(projectId)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfig.java b/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfig.java new file mode 100644 index 00000000000..54846deb679 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfig.java @@ -0,0 +1,180 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 monitored resource. */ +@JsonPropertyOrder({ + GCPMonitoredResourceConfig.JSON_PROPERTY_FILTERS, + GCPMonitoredResourceConfig.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPMonitoredResourceConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FILTERS = "filters"; + private List filters = null; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPMonitoredResourceConfigType type; + + public GCPMonitoredResourceConfig filters(List filters) { + this.filters = filters; + return this; + } + + public GCPMonitoredResourceConfig addFiltersItem(String filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * 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. + * + * @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 GCPMonitoredResourceConfig type(GCPMonitoredResourceConfigType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The GCP monitored resource type. Only a subset of resource types are supported. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPMonitoredResourceConfigType getType() { + return type; + } + + public void setType(GCPMonitoredResourceConfigType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPMonitoredResourceConfig + */ + @JsonAnySetter + public GCPMonitoredResourceConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPMonitoredResourceConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPMonitoredResourceConfig gcpMonitoredResourceConfig = (GCPMonitoredResourceConfig) o; + return Objects.equals(this.filters, gcpMonitoredResourceConfig.filters) + && Objects.equals(this.type, gcpMonitoredResourceConfig.type) + && Objects.equals( + this.additionalProperties, gcpMonitoredResourceConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(filters, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPMonitoredResourceConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfigType.java b/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfigType.java new file mode 100644 index 00000000000..56e8cdb76d7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/GCPMonitoredResourceConfigType.java @@ -0,0 +1,62 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The GCP monitored resource type. Only a subset of resource types are supported. */ +@JsonSerialize( + using = GCPMonitoredResourceConfigType.GCPMonitoredResourceConfigTypeSerializer.class) +public class GCPMonitoredResourceConfigType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("cloud_function", "cloud_run_revision", "gce_instance")); + + public static final GCPMonitoredResourceConfigType CLOUD_FUNCTION = + new GCPMonitoredResourceConfigType("cloud_function"); + public static final GCPMonitoredResourceConfigType CLOUD_RUN_REVISION = + new GCPMonitoredResourceConfigType("cloud_run_revision"); + public static final GCPMonitoredResourceConfigType GCE_INSTANCE = + new GCPMonitoredResourceConfigType("gce_instance"); + + GCPMonitoredResourceConfigType(String value) { + super(value, allowedValues); + } + + public static class GCPMonitoredResourceConfigTypeSerializer + extends StdSerializer { + public GCPMonitoredResourceConfigTypeSerializer(Class t) { + super(t); + } + + public GCPMonitoredResourceConfigTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPMonitoredResourceConfigType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPMonitoredResourceConfigType fromValue(String value) { + return new GCPMonitoredResourceConfigType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfig.java b/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfig.java new file mode 100644 index 00000000000..27f25c29bd8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfig.java @@ -0,0 +1,180 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 monitored resource. */ +@JsonPropertyOrder({ + GCPMonitoredResourceConfig.JSON_PROPERTY_FILTERS, + GCPMonitoredResourceConfig.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GCPMonitoredResourceConfig { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FILTERS = "filters"; + private List filters = null; + + public static final String JSON_PROPERTY_TYPE = "type"; + private GCPMonitoredResourceConfigType type; + + public GCPMonitoredResourceConfig filters(List filters) { + this.filters = filters; + return this; + } + + public GCPMonitoredResourceConfig addFiltersItem(String filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * 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. + * + * @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 GCPMonitoredResourceConfig type(GCPMonitoredResourceConfigType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The GCP monitored resource type. Only a subset of resource types are supported. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GCPMonitoredResourceConfigType getType() { + return type; + } + + public void setType(GCPMonitoredResourceConfigType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GCPMonitoredResourceConfig + */ + @JsonAnySetter + public GCPMonitoredResourceConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GCPMonitoredResourceConfig object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GCPMonitoredResourceConfig gcpMonitoredResourceConfig = (GCPMonitoredResourceConfig) o; + return Objects.equals(this.filters, gcpMonitoredResourceConfig.filters) + && Objects.equals(this.type, gcpMonitoredResourceConfig.type) + && Objects.equals( + this.additionalProperties, gcpMonitoredResourceConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(filters, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GCPMonitoredResourceConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfigType.java b/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfigType.java new file mode 100644 index 00000000000..1a184ce3e87 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GCPMonitoredResourceConfigType.java @@ -0,0 +1,62 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The GCP monitored resource type. Only a subset of resource types are supported. */ +@JsonSerialize( + using = GCPMonitoredResourceConfigType.GCPMonitoredResourceConfigTypeSerializer.class) +public class GCPMonitoredResourceConfigType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("cloud_function", "cloud_run_revision", "gce_instance")); + + public static final GCPMonitoredResourceConfigType CLOUD_FUNCTION = + new GCPMonitoredResourceConfigType("cloud_function"); + public static final GCPMonitoredResourceConfigType CLOUD_RUN_REVISION = + new GCPMonitoredResourceConfigType("cloud_run_revision"); + public static final GCPMonitoredResourceConfigType GCE_INSTANCE = + new GCPMonitoredResourceConfigType("gce_instance"); + + GCPMonitoredResourceConfigType(String value) { + super(value, allowedValues); + } + + public static class GCPMonitoredResourceConfigTypeSerializer + extends StdSerializer { + public GCPMonitoredResourceConfigTypeSerializer(Class t) { + super(t); + } + + public GCPMonitoredResourceConfigTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GCPMonitoredResourceConfigType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GCPMonitoredResourceConfigType fromValue(String value) { + return new GCPMonitoredResourceConfigType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java index 7c659110a70..0604f1629c2 100644 --- a/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/GCPSTSServiceAccountAttributes.java @@ -30,6 +30,7 @@ GCPSTSServiceAccountAttributes.JSON_PROPERTY_IS_RESOURCE_CHANGE_COLLECTION_ENABLED, GCPSTSServiceAccountAttributes.JSON_PROPERTY_IS_SECURITY_COMMAND_CENTER_ENABLED, GCPSTSServiceAccountAttributes.JSON_PROPERTY_METRIC_NAMESPACE_CONFIGS, + GCPSTSServiceAccountAttributes.JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS, GCPSTSServiceAccountAttributes.JSON_PROPERTY_RESOURCE_COLLECTION_ENABLED }) @jakarta.annotation.Generated( @@ -70,6 +71,10 @@ public class GCPSTSServiceAccountAttributes { public static final String JSON_PROPERTY_METRIC_NAMESPACE_CONFIGS = "metric_namespace_configs"; private List metricNamespaceConfigs = null; + public static final String JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS = + "monitored_resource_configs"; + private List monitoredResourceConfigs = null; + public static final String JSON_PROPERTY_RESOURCE_COLLECTION_ENABLED = "resource_collection_enabled"; private Boolean resourceCollectionEnabled; @@ -163,9 +168,13 @@ public GCPSTSServiceAccountAttributes addCloudRunRevisionFiltersItem( /** * 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 * * @return cloudRunRevisionFilters + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_CLOUD_RUN_REVISION_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -173,6 +182,7 @@ public List getCloudRunRevisionFilters() { return cloudRunRevisionFilters; } + @Deprecated public void setCloudRunRevisionFilters(List cloudRunRevisionFilters) { this.cloudRunRevisionFilters = cloudRunRevisionFilters; } @@ -191,10 +201,15 @@ public GCPSTSServiceAccountAttributes addHostFiltersItem(String hostFiltersItem) } /** - * 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 * * @return hostFilters + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_HOST_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -202,6 +217,7 @@ public List getHostFilters() { return hostFilters; } + @Deprecated public void setHostFilters(List hostFilters) { this.hostFilters = hostFilters; } @@ -331,6 +347,42 @@ public void setMetricNamespaceConfigs(List metricNames this.metricNamespaceConfigs = metricNamespaceConfigs; } + public GCPSTSServiceAccountAttributes monitoredResourceConfigs( + List monitoredResourceConfigs) { + this.monitoredResourceConfigs = monitoredResourceConfigs; + for (GCPMonitoredResourceConfig item : monitoredResourceConfigs) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GCPSTSServiceAccountAttributes addMonitoredResourceConfigsItem( + GCPMonitoredResourceConfig monitoredResourceConfigsItem) { + if (this.monitoredResourceConfigs == null) { + this.monitoredResourceConfigs = new ArrayList<>(); + } + this.monitoredResourceConfigs.add(monitoredResourceConfigsItem); + this.unparsed |= monitoredResourceConfigsItem.unparsed; + return this; + } + + /** + * Configurations for GCP monitored resources. + * + * @return monitoredResourceConfigs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONITORED_RESOURCE_CONFIGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getMonitoredResourceConfigs() { + return monitoredResourceConfigs; + } + + public void setMonitoredResourceConfigs( + List monitoredResourceConfigs) { + this.monitoredResourceConfigs = monitoredResourceConfigs; + } + public GCPSTSServiceAccountAttributes resourceCollectionEnabled( Boolean resourceCollectionEnabled) { this.resourceCollectionEnabled = resourceCollectionEnabled; @@ -427,6 +479,8 @@ public boolean equals(Object o) { gcpstsServiceAccountAttributes.isSecurityCommandCenterEnabled) && Objects.equals( this.metricNamespaceConfigs, gcpstsServiceAccountAttributes.metricNamespaceConfigs) + && Objects.equals( + this.monitoredResourceConfigs, gcpstsServiceAccountAttributes.monitoredResourceConfigs) && Objects.equals( this.resourceCollectionEnabled, gcpstsServiceAccountAttributes.resourceCollectionEnabled) @@ -447,6 +501,7 @@ public int hashCode() { isResourceChangeCollectionEnabled, isSecurityCommandCenterEnabled, metricNamespaceConfigs, + monitoredResourceConfigs, resourceCollectionEnabled, additionalProperties); } @@ -475,6 +530,9 @@ public String toString() { sb.append(" metricNamespaceConfigs: ") .append(toIndentedString(metricNamespaceConfigs)) .append("\n"); + sb.append(" monitoredResourceConfigs: ") + .append(toIndentedString(monitoredResourceConfigs)) + .append("\n"); sb.append(" resourceCollectionEnabled: ") .append(toIndentedString(resourceCollectionEnabled)) .append("\n"); diff --git a/src/test/resources/com/datadog/api/client/v1/api/gcp_integration.feature b/src/test/resources/com/datadog/api/client/v1/api/gcp_integration.feature index 33a06d39fe9..5e6bccf3a7c 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/gcp_integration.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/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/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 eecbb4747ec..935adb2d93b 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": [], "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