From a171d94dd315f263c12a3be877ea08dafafe193d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 9 Jul 2025 08:36:58 +0000 Subject: [PATCH] Regenerate client from commit 7331abb4 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 150 +++++++++ ...reateLogsCustomDestination_1006705740.java | 77 +++++ .../CustomDestinationForwardDestination.java | 105 +++++- ...rdDestinationGoogleSecurityOperations.java | 286 ++++++++++++++++ ...stinationGoogleSecurityOperationsType.java | 67 ++++ ...ogleSecurityOperationsDestinationAuth.java | 309 ++++++++++++++++++ ...SecurityOperationsDestinationAuthType.java | 65 ++++ ...DestinationResponseForwardDestination.java | 114 ++++++- ...rdDestinationGoogleSecurityOperations.java | 294 +++++++++++++++++ ...stinationGoogleSecurityOperationsType.java | 70 ++++ ...ogleSecurityOperationsDestinationAuth.java | 224 +++++++++++++ ...SecurityOperationsDestinationAuthType.java | 67 ++++ ...tom_destination_returns_OK_response.freeze | 1 + ...ustom_destination_returns_OK_response.json | 57 ++++ .../v2/api/logs_custom_destinations.feature | 27 ++ 16 files changed, 1909 insertions(+), 12 deletions(-) create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1006705740.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperations.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperationsType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuth.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuthType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperations.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index cc6c76828e1..b7958a37b26 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-08 19:08:08.429204", - "spec_repo_commit": "7b042e12" + "regenerated": "2025-07-09 08:34:47.001996", + "spec_repo_commit": "7331abb4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-08 19:08:08.445031", - "spec_repo_commit": "7b042e12" + "regenerated": "2025-07-09 08:34:47.017873", + "spec_repo_commit": "7331abb4" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8ab2278d000..d341e158130 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10668,6 +10668,7 @@ components: - $ref: '#/components/schemas/CustomDestinationForwardDestinationSplunk' - $ref: '#/components/schemas/CustomDestinationForwardDestinationElasticsearch' - $ref: '#/components/schemas/CustomDestinationForwardDestinationMicrosoftSentinel' + - $ref: '#/components/schemas/CustomDestinationForwardDestinationGoogleSecurityOperations' CustomDestinationForwardDestinationElasticsearch: description: The Elasticsearch destination. properties: @@ -10725,6 +10726,42 @@ components: type: string x-enum-varnames: - ELASTICSEARCH + CustomDestinationForwardDestinationGoogleSecurityOperations: + description: The Google Security Operations destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationGoogleSecurityOperationsDestinationAuth' + customer_id: + description: The customer ID of the Google Security Operations account. + example: 123-456-7890 + type: string + namespace: + description: The namespace of the Google Security Operations account. + example: google-security-operations-namespace + type: string + regional_endpoint: + description: The `CustomDestinationForwardDestinationGoogleSecurityOperations` + `regional_endpoint`. + example: https://malachiteingestion-pa.googleapis.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationForwardDestinationGoogleSecurityOperationsType' + required: + - type + - customer_id + - regional_endpoint + - namespace + - auth + type: object + CustomDestinationForwardDestinationGoogleSecurityOperationsType: + default: google_security_operations + description: Type of the Google Security Operations destination. + enum: + - google_security_operations + example: google_security_operations + type: string + x-enum-varnames: + - GOOGLE_SECURITY_OPERATIONS CustomDestinationForwardDestinationHttp: description: The HTTP destination. properties: @@ -10826,6 +10863,55 @@ components: type: string x-enum-varnames: - SPLUNK_HEC + CustomDestinationGoogleSecurityOperationsDestinationAuth: + description: Google Security Operations destination authentication. + properties: + client_email: + description: The Google Security Operations client email. + example: client@example.com + type: string + client_id: + description: The Google Security Operations client ID. This field is not + returned by the API. + example: def123456 + type: string + writeOnly: true + private_key: + description: The Google Security Operations private key. This field is not + returned by the API. + example: '-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBK...\n-----END + PRIVATE KEY-----\n' + type: string + writeOnly: true + private_key_id: + description: The Google Security Operations private key ID. This field is + not returned by the API. + example: abc12345678 + type: string + writeOnly: true + project_id: + description: Google Security Operations project ID. + example: gcp-project + type: string + type: + $ref: '#/components/schemas/CustomDestinationGoogleSecurityOperationsDestinationAuthType' + required: + - type + - project_id + - private_key_id + - client_email + - client_id + - private_key + type: object + CustomDestinationGoogleSecurityOperationsDestinationAuthType: + default: gcp_private_key + description: Type of the Google Security Operations destination authentication. + enum: + - gcp_private_key + example: gcp_private_key + type: string + x-enum-varnames: + - GCP_PRIVATE_KEY CustomDestinationHttpDestinationAuth: description: Authentication method of the HTTP requests. oneOf: @@ -10971,6 +11057,7 @@ components: - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationSplunk' - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationElasticsearch' - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationMicrosoftSentinel' + - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationGoogleSecurityOperations' CustomDestinationResponseForwardDestinationElasticsearch: description: The Elasticsearch destination. properties: @@ -11028,6 +11115,42 @@ components: type: string x-enum-varnames: - ELASTICSEARCH + CustomDestinationResponseForwardDestinationGoogleSecurityOperations: + description: The Google Security Operations destination. + properties: + auth: + $ref: '#/components/schemas/CustomDestinationResponseGoogleSecurityOperationsDestinationAuth' + customer_id: + description: The customer ID of the Google Security Operations account. + example: 123-456-7890 + type: string + namespace: + description: The namespace of the Google Security Operations account. + example: google-security-operations-namespace + type: string + regional_endpoint: + description: The `CustomDestinationResponseForwardDestinationGoogleSecurityOperations` + `regional_endpoint`. + example: https://malachiteingestion-pa.googleapis.com + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType' + required: + - type + - customer_id + - regional_endpoint + - namespace + - auth + type: object + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType: + default: google_security_operations + description: Type of the Google Security Operations destination. + enum: + - google_security_operations + example: google_security_operations + type: string + x-enum-varnames: + - GOOGLE_SECURITY_OPERATIONS CustomDestinationResponseForwardDestinationHttp: description: The HTTP destination. properties: @@ -11122,6 +11245,33 @@ components: type: string x-enum-varnames: - SPLUNK_HEC + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth: + description: Google Security Operations destination authentication. + properties: + client_email: + description: The Google Security Operations client email. + example: client@example.com + type: string + project_id: + description: Google Security Operations project ID. + example: gcp-project + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType' + required: + - type + - project_id + - client_email + type: object + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType: + default: gcp_private_key + description: Type of the Google Security Operations destination authentication. + enum: + - gcp_private_key + example: gcp_private_key + type: string + x-enum-varnames: + - GCP_PRIVATE_KEY CustomDestinationResponseHttpDestinationAuth: description: Authentication method of the HTTP requests. oneOf: diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1006705740.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1006705740.java new file mode 100644 index 00000000000..49d3c454a6e --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1006705740.java @@ -0,0 +1,77 @@ +// Create a Google Security Operations custom destination returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationAttributeTagsRestrictionListType; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequest; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestDefinition; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationGoogleSecurityOperations; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationGoogleSecurityOperationsType; +import com.datadog.api.client.v2.model.CustomDestinationGoogleSecurityOperationsDestinationAuth; +import com.datadog.api.client.v2.model.CustomDestinationGoogleSecurityOperationsDestinationAuthType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + CustomDestinationCreateRequest body = + new CustomDestinationCreateRequest() + .data( + new CustomDestinationCreateRequestDefinition() + .attributes( + new CustomDestinationCreateRequestAttributes() + .enabled(false) + .forwardTags(false) + .forwardTagsRestrictionList(Arrays.asList("datacenter", "host")) + .forwardTagsRestrictionListType( + CustomDestinationAttributeTagsRestrictionListType.ALLOW_LIST) + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationGoogleSecurityOperations() + .type( + CustomDestinationForwardDestinationGoogleSecurityOperationsType + .GOOGLE_SECURITY_OPERATIONS) + .customerId("123-456-7890") + .regionalEndpoint( + "https://malachiteingestion-pa.googleapis.com") + .namespace("google-security-operations-namespace") + .auth( + new CustomDestinationGoogleSecurityOperationsDestinationAuth() + .type( + CustomDestinationGoogleSecurityOperationsDestinationAuthType + .GCP_PRIVATE_KEY) + .projectId("gcp-project") + .privateKeyId("abc12345678") + .clientEmail("client@example.com") + .clientId("def123456") + .privateKey( + """ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBK... +-----END PRIVATE KEY----- + +""")))) + .name("Nginx logs") + .query("source:nginx")) + .type(CustomDestinationType.CUSTOM_DESTINATION)); + + try { + CustomDestinationResponse result = apiInstance.createLogsCustomDestination(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#createLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestination.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestination.java index 8e27cfd1d58..2042f79ce2a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestination.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestination.java @@ -296,6 +296,69 @@ public CustomDestinationForwardDestination deserialize( e); } + // deserialize CustomDestinationForwardDestinationGoogleSecurityOperations + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals(Integer.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals(Long.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals(Float.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Double.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Boolean.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Integer.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Float.class) + || CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CustomDestinationForwardDestinationGoogleSecurityOperations.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(CustomDestinationForwardDestinationGoogleSecurityOperations.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CustomDestinationForwardDestinationGoogleSecurityOperations) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'CustomDestinationForwardDestinationGoogleSecurityOperations'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'CustomDestinationForwardDestinationGoogleSecurityOperations'", + e); + } + CustomDestinationForwardDestination ret = new CustomDestinationForwardDestination(); if (match == 1) { ret.setActualInstance(deserialized); @@ -347,6 +410,12 @@ public CustomDestinationForwardDestination( setActualInstance(o); } + public CustomDestinationForwardDestination( + CustomDestinationForwardDestinationGoogleSecurityOperations o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "CustomDestinationForwardDestinationHttp", @@ -360,6 +429,9 @@ public CustomDestinationForwardDestination( schemas.put( "CustomDestinationForwardDestinationMicrosoftSentinel", new GenericType() {}); + schemas.put( + "CustomDestinationForwardDestinationGoogleSecurityOperations", + new GenericType() {}); JSON.registerDescendants( CustomDestinationForwardDestination.class, Collections.unmodifiableMap(schemas)); } @@ -373,7 +445,8 @@ public Map getSchemas() { * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: CustomDestinationForwardDestinationHttp, * CustomDestinationForwardDestinationSplunk, CustomDestinationForwardDestinationElasticsearch, - * CustomDestinationForwardDestinationMicrosoftSentinel + * CustomDestinationForwardDestinationMicrosoftSentinel, + * CustomDestinationForwardDestinationGoogleSecurityOperations * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -404,6 +477,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + CustomDestinationForwardDestinationGoogleSecurityOperations.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -413,18 +493,21 @@ public void setActualInstance(Object instance) { "Invalid instance type. Must be CustomDestinationForwardDestinationHttp," + " CustomDestinationForwardDestinationSplunk," + " CustomDestinationForwardDestinationElasticsearch," - + " CustomDestinationForwardDestinationMicrosoftSentinel"); + + " CustomDestinationForwardDestinationMicrosoftSentinel," + + " CustomDestinationForwardDestinationGoogleSecurityOperations"); } /** * Get the actual instance, which can be the following: CustomDestinationForwardDestinationHttp, * CustomDestinationForwardDestinationSplunk, CustomDestinationForwardDestinationElasticsearch, - * CustomDestinationForwardDestinationMicrosoftSentinel + * CustomDestinationForwardDestinationMicrosoftSentinel, + * CustomDestinationForwardDestinationGoogleSecurityOperations * * @return The actual instance (CustomDestinationForwardDestinationHttp, * CustomDestinationForwardDestinationSplunk, * CustomDestinationForwardDestinationElasticsearch, - * CustomDestinationForwardDestinationMicrosoftSentinel) + * CustomDestinationForwardDestinationMicrosoftSentinel, + * CustomDestinationForwardDestinationGoogleSecurityOperations) */ @Override public Object getActualInstance() { @@ -482,4 +565,18 @@ public CustomDestinationForwardDestinationSplunk getCustomDestinationForwardDest getCustomDestinationForwardDestinationMicrosoftSentinel() throws ClassCastException { return (CustomDestinationForwardDestinationMicrosoftSentinel) super.getActualInstance(); } + + /** + * Get the actual instance of `CustomDestinationForwardDestinationGoogleSecurityOperations`. If + * the actual instance is not `CustomDestinationForwardDestinationGoogleSecurityOperations`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `CustomDestinationForwardDestinationGoogleSecurityOperations` + * @throws ClassCastException if the instance is not + * `CustomDestinationForwardDestinationGoogleSecurityOperations` + */ + public CustomDestinationForwardDestinationGoogleSecurityOperations + getCustomDestinationForwardDestinationGoogleSecurityOperations() throws ClassCastException { + return (CustomDestinationForwardDestinationGoogleSecurityOperations) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperations.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperations.java new file mode 100644 index 00000000000..6dab8811fb6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperations.java @@ -0,0 +1,286 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The Google Security Operations destination. */ +@JsonPropertyOrder({ + CustomDestinationForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_AUTH, + CustomDestinationForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_CUSTOMER_ID, + CustomDestinationForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_NAMESPACE, + CustomDestinationForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_REGIONAL_ENDPOINT, + CustomDestinationForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationForwardDestinationGoogleSecurityOperations { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH = "auth"; + private CustomDestinationGoogleSecurityOperationsDestinationAuth auth; + + public static final String JSON_PROPERTY_CUSTOMER_ID = "customer_id"; + private String customerId; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + private String namespace; + + public static final String JSON_PROPERTY_REGIONAL_ENDPOINT = "regional_endpoint"; + private String regionalEndpoint; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationForwardDestinationGoogleSecurityOperationsType type = + CustomDestinationForwardDestinationGoogleSecurityOperationsType.GOOGLE_SECURITY_OPERATIONS; + + public CustomDestinationForwardDestinationGoogleSecurityOperations() {} + + @JsonCreator + public CustomDestinationForwardDestinationGoogleSecurityOperations( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH) + CustomDestinationGoogleSecurityOperationsDestinationAuth auth, + @JsonProperty(required = true, value = JSON_PROPERTY_CUSTOMER_ID) String customerId, + @JsonProperty(required = true, value = JSON_PROPERTY_NAMESPACE) String namespace, + @JsonProperty(required = true, value = JSON_PROPERTY_REGIONAL_ENDPOINT) + String regionalEndpoint, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationForwardDestinationGoogleSecurityOperationsType type) { + this.auth = auth; + this.unparsed |= auth.unparsed; + this.customerId = customerId; + this.namespace = namespace; + this.regionalEndpoint = regionalEndpoint; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationForwardDestinationGoogleSecurityOperations auth( + CustomDestinationGoogleSecurityOperationsDestinationAuth auth) { + this.auth = auth; + this.unparsed |= auth.unparsed; + return this; + } + + /** + * Google Security Operations destination authentication. + * + * @return auth + */ + @JsonProperty(JSON_PROPERTY_AUTH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationGoogleSecurityOperationsDestinationAuth getAuth() { + return auth; + } + + public void setAuth(CustomDestinationGoogleSecurityOperationsDestinationAuth auth) { + this.auth = auth; + } + + public CustomDestinationForwardDestinationGoogleSecurityOperations customerId(String customerId) { + this.customerId = customerId; + return this; + } + + /** + * The customer ID of the Google Security Operations account. + * + * @return customerId + */ + @JsonProperty(JSON_PROPERTY_CUSTOMER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public CustomDestinationForwardDestinationGoogleSecurityOperations namespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The namespace of the Google Security Operations account. + * + * @return namespace + */ + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getNamespace() { + return namespace; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + public CustomDestinationForwardDestinationGoogleSecurityOperations regionalEndpoint( + String regionalEndpoint) { + this.regionalEndpoint = regionalEndpoint; + return this; + } + + /** + * The CustomDestinationForwardDestinationGoogleSecurityOperations + * regional_endpoint. + * + * @return regionalEndpoint + */ + @JsonProperty(JSON_PROPERTY_REGIONAL_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRegionalEndpoint() { + return regionalEndpoint; + } + + public void setRegionalEndpoint(String regionalEndpoint) { + this.regionalEndpoint = regionalEndpoint; + } + + public CustomDestinationForwardDestinationGoogleSecurityOperations type( + CustomDestinationForwardDestinationGoogleSecurityOperationsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Google Security Operations destination. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationForwardDestinationGoogleSecurityOperationsType getType() { + return type; + } + + public void setType(CustomDestinationForwardDestinationGoogleSecurityOperationsType 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 CustomDestinationForwardDestinationGoogleSecurityOperations + */ + @JsonAnySetter + public CustomDestinationForwardDestinationGoogleSecurityOperations 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 CustomDestinationForwardDestinationGoogleSecurityOperations object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationForwardDestinationGoogleSecurityOperations + customDestinationForwardDestinationGoogleSecurityOperations = + (CustomDestinationForwardDestinationGoogleSecurityOperations) o; + return Objects.equals( + this.auth, customDestinationForwardDestinationGoogleSecurityOperations.auth) + && Objects.equals( + this.customerId, customDestinationForwardDestinationGoogleSecurityOperations.customerId) + && Objects.equals( + this.namespace, customDestinationForwardDestinationGoogleSecurityOperations.namespace) + && Objects.equals( + this.regionalEndpoint, + customDestinationForwardDestinationGoogleSecurityOperations.regionalEndpoint) + && Objects.equals( + this.type, customDestinationForwardDestinationGoogleSecurityOperations.type) + && Objects.equals( + this.additionalProperties, + customDestinationForwardDestinationGoogleSecurityOperations.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(auth, customerId, namespace, regionalEndpoint, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationForwardDestinationGoogleSecurityOperations {\n"); + sb.append(" auth: ").append(toIndentedString(auth)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" regionalEndpoint: ").append(toIndentedString(regionalEndpoint)).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/CustomDestinationForwardDestinationGoogleSecurityOperationsType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperationsType.java new file mode 100644 index 00000000000..2df883ff583 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationGoogleSecurityOperationsType.java @@ -0,0 +1,67 @@ +/* + * 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; + +/** Type of the Google Security Operations destination. */ +@JsonSerialize( + using = + CustomDestinationForwardDestinationGoogleSecurityOperationsType + .CustomDestinationForwardDestinationGoogleSecurityOperationsTypeSerializer.class) +public class CustomDestinationForwardDestinationGoogleSecurityOperationsType + extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("google_security_operations")); + + public static final CustomDestinationForwardDestinationGoogleSecurityOperationsType + GOOGLE_SECURITY_OPERATIONS = + new CustomDestinationForwardDestinationGoogleSecurityOperationsType( + "google_security_operations"); + + CustomDestinationForwardDestinationGoogleSecurityOperationsType(String value) { + super(value, allowedValues); + } + + public static class CustomDestinationForwardDestinationGoogleSecurityOperationsTypeSerializer + extends StdSerializer { + public CustomDestinationForwardDestinationGoogleSecurityOperationsTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationForwardDestinationGoogleSecurityOperationsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationForwardDestinationGoogleSecurityOperationsType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationForwardDestinationGoogleSecurityOperationsType fromValue( + String value) { + return new CustomDestinationForwardDestinationGoogleSecurityOperationsType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuth.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuth.java new file mode 100644 index 00000000000..83a4220e24d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuth.java @@ -0,0 +1,309 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Google Security Operations destination authentication. */ +@JsonPropertyOrder({ + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_CLIENT_EMAIL, + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_CLIENT_ID, + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_PRIVATE_KEY, + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_PRIVATE_KEY_ID, + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_PROJECT_ID, + CustomDestinationGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationGoogleSecurityOperationsDestinationAuth { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_EMAIL = "client_email"; + private String clientEmail; + + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_PRIVATE_KEY = "private_key"; + private String privateKey; + + public static final String JSON_PROPERTY_PRIVATE_KEY_ID = "private_key_id"; + private String privateKeyId; + + public static final String JSON_PROPERTY_PROJECT_ID = "project_id"; + private String projectId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationGoogleSecurityOperationsDestinationAuthType type = + CustomDestinationGoogleSecurityOperationsDestinationAuthType.GCP_PRIVATE_KEY; + + public CustomDestinationGoogleSecurityOperationsDestinationAuth() {} + + @JsonCreator + public CustomDestinationGoogleSecurityOperationsDestinationAuth( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_EMAIL) String clientEmail, + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_ID) String clientId, + @JsonProperty(required = true, value = JSON_PROPERTY_PRIVATE_KEY) String privateKey, + @JsonProperty(required = true, value = JSON_PROPERTY_PRIVATE_KEY_ID) String privateKeyId, + @JsonProperty(required = true, value = JSON_PROPERTY_PROJECT_ID) String projectId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationGoogleSecurityOperationsDestinationAuthType type) { + this.clientEmail = clientEmail; + this.clientId = clientId; + this.privateKey = privateKey; + this.privateKeyId = privateKeyId; + this.projectId = projectId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth clientEmail(String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * The Google Security Operations client email. + * + * @return clientEmail + */ + @JsonProperty(JSON_PROPERTY_CLIENT_EMAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientEmail() { + return clientEmail; + } + + public void setClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * The Google Security Operations client ID. This field is not returned by the API. + * + * @return clientId + */ + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth privateKey(String privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * The Google Security Operations private key. This field is not returned by the API. + * + * @return privateKey + */ + @JsonProperty(JSON_PROPERTY_PRIVATE_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth privateKeyId( + String privateKeyId) { + this.privateKeyId = privateKeyId; + return this; + } + + /** + * The Google Security Operations private key ID. This field is not returned by the API. + * + * @return privateKeyId + */ + @JsonProperty(JSON_PROPERTY_PRIVATE_KEY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPrivateKeyId() { + return privateKeyId; + } + + public void setPrivateKeyId(String privateKeyId) { + this.privateKeyId = privateKeyId; + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Google Security Operations project ID. + * + * @return projectId + */ + @JsonProperty(JSON_PROPERTY_PROJECT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuth type( + CustomDestinationGoogleSecurityOperationsDestinationAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Google Security Operations destination authentication. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationGoogleSecurityOperationsDestinationAuthType getType() { + return type; + } + + public void setType(CustomDestinationGoogleSecurityOperationsDestinationAuthType 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 CustomDestinationGoogleSecurityOperationsDestinationAuth + */ + @JsonAnySetter + public CustomDestinationGoogleSecurityOperationsDestinationAuth 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 CustomDestinationGoogleSecurityOperationsDestinationAuth object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationGoogleSecurityOperationsDestinationAuth + customDestinationGoogleSecurityOperationsDestinationAuth = + (CustomDestinationGoogleSecurityOperationsDestinationAuth) o; + return Objects.equals( + this.clientEmail, customDestinationGoogleSecurityOperationsDestinationAuth.clientEmail) + && Objects.equals( + this.clientId, customDestinationGoogleSecurityOperationsDestinationAuth.clientId) + && Objects.equals( + this.privateKey, customDestinationGoogleSecurityOperationsDestinationAuth.privateKey) + && Objects.equals( + this.privateKeyId, + customDestinationGoogleSecurityOperationsDestinationAuth.privateKeyId) + && Objects.equals( + this.projectId, customDestinationGoogleSecurityOperationsDestinationAuth.projectId) + && Objects.equals(this.type, customDestinationGoogleSecurityOperationsDestinationAuth.type) + && Objects.equals( + this.additionalProperties, + customDestinationGoogleSecurityOperationsDestinationAuth.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + clientEmail, clientId, privateKey, privateKeyId, projectId, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationGoogleSecurityOperationsDestinationAuth {\n"); + sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).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"); + 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/CustomDestinationGoogleSecurityOperationsDestinationAuthType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuthType.java new file mode 100644 index 00000000000..6db4b508ab8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationGoogleSecurityOperationsDestinationAuthType.java @@ -0,0 +1,65 @@ +/* + * 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; + +/** Type of the Google Security Operations destination authentication. */ +@JsonSerialize( + using = + CustomDestinationGoogleSecurityOperationsDestinationAuthType + .CustomDestinationGoogleSecurityOperationsDestinationAuthTypeSerializer.class) +public class CustomDestinationGoogleSecurityOperationsDestinationAuthType + extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_private_key")); + + public static final CustomDestinationGoogleSecurityOperationsDestinationAuthType GCP_PRIVATE_KEY = + new CustomDestinationGoogleSecurityOperationsDestinationAuthType("gcp_private_key"); + + CustomDestinationGoogleSecurityOperationsDestinationAuthType(String value) { + super(value, allowedValues); + } + + public static class CustomDestinationGoogleSecurityOperationsDestinationAuthTypeSerializer + extends StdSerializer { + public CustomDestinationGoogleSecurityOperationsDestinationAuthTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationGoogleSecurityOperationsDestinationAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationGoogleSecurityOperationsDestinationAuthType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationGoogleSecurityOperationsDestinationAuthType fromValue( + String value) { + return new CustomDestinationGoogleSecurityOperationsDestinationAuthType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestination.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestination.java index fc09b20168f..2cebf30fd4c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestination.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestination.java @@ -320,6 +320,74 @@ public CustomDestinationResponseForwardDestination deserialize( e); } + // deserialize CustomDestinationResponseForwardDestinationGoogleSecurityOperations + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Integer.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Long.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Float.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Double.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Boolean.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Integer.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class + .equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Float.class) + || CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class + .equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs( + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CustomDestinationResponseForwardDestinationGoogleSecurityOperations) tmp) + .unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'CustomDestinationResponseForwardDestinationGoogleSecurityOperations'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'CustomDestinationResponseForwardDestinationGoogleSecurityOperations'", + e); + } + CustomDestinationResponseForwardDestination ret = new CustomDestinationResponseForwardDestination(); if (match == 1) { @@ -375,6 +443,12 @@ public CustomDestinationResponseForwardDestination( setActualInstance(o); } + public CustomDestinationResponseForwardDestination( + CustomDestinationResponseForwardDestinationGoogleSecurityOperations o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "CustomDestinationResponseForwardDestinationHttp", @@ -388,6 +462,9 @@ public CustomDestinationResponseForwardDestination( schemas.put( "CustomDestinationResponseForwardDestinationMicrosoftSentinel", new GenericType() {}); + schemas.put( + "CustomDestinationResponseForwardDestinationGoogleSecurityOperations", + new GenericType() {}); JSON.registerDescendants( CustomDestinationResponseForwardDestination.class, Collections.unmodifiableMap(schemas)); } @@ -402,7 +479,8 @@ public Map getSchemas() { * against the oneOf child schemas: CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, * CustomDestinationResponseForwardDestinationElasticsearch, - * CustomDestinationResponseForwardDestinationMicrosoftSentinel + * CustomDestinationResponseForwardDestinationMicrosoftSentinel, + * CustomDestinationResponseForwardDestinationGoogleSecurityOperations * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -435,6 +513,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -444,7 +529,8 @@ public void setActualInstance(Object instance) { "Invalid instance type. Must be CustomDestinationResponseForwardDestinationHttp," + " CustomDestinationResponseForwardDestinationSplunk," + " CustomDestinationResponseForwardDestinationElasticsearch," - + " CustomDestinationResponseForwardDestinationMicrosoftSentinel"); + + " CustomDestinationResponseForwardDestinationMicrosoftSentinel," + + " CustomDestinationResponseForwardDestinationGoogleSecurityOperations"); } /** @@ -452,12 +538,14 @@ public void setActualInstance(Object instance) { * CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, * CustomDestinationResponseForwardDestinationElasticsearch, - * CustomDestinationResponseForwardDestinationMicrosoftSentinel + * CustomDestinationResponseForwardDestinationMicrosoftSentinel, + * CustomDestinationResponseForwardDestinationGoogleSecurityOperations * * @return The actual instance (CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, * CustomDestinationResponseForwardDestinationElasticsearch, - * CustomDestinationResponseForwardDestinationMicrosoftSentinel) + * CustomDestinationResponseForwardDestinationMicrosoftSentinel, + * CustomDestinationResponseForwardDestinationGoogleSecurityOperations) */ @Override public Object getActualInstance() { @@ -519,4 +607,22 @@ public Object getActualInstance() { getCustomDestinationResponseForwardDestinationMicrosoftSentinel() throws ClassCastException { return (CustomDestinationResponseForwardDestinationMicrosoftSentinel) super.getActualInstance(); } + + /** + * Get the actual instance of + * `CustomDestinationResponseForwardDestinationGoogleSecurityOperations`. If the actual instance + * is not `CustomDestinationResponseForwardDestinationGoogleSecurityOperations`, the + * ClassCastException will be thrown. + * + * @return The actual instance of + * `CustomDestinationResponseForwardDestinationGoogleSecurityOperations` + * @throws ClassCastException if the instance is not + * `CustomDestinationResponseForwardDestinationGoogleSecurityOperations` + */ + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations + getCustomDestinationResponseForwardDestinationGoogleSecurityOperations() + throws ClassCastException { + return (CustomDestinationResponseForwardDestinationGoogleSecurityOperations) + super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperations.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperations.java new file mode 100644 index 00000000000..1eb1074010f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperations.java @@ -0,0 +1,294 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The Google Security Operations destination. */ +@JsonPropertyOrder({ + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_AUTH, + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_CUSTOMER_ID, + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_NAMESPACE, + CustomDestinationResponseForwardDestinationGoogleSecurityOperations + .JSON_PROPERTY_REGIONAL_ENDPOINT, + CustomDestinationResponseForwardDestinationGoogleSecurityOperations.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH = "auth"; + private CustomDestinationResponseGoogleSecurityOperationsDestinationAuth auth; + + public static final String JSON_PROPERTY_CUSTOMER_ID = "customer_id"; + private String customerId; + + public static final String JSON_PROPERTY_NAMESPACE = "namespace"; + private String namespace; + + public static final String JSON_PROPERTY_REGIONAL_ENDPOINT = "regional_endpoint"; + private String regionalEndpoint; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType type = + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType + .GOOGLE_SECURITY_OPERATIONS; + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations() {} + + @JsonCreator + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH) + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth auth, + @JsonProperty(required = true, value = JSON_PROPERTY_CUSTOMER_ID) String customerId, + @JsonProperty(required = true, value = JSON_PROPERTY_NAMESPACE) String namespace, + @JsonProperty(required = true, value = JSON_PROPERTY_REGIONAL_ENDPOINT) + String regionalEndpoint, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType type) { + this.auth = auth; + this.unparsed |= auth.unparsed; + this.customerId = customerId; + this.namespace = namespace; + this.regionalEndpoint = regionalEndpoint; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations auth( + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth auth) { + this.auth = auth; + this.unparsed |= auth.unparsed; + return this; + } + + /** + * Google Security Operations destination authentication. + * + * @return auth + */ + @JsonProperty(JSON_PROPERTY_AUTH) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth getAuth() { + return auth; + } + + public void setAuth(CustomDestinationResponseGoogleSecurityOperationsDestinationAuth auth) { + this.auth = auth; + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations customerId( + String customerId) { + this.customerId = customerId; + return this; + } + + /** + * The customer ID of the Google Security Operations account. + * + * @return customerId + */ + @JsonProperty(JSON_PROPERTY_CUSTOMER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations namespace( + String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The namespace of the Google Security Operations account. + * + * @return namespace + */ + @JsonProperty(JSON_PROPERTY_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getNamespace() { + return namespace; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations regionalEndpoint( + String regionalEndpoint) { + this.regionalEndpoint = regionalEndpoint; + return this; + } + + /** + * The CustomDestinationResponseForwardDestinationGoogleSecurityOperations + * regional_endpoint. + * + * @return regionalEndpoint + */ + @JsonProperty(JSON_PROPERTY_REGIONAL_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRegionalEndpoint() { + return regionalEndpoint; + } + + public void setRegionalEndpoint(String regionalEndpoint) { + this.regionalEndpoint = regionalEndpoint; + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations type( + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Google Security Operations destination. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType getType() { + return type; + } + + public void setType( + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType 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 CustomDestinationResponseForwardDestinationGoogleSecurityOperations + */ + @JsonAnySetter + public CustomDestinationResponseForwardDestinationGoogleSecurityOperations 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 CustomDestinationResponseForwardDestinationGoogleSecurityOperations object + * is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationResponseForwardDestinationGoogleSecurityOperations + customDestinationResponseForwardDestinationGoogleSecurityOperations = + (CustomDestinationResponseForwardDestinationGoogleSecurityOperations) o; + return Objects.equals( + this.auth, customDestinationResponseForwardDestinationGoogleSecurityOperations.auth) + && Objects.equals( + this.customerId, + customDestinationResponseForwardDestinationGoogleSecurityOperations.customerId) + && Objects.equals( + this.namespace, + customDestinationResponseForwardDestinationGoogleSecurityOperations.namespace) + && Objects.equals( + this.regionalEndpoint, + customDestinationResponseForwardDestinationGoogleSecurityOperations.regionalEndpoint) + && Objects.equals( + this.type, customDestinationResponseForwardDestinationGoogleSecurityOperations.type) + && Objects.equals( + this.additionalProperties, + customDestinationResponseForwardDestinationGoogleSecurityOperations + .additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(auth, customerId, namespace, regionalEndpoint, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationResponseForwardDestinationGoogleSecurityOperations {\n"); + sb.append(" auth: ").append(toIndentedString(auth)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" regionalEndpoint: ").append(toIndentedString(regionalEndpoint)).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/CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType.java new file mode 100644 index 00000000000..04fce016f50 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType.java @@ -0,0 +1,70 @@ +/* + * 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; + +/** Type of the Google Security Operations destination. */ +@JsonSerialize( + using = + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType + .CustomDestinationResponseForwardDestinationGoogleSecurityOperationsTypeSerializer + .class) +public class CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType + extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("google_security_operations")); + + public static final CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType + GOOGLE_SECURITY_OPERATIONS = + new CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType( + "google_security_operations"); + + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType(String value) { + super(value, allowedValues); + } + + public static + class CustomDestinationResponseForwardDestinationGoogleSecurityOperationsTypeSerializer + extends StdSerializer< + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType> { + public CustomDestinationResponseForwardDestinationGoogleSecurityOperationsTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationResponseForwardDestinationGoogleSecurityOperationsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType fromValue( + String value) { + return new CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.java new file mode 100644 index 00000000000..56220ffa2a5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.java @@ -0,0 +1,224 @@ +/* + * 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.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Google Security Operations destination authentication. */ +@JsonPropertyOrder({ + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_CLIENT_EMAIL, + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_PROJECT_ID, + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_EMAIL = "client_email"; + private String clientEmail; + + public static final String JSON_PROPERTY_PROJECT_ID = "project_id"; + private String projectId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType type = + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType.GCP_PRIVATE_KEY; + + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth() {} + + @JsonCreator + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_EMAIL) String clientEmail, + @JsonProperty(required = true, value = JSON_PROPERTY_PROJECT_ID) String projectId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType type) { + this.clientEmail = clientEmail; + this.projectId = projectId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth clientEmail( + String clientEmail) { + this.clientEmail = clientEmail; + return this; + } + + /** + * The Google Security Operations client email. + * + * @return clientEmail + */ + @JsonProperty(JSON_PROPERTY_CLIENT_EMAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientEmail() { + return clientEmail; + } + + public void setClientEmail(String clientEmail) { + this.clientEmail = clientEmail; + } + + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth projectId( + String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Google Security Operations project ID. + * + * @return projectId + */ + @JsonProperty(JSON_PROPERTY_PROJECT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth type( + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Google Security Operations destination authentication. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType getType() { + return type; + } + + public void setType(CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType 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 CustomDestinationResponseGoogleSecurityOperationsDestinationAuth + */ + @JsonAnySetter + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuth 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 CustomDestinationResponseGoogleSecurityOperationsDestinationAuth object is + * equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth + customDestinationResponseGoogleSecurityOperationsDestinationAuth = + (CustomDestinationResponseGoogleSecurityOperationsDestinationAuth) o; + return Objects.equals( + this.clientEmail, + customDestinationResponseGoogleSecurityOperationsDestinationAuth.clientEmail) + && Objects.equals( + this.projectId, + customDestinationResponseGoogleSecurityOperationsDestinationAuth.projectId) + && Objects.equals( + this.type, customDestinationResponseGoogleSecurityOperationsDestinationAuth.type) + && Objects.equals( + this.additionalProperties, + customDestinationResponseGoogleSecurityOperationsDestinationAuth.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(clientEmail, projectId, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationResponseGoogleSecurityOperationsDestinationAuth {\n"); + sb.append(" clientEmail: ").append(toIndentedString(clientEmail)).append("\n"); + sb.append(" projectId: ").append(toIndentedString(projectId)).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/CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType.java new file mode 100644 index 00000000000..fa6e9f4534d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType.java @@ -0,0 +1,67 @@ +/* + * 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; + +/** Type of the Google Security Operations destination authentication. */ +@JsonSerialize( + using = + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType + .CustomDestinationResponseGoogleSecurityOperationsDestinationAuthTypeSerializer.class) +public class CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType + extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("gcp_private_key")); + + public static final CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType + GCP_PRIVATE_KEY = + new CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType( + "gcp_private_key"); + + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType(String value) { + super(value, allowedValues); + } + + public static class CustomDestinationResponseGoogleSecurityOperationsDestinationAuthTypeSerializer + extends StdSerializer { + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuthTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationResponseGoogleSecurityOperationsDestinationAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType fromValue( + String value) { + return new CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.freeze new file mode 100644 index 00000000000..b8d60d06595 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-07-09T08:26:14.805Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.json new file mode 100644 index 00000000000..347121b6d6c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Google_Security_Operations_custom_destination_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forward_tags_restriction_list\":[\"datacenter\",\"host\"],\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forwarder_destination\":{\"auth\":{\"client_email\":\"client@example.com\",\"client_id\":\"def123456\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBK...\\n-----END PRIVATE KEY-----\\n\",\"private_key_id\":\"abc12345678\",\"project_id\":\"gcp-project\",\"type\":\"gcp_private_key\"},\"customer_id\":\"123-456-7890\",\"namespace\":\"google-security-operations-namespace\",\"regional_endpoint\":\"https://malachiteingestion-pa.googleapis.com\",\"type\":\"google_security_operations\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"363586eb-0e4c-45c6-ba95-5afaddead03f\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"customer_id\":\"123-456-7890\",\"regional_endpoint\":\"https://malachiteingestion-pa.googleapis.com\",\"namespace\":\"google-security-operations-namespace\",\"auth\":{\"project_id\":\"gcp-project\",\"client_email\":\"client@example.com\",\"type\":\"gcp_private_key\"},\"type\":\"google_security_operations\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[\"datacenter\",\"host\"],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1db6a6ab-99d9-d8ab-9eb0-880014ac1ce1" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/363586eb-0e4c-45c6-ba95-5afaddead03f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b3574495-65ea-2dc8-baf4-1959bbb48471" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature b/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature index 44b85404852..d56c94570d2 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature @@ -57,6 +57,33 @@ Feature: Logs Custom Destinations And the response "data.attributes.forward_tags_restriction_list" array contains value "host" And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Create a Google Security Operations custom destination returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forward_tags_restriction_list": ["datacenter", "host"], "forward_tags_restriction_list_type": "ALLOW_LIST", "forwarder_destination": {"type": "google_security_operations", "customer_id": "123-456-7890", "regional_endpoint": "https://malachiteingestion-pa.googleapis.com", "namespace": "google-security-operations-namespace", "auth": {"type": "gcp_private_key", "project_id": "gcp-project", "private_key_id": "abc12345678", "client_email": "client@example.com", "client_id": "def123456", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBK...\n-----END PRIVATE KEY-----\n"}}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Nginx logs" + And the response "data.attributes.query" is equal to "source:nginx" + And the response "data.attributes.forwarder_destination.type" is equal to "google_security_operations" + And the response "data.attributes.forwarder_destination.customer_id" is equal to "123-456-7890" + And the response "data.attributes.forwarder_destination.regional_endpoint" is equal to "https://malachiteingestion-pa.googleapis.com" + And the response "data.attributes.forwarder_destination.namespace" is equal to "google-security-operations-namespace" + And the response "data.attributes.forwarder_destination.auth.type" is equal to "gcp_private_key" + And the response "data.attributes.forwarder_destination.auth.project_id" is equal to "gcp-project" + And the response "data.attributes.forwarder_destination.auth.client_email" is equal to "client@example.com" + And the response "data.attributes.forwarder_destination.auth" does not have field "private_key" + And the response "data.attributes.forwarder_destination.auth" does not have field "private_key_id" + And the response "data.attributes.forwarder_destination.auth" does not have field "client_id" + And the response "data.attributes.enabled" is false + And the response "data.attributes.forward_tags" is false + And the response "data.attributes.forward_tags_restriction_list" has length 2 + And the response "data.attributes.forward_tags_restriction_list" array contains value "datacenter" + And the response "data.attributes.forward_tags_restriction_list" array contains value "host" + And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + @team:DataDog/logs-backend @team:DataDog/logs-forwarding Scenario: Create a Microsoft Sentinel custom destination returns "OK" response Given new "CreateLogsCustomDestination" request