From 986a894482f7e0f23802b85d6ee71ec17004832e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 23 Jun 2025 13:28:55 +0000 Subject: [PATCH] Regenerate client from commit 2e491415 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 88 +++++ ...reateLogsCustomDestination_1735989579.java | 62 ++++ .../CustomDestinationForwardDestination.java | 97 +++++- ...onForwardDestinationMicrosoftSentinel.java | 322 +++++++++++++++++ ...rwardDestinationMicrosoftSentinelType.java | 63 ++++ ...DestinationResponseForwardDestination.java | 106 +++++- ...seForwardDestinationMicrosoftSentinel.java | 328 ++++++++++++++++++ ...rwardDestinationMicrosoftSentinelType.java | 67 ++++ ...tom_destination_returns_OK_response.freeze | 1 + ...ustom_destination_returns_OK_response.json | 57 +++ .../v2/api/logs_custom_destinations.feature | 23 ++ 12 files changed, 1210 insertions(+), 12 deletions(-) create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1735989579.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinel.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinelType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinel.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinelType.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index b02705659b6..332d462af8d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 07:59:26.325614", - "spec_repo_commit": "74866a53" + "regenerated": "2025-06-23 13:26:53.019562", + "spec_repo_commit": "2e491415" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 07:59:26.342135", - "spec_repo_commit": "74866a53" + "regenerated": "2025-06-23 13:26:53.036893", + "spec_repo_commit": "2e491415" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 97971096fa2..4c7b28f483c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10590,6 +10590,7 @@ components: - $ref: '#/components/schemas/CustomDestinationForwardDestinationHttp' - $ref: '#/components/schemas/CustomDestinationForwardDestinationSplunk' - $ref: '#/components/schemas/CustomDestinationForwardDestinationElasticsearch' + - $ref: '#/components/schemas/CustomDestinationForwardDestinationMicrosoftSentinel' CustomDestinationForwardDestinationElasticsearch: description: The Elasticsearch destination. properties: @@ -10674,6 +10675,49 @@ components: type: string x-enum-varnames: - HTTP + CustomDestinationForwardDestinationMicrosoftSentinel: + description: The Microsoft Sentinel destination. + properties: + client_id: + description: Client ID from the Datadog Azure integration. + example: 9a2f4d83-2b5e-429e-a35a-2b3c4182db71 + type: string + data_collection_endpoint: + description: Azure data collection endpoint. + example: https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com + type: string + data_collection_rule_id: + description: Azure data collection rule ID. + example: dcr-000a00a000a00000a000000aa000a0aa + type: string + stream_name: + description: Azure stream name. + example: Custom-MyTable + type: string + writeOnly: true + tenant_id: + description: Tenant ID from the Datadog Azure integration. + example: f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2 + type: string + type: + $ref: '#/components/schemas/CustomDestinationForwardDestinationMicrosoftSentinelType' + required: + - type + - tenant_id + - client_id + - data_collection_endpoint + - data_collection_rule_id + - stream_name + type: object + CustomDestinationForwardDestinationMicrosoftSentinelType: + default: microsoft_sentinel + description: Type of the Microsoft Sentinel destination. + enum: + - microsoft_sentinel + example: microsoft_sentinel + type: string + x-enum-varnames: + - MICROSOFT_SENTINEL CustomDestinationForwardDestinationSplunk: description: The Splunk HTTP Event Collector (HEC) destination. properties: @@ -10849,6 +10893,7 @@ components: - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationHttp' - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationSplunk' - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationElasticsearch' + - $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationMicrosoftSentinel' CustomDestinationResponseForwardDestinationElasticsearch: description: The Elasticsearch destination. properties: @@ -10933,6 +10978,49 @@ components: type: string x-enum-varnames: - HTTP + CustomDestinationResponseForwardDestinationMicrosoftSentinel: + description: The Microsoft Sentinel destination. + properties: + client_id: + description: Client ID from the Datadog Azure integration. + example: 9a2f4d83-2b5e-429e-a35a-2b3c4182db71 + type: string + data_collection_endpoint: + description: Azure data collection endpoint. + example: https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com + type: string + data_collection_rule_id: + description: Azure data collection rule ID. + example: dcr-000a00a000a00000a000000aa000a0aa + type: string + stream_name: + description: Azure stream name. + example: Custom-MyTable + type: string + writeOnly: true + tenant_id: + description: Tenant ID from the Datadog Azure integration. + example: f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2 + type: string + type: + $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationMicrosoftSentinelType' + required: + - type + - tenant_id + - client_id + - data_collection_endpoint + - data_collection_rule_id + - stream_name + type: object + CustomDestinationResponseForwardDestinationMicrosoftSentinelType: + default: microsoft_sentinel + description: Type of the Microsoft Sentinel destination. + enum: + - microsoft_sentinel + example: microsoft_sentinel + type: string + x-enum-varnames: + - MICROSOFT_SENTINEL CustomDestinationResponseForwardDestinationSplunk: description: The Splunk HTTP Event Collector (HEC) destination. properties: diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1735989579.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1735989579.java new file mode 100644 index 00000000000..58ccdc779c8 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1735989579.java @@ -0,0 +1,62 @@ +// Create a Microsoft Sentinel 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.CustomDestinationForwardDestinationMicrosoftSentinel; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationMicrosoftSentinelType; +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 CustomDestinationForwardDestinationMicrosoftSentinel() + .type( + CustomDestinationForwardDestinationMicrosoftSentinelType + .MICROSOFT_SENTINEL) + .tenantId("f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2") + .clientId("9a2f4d83-2b5e-429e-a35a-2b3c4182db71") + .dataCollectionEndpoint( + "https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com") + .dataCollectionRuleId( + "dcr-000a00a000a00000a000000aa000a0aa") + .streamName("Custom-MyTable"))) + .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 2f7f30e14c0..8e27cfd1d58 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 @@ -241,6 +241,61 @@ public CustomDestinationForwardDestination deserialize( e); } + // deserialize CustomDestinationForwardDestinationMicrosoftSentinel + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Integer.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Long.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Float.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Double.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Boolean.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Integer.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Float.class) + || CustomDestinationForwardDestinationMicrosoftSentinel.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CustomDestinationForwardDestinationMicrosoftSentinel.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(CustomDestinationForwardDestinationMicrosoftSentinel.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 (!((CustomDestinationForwardDestinationMicrosoftSentinel) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'CustomDestinationForwardDestinationMicrosoftSentinel'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'CustomDestinationForwardDestinationMicrosoftSentinel'", + e); + } + CustomDestinationForwardDestination ret = new CustomDestinationForwardDestination(); if (match == 1) { ret.setActualInstance(deserialized); @@ -286,6 +341,12 @@ public CustomDestinationForwardDestination(CustomDestinationForwardDestinationEl setActualInstance(o); } + public CustomDestinationForwardDestination( + CustomDestinationForwardDestinationMicrosoftSentinel o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "CustomDestinationForwardDestinationHttp", @@ -296,6 +357,9 @@ public CustomDestinationForwardDestination(CustomDestinationForwardDestinationEl schemas.put( "CustomDestinationForwardDestinationElasticsearch", new GenericType() {}); + schemas.put( + "CustomDestinationForwardDestinationMicrosoftSentinel", + new GenericType() {}); JSON.registerDescendants( CustomDestinationForwardDestination.class, Collections.unmodifiableMap(schemas)); } @@ -308,7 +372,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 + * CustomDestinationForwardDestinationSplunk, CustomDestinationForwardDestinationElasticsearch, + * CustomDestinationForwardDestinationMicrosoftSentinel * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -332,6 +397,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + CustomDestinationForwardDestinationMicrosoftSentinel.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -340,16 +412,19 @@ public void setActualInstance(Object instance) { throw new RuntimeException( "Invalid instance type. Must be CustomDestinationForwardDestinationHttp," + " CustomDestinationForwardDestinationSplunk," - + " CustomDestinationForwardDestinationElasticsearch"); + + " CustomDestinationForwardDestinationElasticsearch," + + " CustomDestinationForwardDestinationMicrosoftSentinel"); } /** * Get the actual instance, which can be the following: CustomDestinationForwardDestinationHttp, - * CustomDestinationForwardDestinationSplunk, CustomDestinationForwardDestinationElasticsearch + * CustomDestinationForwardDestinationSplunk, CustomDestinationForwardDestinationElasticsearch, + * CustomDestinationForwardDestinationMicrosoftSentinel * * @return The actual instance (CustomDestinationForwardDestinationHttp, * CustomDestinationForwardDestinationSplunk, - * CustomDestinationForwardDestinationElasticsearch) + * CustomDestinationForwardDestinationElasticsearch, + * CustomDestinationForwardDestinationMicrosoftSentinel) */ @Override public Object getActualInstance() { @@ -393,4 +468,18 @@ public CustomDestinationForwardDestinationSplunk getCustomDestinationForwardDest getCustomDestinationForwardDestinationElasticsearch() throws ClassCastException { return (CustomDestinationForwardDestinationElasticsearch) super.getActualInstance(); } + + /** + * Get the actual instance of `CustomDestinationForwardDestinationMicrosoftSentinel`. If the + * actual instance is not `CustomDestinationForwardDestinationMicrosoftSentinel`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `CustomDestinationForwardDestinationMicrosoftSentinel` + * @throws ClassCastException if the instance is not + * `CustomDestinationForwardDestinationMicrosoftSentinel` + */ + public CustomDestinationForwardDestinationMicrosoftSentinel + getCustomDestinationForwardDestinationMicrosoftSentinel() throws ClassCastException { + return (CustomDestinationForwardDestinationMicrosoftSentinel) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinel.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinel.java new file mode 100644 index 00000000000..b7a7ba9ad11 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinel.java @@ -0,0 +1,322 @@ +/* + * 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 Microsoft Sentinel destination. */ +@JsonPropertyOrder({ + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_CLIENT_ID, + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_DATA_COLLECTION_ENDPOINT, + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_DATA_COLLECTION_RULE_ID, + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_STREAM_NAME, + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_TENANT_ID, + CustomDestinationForwardDestinationMicrosoftSentinel.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationForwardDestinationMicrosoftSentinel { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_DATA_COLLECTION_ENDPOINT = "data_collection_endpoint"; + private String dataCollectionEndpoint; + + public static final String JSON_PROPERTY_DATA_COLLECTION_RULE_ID = "data_collection_rule_id"; + private String dataCollectionRuleId; + + public static final String JSON_PROPERTY_STREAM_NAME = "stream_name"; + private String streamName; + + public static final String JSON_PROPERTY_TENANT_ID = "tenant_id"; + private String tenantId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationForwardDestinationMicrosoftSentinelType type = + CustomDestinationForwardDestinationMicrosoftSentinelType.MICROSOFT_SENTINEL; + + public CustomDestinationForwardDestinationMicrosoftSentinel() {} + + @JsonCreator + public CustomDestinationForwardDestinationMicrosoftSentinel( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_ID) String clientId, + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_COLLECTION_ENDPOINT) + String dataCollectionEndpoint, + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_COLLECTION_RULE_ID) + String dataCollectionRuleId, + @JsonProperty(required = true, value = JSON_PROPERTY_STREAM_NAME) String streamName, + @JsonProperty(required = true, value = JSON_PROPERTY_TENANT_ID) String tenantId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationForwardDestinationMicrosoftSentinelType type) { + this.clientId = clientId; + this.dataCollectionEndpoint = dataCollectionEndpoint; + this.dataCollectionRuleId = dataCollectionRuleId; + this.streamName = streamName; + this.tenantId = tenantId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationForwardDestinationMicrosoftSentinel clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Client ID from the Datadog Azure integration. + * + * @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 CustomDestinationForwardDestinationMicrosoftSentinel dataCollectionEndpoint( + String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + return this; + } + + /** + * Azure data collection endpoint. + * + * @return dataCollectionEndpoint + */ + @JsonProperty(JSON_PROPERTY_DATA_COLLECTION_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataCollectionEndpoint() { + return dataCollectionEndpoint; + } + + public void setDataCollectionEndpoint(String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + } + + public CustomDestinationForwardDestinationMicrosoftSentinel dataCollectionRuleId( + String dataCollectionRuleId) { + this.dataCollectionRuleId = dataCollectionRuleId; + return this; + } + + /** + * Azure data collection rule ID. + * + * @return dataCollectionRuleId + */ + @JsonProperty(JSON_PROPERTY_DATA_COLLECTION_RULE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataCollectionRuleId() { + return dataCollectionRuleId; + } + + public void setDataCollectionRuleId(String dataCollectionRuleId) { + this.dataCollectionRuleId = dataCollectionRuleId; + } + + public CustomDestinationForwardDestinationMicrosoftSentinel streamName(String streamName) { + this.streamName = streamName; + return this; + } + + /** + * Azure stream name. + * + * @return streamName + */ + @JsonProperty(JSON_PROPERTY_STREAM_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStreamName() { + return streamName; + } + + public void setStreamName(String streamName) { + this.streamName = streamName; + } + + public CustomDestinationForwardDestinationMicrosoftSentinel tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Tenant ID from the Datadog Azure integration. + * + * @return tenantId + */ + @JsonProperty(JSON_PROPERTY_TENANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public CustomDestinationForwardDestinationMicrosoftSentinel type( + CustomDestinationForwardDestinationMicrosoftSentinelType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Microsoft Sentinel destination. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationForwardDestinationMicrosoftSentinelType getType() { + return type; + } + + public void setType(CustomDestinationForwardDestinationMicrosoftSentinelType 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 CustomDestinationForwardDestinationMicrosoftSentinel + */ + @JsonAnySetter + public CustomDestinationForwardDestinationMicrosoftSentinel 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 CustomDestinationForwardDestinationMicrosoftSentinel object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationForwardDestinationMicrosoftSentinel + customDestinationForwardDestinationMicrosoftSentinel = + (CustomDestinationForwardDestinationMicrosoftSentinel) o; + return Objects.equals( + this.clientId, customDestinationForwardDestinationMicrosoftSentinel.clientId) + && Objects.equals( + this.dataCollectionEndpoint, + customDestinationForwardDestinationMicrosoftSentinel.dataCollectionEndpoint) + && Objects.equals( + this.dataCollectionRuleId, + customDestinationForwardDestinationMicrosoftSentinel.dataCollectionRuleId) + && Objects.equals( + this.streamName, customDestinationForwardDestinationMicrosoftSentinel.streamName) + && Objects.equals( + this.tenantId, customDestinationForwardDestinationMicrosoftSentinel.tenantId) + && Objects.equals(this.type, customDestinationForwardDestinationMicrosoftSentinel.type) + && Objects.equals( + this.additionalProperties, + customDestinationForwardDestinationMicrosoftSentinel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + clientId, + dataCollectionEndpoint, + dataCollectionRuleId, + streamName, + tenantId, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationForwardDestinationMicrosoftSentinel {\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" dataCollectionEndpoint: ") + .append(toIndentedString(dataCollectionEndpoint)) + .append("\n"); + sb.append(" dataCollectionRuleId: ") + .append(toIndentedString(dataCollectionRuleId)) + .append("\n"); + sb.append(" streamName: ").append(toIndentedString(streamName)).append("\n"); + sb.append(" tenantId: ").append(toIndentedString(tenantId)).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/CustomDestinationForwardDestinationMicrosoftSentinelType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinelType.java new file mode 100644 index 00000000000..868fb8bbbe5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationMicrosoftSentinelType.java @@ -0,0 +1,63 @@ +/* + * 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 Microsoft Sentinel destination. */ +@JsonSerialize( + using = + CustomDestinationForwardDestinationMicrosoftSentinelType + .CustomDestinationForwardDestinationMicrosoftSentinelTypeSerializer.class) +public class CustomDestinationForwardDestinationMicrosoftSentinelType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("microsoft_sentinel")); + + public static final CustomDestinationForwardDestinationMicrosoftSentinelType MICROSOFT_SENTINEL = + new CustomDestinationForwardDestinationMicrosoftSentinelType("microsoft_sentinel"); + + CustomDestinationForwardDestinationMicrosoftSentinelType(String value) { + super(value, allowedValues); + } + + public static class CustomDestinationForwardDestinationMicrosoftSentinelTypeSerializer + extends StdSerializer { + public CustomDestinationForwardDestinationMicrosoftSentinelTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationForwardDestinationMicrosoftSentinelTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationForwardDestinationMicrosoftSentinelType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationForwardDestinationMicrosoftSentinelType fromValue(String value) { + return new CustomDestinationForwardDestinationMicrosoftSentinelType(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 2035db3cfb5..fc09b20168f 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 @@ -256,6 +256,70 @@ public CustomDestinationResponseForwardDestination deserialize( e); } + // deserialize CustomDestinationResponseForwardDestinationMicrosoftSentinel + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals(Integer.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals(Long.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Float.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Double.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Boolean.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Integer.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class + .equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Float.class) + || CustomDestinationResponseForwardDestinationMicrosoftSentinel.class + .equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CustomDestinationResponseForwardDestinationMicrosoftSentinel.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(CustomDestinationResponseForwardDestinationMicrosoftSentinel.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 (!((CustomDestinationResponseForwardDestinationMicrosoftSentinel) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'CustomDestinationResponseForwardDestinationMicrosoftSentinel'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'CustomDestinationResponseForwardDestinationMicrosoftSentinel'", + e); + } + CustomDestinationResponseForwardDestination ret = new CustomDestinationResponseForwardDestination(); if (match == 1) { @@ -305,6 +369,12 @@ public CustomDestinationResponseForwardDestination( setActualInstance(o); } + public CustomDestinationResponseForwardDestination( + CustomDestinationResponseForwardDestinationMicrosoftSentinel o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put( "CustomDestinationResponseForwardDestinationHttp", @@ -315,6 +385,9 @@ public CustomDestinationResponseForwardDestination( schemas.put( "CustomDestinationResponseForwardDestinationElasticsearch", new GenericType() {}); + schemas.put( + "CustomDestinationResponseForwardDestinationMicrosoftSentinel", + new GenericType() {}); JSON.registerDescendants( CustomDestinationResponseForwardDestination.class, Collections.unmodifiableMap(schemas)); } @@ -328,7 +401,8 @@ public Map getSchemas() { * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, - * CustomDestinationResponseForwardDestinationElasticsearch + * CustomDestinationResponseForwardDestinationElasticsearch, + * CustomDestinationResponseForwardDestinationMicrosoftSentinel * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -354,6 +428,13 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf( + CustomDestinationResponseForwardDestinationMicrosoftSentinel.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -362,18 +443,21 @@ public void setActualInstance(Object instance) { throw new RuntimeException( "Invalid instance type. Must be CustomDestinationResponseForwardDestinationHttp," + " CustomDestinationResponseForwardDestinationSplunk," - + " CustomDestinationResponseForwardDestinationElasticsearch"); + + " CustomDestinationResponseForwardDestinationElasticsearch," + + " CustomDestinationResponseForwardDestinationMicrosoftSentinel"); } /** * Get the actual instance, which can be the following: * CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, - * CustomDestinationResponseForwardDestinationElasticsearch + * CustomDestinationResponseForwardDestinationElasticsearch, + * CustomDestinationResponseForwardDestinationMicrosoftSentinel * * @return The actual instance (CustomDestinationResponseForwardDestinationHttp, * CustomDestinationResponseForwardDestinationSplunk, - * CustomDestinationResponseForwardDestinationElasticsearch) + * CustomDestinationResponseForwardDestinationElasticsearch, + * CustomDestinationResponseForwardDestinationMicrosoftSentinel) */ @Override public Object getActualInstance() { @@ -421,4 +505,18 @@ public Object getActualInstance() { getCustomDestinationResponseForwardDestinationElasticsearch() throws ClassCastException { return (CustomDestinationResponseForwardDestinationElasticsearch) super.getActualInstance(); } + + /** + * Get the actual instance of `CustomDestinationResponseForwardDestinationMicrosoftSentinel`. If + * the actual instance is not `CustomDestinationResponseForwardDestinationMicrosoftSentinel`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `CustomDestinationResponseForwardDestinationMicrosoftSentinel` + * @throws ClassCastException if the instance is not + * `CustomDestinationResponseForwardDestinationMicrosoftSentinel` + */ + public CustomDestinationResponseForwardDestinationMicrosoftSentinel + getCustomDestinationResponseForwardDestinationMicrosoftSentinel() throws ClassCastException { + return (CustomDestinationResponseForwardDestinationMicrosoftSentinel) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinel.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinel.java new file mode 100644 index 00000000000..93f0c53fcf6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinel.java @@ -0,0 +1,328 @@ +/* + * 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 Microsoft Sentinel destination. */ +@JsonPropertyOrder({ + CustomDestinationResponseForwardDestinationMicrosoftSentinel.JSON_PROPERTY_CLIENT_ID, + CustomDestinationResponseForwardDestinationMicrosoftSentinel + .JSON_PROPERTY_DATA_COLLECTION_ENDPOINT, + CustomDestinationResponseForwardDestinationMicrosoftSentinel + .JSON_PROPERTY_DATA_COLLECTION_RULE_ID, + CustomDestinationResponseForwardDestinationMicrosoftSentinel.JSON_PROPERTY_STREAM_NAME, + CustomDestinationResponseForwardDestinationMicrosoftSentinel.JSON_PROPERTY_TENANT_ID, + CustomDestinationResponseForwardDestinationMicrosoftSentinel.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CustomDestinationResponseForwardDestinationMicrosoftSentinel { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_DATA_COLLECTION_ENDPOINT = "data_collection_endpoint"; + private String dataCollectionEndpoint; + + public static final String JSON_PROPERTY_DATA_COLLECTION_RULE_ID = "data_collection_rule_id"; + private String dataCollectionRuleId; + + public static final String JSON_PROPERTY_STREAM_NAME = "stream_name"; + private String streamName; + + public static final String JSON_PROPERTY_TENANT_ID = "tenant_id"; + private String tenantId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CustomDestinationResponseForwardDestinationMicrosoftSentinelType type = + CustomDestinationResponseForwardDestinationMicrosoftSentinelType.MICROSOFT_SENTINEL; + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel() {} + + @JsonCreator + public CustomDestinationResponseForwardDestinationMicrosoftSentinel( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_ID) String clientId, + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_COLLECTION_ENDPOINT) + String dataCollectionEndpoint, + @JsonProperty(required = true, value = JSON_PROPERTY_DATA_COLLECTION_RULE_ID) + String dataCollectionRuleId, + @JsonProperty(required = true, value = JSON_PROPERTY_STREAM_NAME) String streamName, + @JsonProperty(required = true, value = JSON_PROPERTY_TENANT_ID) String tenantId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + CustomDestinationResponseForwardDestinationMicrosoftSentinelType type) { + this.clientId = clientId; + this.dataCollectionEndpoint = dataCollectionEndpoint; + this.dataCollectionRuleId = dataCollectionRuleId; + this.streamName = streamName; + this.tenantId = tenantId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Client ID from the Datadog Azure integration. + * + * @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 CustomDestinationResponseForwardDestinationMicrosoftSentinel dataCollectionEndpoint( + String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + return this; + } + + /** + * Azure data collection endpoint. + * + * @return dataCollectionEndpoint + */ + @JsonProperty(JSON_PROPERTY_DATA_COLLECTION_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataCollectionEndpoint() { + return dataCollectionEndpoint; + } + + public void setDataCollectionEndpoint(String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel dataCollectionRuleId( + String dataCollectionRuleId) { + this.dataCollectionRuleId = dataCollectionRuleId; + return this; + } + + /** + * Azure data collection rule ID. + * + * @return dataCollectionRuleId + */ + @JsonProperty(JSON_PROPERTY_DATA_COLLECTION_RULE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDataCollectionRuleId() { + return dataCollectionRuleId; + } + + public void setDataCollectionRuleId(String dataCollectionRuleId) { + this.dataCollectionRuleId = dataCollectionRuleId; + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel streamName( + String streamName) { + this.streamName = streamName; + return this; + } + + /** + * Azure stream name. + * + * @return streamName + */ + @JsonProperty(JSON_PROPERTY_STREAM_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStreamName() { + return streamName; + } + + public void setStreamName(String streamName) { + this.streamName = streamName; + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Tenant ID from the Datadog Azure integration. + * + * @return tenantId + */ + @JsonProperty(JSON_PROPERTY_TENANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinel type( + CustomDestinationResponseForwardDestinationMicrosoftSentinelType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the Microsoft Sentinel destination. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CustomDestinationResponseForwardDestinationMicrosoftSentinelType getType() { + return type; + } + + public void setType(CustomDestinationResponseForwardDestinationMicrosoftSentinelType 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 CustomDestinationResponseForwardDestinationMicrosoftSentinel + */ + @JsonAnySetter + public CustomDestinationResponseForwardDestinationMicrosoftSentinel 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 CustomDestinationResponseForwardDestinationMicrosoftSentinel object is + * equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomDestinationResponseForwardDestinationMicrosoftSentinel + customDestinationResponseForwardDestinationMicrosoftSentinel = + (CustomDestinationResponseForwardDestinationMicrosoftSentinel) o; + return Objects.equals( + this.clientId, customDestinationResponseForwardDestinationMicrosoftSentinel.clientId) + && Objects.equals( + this.dataCollectionEndpoint, + customDestinationResponseForwardDestinationMicrosoftSentinel.dataCollectionEndpoint) + && Objects.equals( + this.dataCollectionRuleId, + customDestinationResponseForwardDestinationMicrosoftSentinel.dataCollectionRuleId) + && Objects.equals( + this.streamName, + customDestinationResponseForwardDestinationMicrosoftSentinel.streamName) + && Objects.equals( + this.tenantId, customDestinationResponseForwardDestinationMicrosoftSentinel.tenantId) + && Objects.equals( + this.type, customDestinationResponseForwardDestinationMicrosoftSentinel.type) + && Objects.equals( + this.additionalProperties, + customDestinationResponseForwardDestinationMicrosoftSentinel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + clientId, + dataCollectionEndpoint, + dataCollectionRuleId, + streamName, + tenantId, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomDestinationResponseForwardDestinationMicrosoftSentinel {\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" dataCollectionEndpoint: ") + .append(toIndentedString(dataCollectionEndpoint)) + .append("\n"); + sb.append(" dataCollectionRuleId: ") + .append(toIndentedString(dataCollectionRuleId)) + .append("\n"); + sb.append(" streamName: ").append(toIndentedString(streamName)).append("\n"); + sb.append(" tenantId: ").append(toIndentedString(tenantId)).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/CustomDestinationResponseForwardDestinationMicrosoftSentinelType.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinelType.java new file mode 100644 index 00000000000..71c0d1433c6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationMicrosoftSentinelType.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 Microsoft Sentinel destination. */ +@JsonSerialize( + using = + CustomDestinationResponseForwardDestinationMicrosoftSentinelType + .CustomDestinationResponseForwardDestinationMicrosoftSentinelTypeSerializer.class) +public class CustomDestinationResponseForwardDestinationMicrosoftSentinelType + extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("microsoft_sentinel")); + + public static final CustomDestinationResponseForwardDestinationMicrosoftSentinelType + MICROSOFT_SENTINEL = + new CustomDestinationResponseForwardDestinationMicrosoftSentinelType( + "microsoft_sentinel"); + + CustomDestinationResponseForwardDestinationMicrosoftSentinelType(String value) { + super(value, allowedValues); + } + + public static class CustomDestinationResponseForwardDestinationMicrosoftSentinelTypeSerializer + extends StdSerializer { + public CustomDestinationResponseForwardDestinationMicrosoftSentinelTypeSerializer( + Class t) { + super(t); + } + + public CustomDestinationResponseForwardDestinationMicrosoftSentinelTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CustomDestinationResponseForwardDestinationMicrosoftSentinelType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CustomDestinationResponseForwardDestinationMicrosoftSentinelType fromValue( + String value) { + return new CustomDestinationResponseForwardDestinationMicrosoftSentinelType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.freeze new file mode 100644 index 00000000000..62e966e1435 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-06-20T08:10:33.243Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_custom_destination_returns_OK_response.json new file mode 100644 index 00000000000..60f98774c3a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Microsoft_Sentinel_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\":{\"client_id\":\"9a2f4d83-2b5e-429e-a35a-2b3c4182db71\",\"data_collection_endpoint\":\"https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com\",\"data_collection_rule_id\":\"dcr-000a00a000a00000a000000aa000a0aa\",\"stream_name\":\"Custom-MyTable\",\"tenant_id\":\"f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2\",\"type\":\"microsoft_sentinel\"},\"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\":\"171ee4b7-e07f-43ca-85a5-23f762c161a7\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"tenant_id\":\"f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2\",\"client_id\":\"9a2f4d83-2b5e-429e-a35a-2b3c4182db71\",\"data_collection_endpoint\":\"https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com\",\"data_collection_rule_id\":\"dcr-000a00a000a00000a000000aa000a0aa\",\"stream_name\":\"Custom-MyTable\",\"type\":\"microsoft_sentinel\"},\"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": "42a16876-edd1-1fd1-384e-5ef1ae5323d6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/171ee4b7-e07f-43ca-85a5-23f762c161a7", + "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": "72747df2-f798-a862-2438-7187f85ee17d" + } +] \ 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 4410834fdca..44b85404852 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,29 @@ 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 Microsoft Sentinel 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": "microsoft_sentinel", "tenant_id": "f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2", "client_id": "9a2f4d83-2b5e-429e-a35a-2b3c4182db71", "data_collection_endpoint": "https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com", "data_collection_rule_id": "dcr-000a00a000a00000a000000aa000a0aa", "stream_name": "Custom-MyTable"}, "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 "microsoft_sentinel" + And the response "data.attributes.forwarder_destination.tenant_id" is equal to "f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2" + And the response "data.attributes.forwarder_destination.client_id" is equal to "9a2f4d83-2b5e-429e-a35a-2b3c4182db71" + And the response "data.attributes.forwarder_destination.data_collection_endpoint" is equal to "https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com" + And the response "data.attributes.forwarder_destination.data_collection_rule_id" is equal to "dcr-000a00a000a00000a000000aa000a0aa" + And the response "data.attributes.forwarder_destination.stream_name" is equal to "Custom-MyTable" + 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 Splunk custom destination returns "OK" response Given new "CreateLogsCustomDestination" request