From c55f5fb111bf702dd7ff1bd4cd1ebeacee7d5fbe Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 9 Jul 2025 08:40:37 +0000 Subject: [PATCH] Regenerate client from commit 7331abb4 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 150 ++++++++++++++++ ..._CreateLogsCustomDestination_1006705740.rs | 62 +++++++ src/datadogV2/model/mod.rs | 16 ++ ..._custom_destination_forward_destination.rs | 8 + ..._destination_google_security_operations.rs | 152 ++++++++++++++++ ...ination_google_security_operations_type.rs | 48 +++++ ...le_security_operations_destination_auth.rs | 165 ++++++++++++++++++ ...curity_operations_destination_auth_type.rs | 48 +++++ ...estination_response_forward_destination.rs | 24 ++- ..._destination_google_security_operations.rs | 154 ++++++++++++++++ ...ination_google_security_operations_type.rs | 50 ++++++ ...le_security_operations_destination_auth.rs | 128 ++++++++++++++ ...curity_operations_destination_auth_type.rs | 50 ++++++ ...tom-destination-returns-OK-response.frozen | 1 + ...ustom-destination-returns-OK-response.json | 67 +++++++ .../v2/logs_custom_destinations.feature | 27 +++ 17 files changed, 1141 insertions(+), 17 deletions(-) create mode 100644 examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1006705740.rs create mode 100644 src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations.rs create mode 100644 src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations_type.rs create mode 100644 src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth.rs create mode 100644 src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth_type.rs create mode 100644 src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations.rs create mode 100644 src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations_type.rs create mode 100644 src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth.rs create mode 100644 src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth_type.rs create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.json diff --git a/.apigentools-info b/.apigentools-info index 9b0da956e..9e0485f8c 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:05.438773", - "spec_repo_commit": "7b042e12" + "regenerated": "2025-07-09 08:34:44.665170", + "spec_repo_commit": "7331abb4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-08 19:08:05.457615", - "spec_repo_commit": "7b042e12" + "regenerated": "2025-07-09 08:34:44.681419", + "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 8ab2278d0..d341e1581 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.rs b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1006705740.rs new file mode 100644 index 000000000..baa0806aa --- /dev/null +++ b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1006705740.rs @@ -0,0 +1,62 @@ +// Create a Google Security Operations custom destination returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationAttributeTagsRestrictionListType; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationGoogleSecurityOperations; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationGoogleSecurityOperationsType; +use datadog_api_client::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuth; +use datadog_api_client::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuthType; +use datadog_api_client::datadogV2::model::CustomDestinationType; + +#[tokio::main] +async fn main() { + let body = + CustomDestinationCreateRequest + ::new().data( + CustomDestinationCreateRequestDefinition::new( + CustomDestinationCreateRequestAttributes::new( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationGoogleSecurityOperations( + Box::new( + CustomDestinationForwardDestinationGoogleSecurityOperations::new( + CustomDestinationGoogleSecurityOperationsDestinationAuth::new( + "client@example.com".to_string(), + "def123456".to_string(), + r#"-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBK... +-----END PRIVATE KEY----- +"#.to_string(), + "abc12345678".to_string(), + "gcp-project".to_string(), + CustomDestinationGoogleSecurityOperationsDestinationAuthType::GCP_PRIVATE_KEY, + ), + "123-456-7890".to_string(), + "google-security-operations-namespace".to_string(), + "https://malachiteingestion-pa.googleapis.com".to_string(), + CustomDestinationForwardDestinationGoogleSecurityOperationsType + ::GOOGLE_SECURITY_OPERATIONS, + ), + ), + ), + "Nginx logs".to_string(), + ) + .enabled(false) + .forward_tags(false) + .forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()]) + .forward_tags_restriction_list_type(CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST) + .query("source:nginx".to_string()), + CustomDestinationType::CUSTOM_DESTINATION, + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api.create_logs_custom_destination(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index b11cea9ec..670289f8d 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -2322,6 +2322,14 @@ pub mod model_custom_destination_response_forward_destination_microsoft_sentinel pub use self::model_custom_destination_response_forward_destination_microsoft_sentinel::CustomDestinationResponseForwardDestinationMicrosoftSentinel; pub mod model_custom_destination_response_forward_destination_microsoft_sentinel_type; pub use self::model_custom_destination_response_forward_destination_microsoft_sentinel_type::CustomDestinationResponseForwardDestinationMicrosoftSentinelType; +pub mod model_custom_destination_response_forward_destination_google_security_operations; +pub use self::model_custom_destination_response_forward_destination_google_security_operations::CustomDestinationResponseForwardDestinationGoogleSecurityOperations; +pub mod model_custom_destination_response_google_security_operations_destination_auth; +pub use self::model_custom_destination_response_google_security_operations_destination_auth::CustomDestinationResponseGoogleSecurityOperationsDestinationAuth; +pub mod model_custom_destination_response_google_security_operations_destination_auth_type; +pub use self::model_custom_destination_response_google_security_operations_destination_auth_type::CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType; +pub mod model_custom_destination_response_forward_destination_google_security_operations_type; +pub use self::model_custom_destination_response_forward_destination_google_security_operations_type::CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType; pub mod model_custom_destination_response_forward_destination; pub use self::model_custom_destination_response_forward_destination::CustomDestinationResponseForwardDestination; pub mod model_custom_destination_type; @@ -2360,6 +2368,14 @@ pub mod model_custom_destination_forward_destination_microsoft_sentinel; pub use self::model_custom_destination_forward_destination_microsoft_sentinel::CustomDestinationForwardDestinationMicrosoftSentinel; pub mod model_custom_destination_forward_destination_microsoft_sentinel_type; pub use self::model_custom_destination_forward_destination_microsoft_sentinel_type::CustomDestinationForwardDestinationMicrosoftSentinelType; +pub mod model_custom_destination_forward_destination_google_security_operations; +pub use self::model_custom_destination_forward_destination_google_security_operations::CustomDestinationForwardDestinationGoogleSecurityOperations; +pub mod model_custom_destination_google_security_operations_destination_auth; +pub use self::model_custom_destination_google_security_operations_destination_auth::CustomDestinationGoogleSecurityOperationsDestinationAuth; +pub mod model_custom_destination_google_security_operations_destination_auth_type; +pub use self::model_custom_destination_google_security_operations_destination_auth_type::CustomDestinationGoogleSecurityOperationsDestinationAuthType; +pub mod model_custom_destination_forward_destination_google_security_operations_type; +pub use self::model_custom_destination_forward_destination_google_security_operations_type::CustomDestinationForwardDestinationGoogleSecurityOperationsType; pub mod model_custom_destination_forward_destination; pub use self::model_custom_destination_forward_destination::CustomDestinationForwardDestination; pub mod model_custom_destination_response; diff --git a/src/datadogV2/model/model_custom_destination_forward_destination.rs b/src/datadogV2/model/model_custom_destination_forward_destination.rs index 24300cb4c..71e98aab7 100644 --- a/src/datadogV2/model/model_custom_destination_forward_destination.rs +++ b/src/datadogV2/model/model_custom_destination_forward_destination.rs @@ -20,6 +20,9 @@ pub enum CustomDestinationForwardDestination { CustomDestinationForwardDestinationMicrosoftSentinel( Box, ), + CustomDestinationForwardDestinationGoogleSecurityOperations( + Box, + ), UnparsedObject(crate::datadog::UnparsedObject), } @@ -69,6 +72,11 @@ impl<'de> Deserialize<'de> for CustomDestinationForwardDestination { return Ok(CustomDestinationForwardDestination::CustomDestinationForwardDestinationMicrosoftSentinel(_v)); } } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(CustomDestinationForwardDestination::CustomDestinationForwardDestinationGoogleSecurityOperations(_v)); + } + } return Ok(CustomDestinationForwardDestination::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations.rs b/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations.rs new file mode 100644 index 000000000..0d9e1d536 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations.rs @@ -0,0 +1,152 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The Google Security Operations destination. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomDestinationForwardDestinationGoogleSecurityOperations { + /// Google Security Operations destination authentication. + #[serde(rename = "auth")] + pub auth: crate::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuth, + /// The customer ID of the Google Security Operations account. + #[serde(rename = "customer_id")] + pub customer_id: String, + /// The namespace of the Google Security Operations account. + #[serde(rename = "namespace")] + pub namespace: String, + /// The `CustomDestinationForwardDestinationGoogleSecurityOperations` `regional_endpoint`. + #[serde(rename = "regional_endpoint")] + pub regional_endpoint: String, + /// Type of the Google Security Operations destination. + #[serde(rename = "type")] + pub type_: + crate::datadogV2::model::CustomDestinationForwardDestinationGoogleSecurityOperationsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomDestinationForwardDestinationGoogleSecurityOperations { + pub fn new( + auth: crate::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuth, + customer_id: String, + namespace: String, + regional_endpoint: String, + type_: crate::datadogV2::model::CustomDestinationForwardDestinationGoogleSecurityOperationsType, + ) -> CustomDestinationForwardDestinationGoogleSecurityOperations { + CustomDestinationForwardDestinationGoogleSecurityOperations { + auth, + customer_id, + namespace, + regional_endpoint, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationGoogleSecurityOperations { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomDestinationForwardDestinationGoogleSecurityOperationsVisitor; + impl<'a> Visitor<'a> for CustomDestinationForwardDestinationGoogleSecurityOperationsVisitor { + type Value = CustomDestinationForwardDestinationGoogleSecurityOperations; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut auth: Option = None; + let mut customer_id: Option = None; + let mut namespace: Option = None; + let mut regional_endpoint: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "auth" => { + auth = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "customer_id" => { + customer_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "namespace" => { + namespace = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "regional_endpoint" => { + regional_endpoint = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomDestinationForwardDestinationGoogleSecurityOperationsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let auth = auth.ok_or_else(|| M::Error::missing_field("auth"))?; + let customer_id = + customer_id.ok_or_else(|| M::Error::missing_field("customer_id"))?; + let namespace = namespace.ok_or_else(|| M::Error::missing_field("namespace"))?; + let regional_endpoint = regional_endpoint + .ok_or_else(|| M::Error::missing_field("regional_endpoint"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CustomDestinationForwardDestinationGoogleSecurityOperations { + auth, + customer_id, + namespace, + regional_endpoint, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(CustomDestinationForwardDestinationGoogleSecurityOperationsVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations_type.rs b/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations_type.rs new file mode 100644 index 000000000..ce9be82f1 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_forward_destination_google_security_operations_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomDestinationForwardDestinationGoogleSecurityOperationsType { + GOOGLE_SECURITY_OPERATIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomDestinationForwardDestinationGoogleSecurityOperationsType { + fn to_string(&self) -> String { + match self { + Self::GOOGLE_SECURITY_OPERATIONS => String::from("google_security_operations"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomDestinationForwardDestinationGoogleSecurityOperationsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationGoogleSecurityOperationsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "google_security_operations" => Self::GOOGLE_SECURITY_OPERATIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth.rs b/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth.rs new file mode 100644 index 000000000..fe29e4900 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth.rs @@ -0,0 +1,165 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Google Security Operations destination authentication. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomDestinationGoogleSecurityOperationsDestinationAuth { + /// The Google Security Operations client email. + #[serde(rename = "client_email")] + pub client_email: String, + /// The Google Security Operations client ID. This field is not returned by the API. + #[serde(rename = "client_id")] + pub client_id: String, + /// The Google Security Operations private key. This field is not returned by the API. + #[serde(rename = "private_key")] + pub private_key: String, + /// The Google Security Operations private key ID. This field is not returned by the API. + #[serde(rename = "private_key_id")] + pub private_key_id: String, + /// Google Security Operations project ID. + #[serde(rename = "project_id")] + pub project_id: String, + /// Type of the Google Security Operations destination authentication. + #[serde(rename = "type")] + pub type_: + crate::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuthType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CustomDestinationGoogleSecurityOperationsDestinationAuth { + pub fn new( + client_email: String, + client_id: String, + private_key: String, + private_key_id: String, + project_id: String, + type_: crate::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuthType, + ) -> CustomDestinationGoogleSecurityOperationsDestinationAuth { + CustomDestinationGoogleSecurityOperationsDestinationAuth { + client_email, + client_id, + private_key, + private_key_id, + project_id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CustomDestinationGoogleSecurityOperationsDestinationAuth { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomDestinationGoogleSecurityOperationsDestinationAuthVisitor; + impl<'a> Visitor<'a> for CustomDestinationGoogleSecurityOperationsDestinationAuthVisitor { + type Value = CustomDestinationGoogleSecurityOperationsDestinationAuth; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut client_email: Option = None; + let mut client_id: Option = None; + let mut private_key: Option = None; + let mut private_key_id: Option = None; + let mut project_id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "client_email" => { + client_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "client_id" => { + client_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "private_key" => { + private_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "private_key_id" => { + private_key_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomDestinationGoogleSecurityOperationsDestinationAuthType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let client_email = + client_email.ok_or_else(|| M::Error::missing_field("client_email"))?; + let client_id = client_id.ok_or_else(|| M::Error::missing_field("client_id"))?; + let private_key = + private_key.ok_or_else(|| M::Error::missing_field("private_key"))?; + let private_key_id = + private_key_id.ok_or_else(|| M::Error::missing_field("private_key_id"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CustomDestinationGoogleSecurityOperationsDestinationAuth { + client_email, + client_id, + private_key, + private_key_id, + project_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(CustomDestinationGoogleSecurityOperationsDestinationAuthVisitor) + } +} diff --git a/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth_type.rs b/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth_type.rs new file mode 100644 index 000000000..529e26579 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_google_security_operations_destination_auth_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomDestinationGoogleSecurityOperationsDestinationAuthType { + GCP_PRIVATE_KEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomDestinationGoogleSecurityOperationsDestinationAuthType { + fn to_string(&self) -> String { + match self { + Self::GCP_PRIVATE_KEY => String::from("gcp_private_key"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomDestinationGoogleSecurityOperationsDestinationAuthType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CustomDestinationGoogleSecurityOperationsDestinationAuthType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "gcp_private_key" => Self::GCP_PRIVATE_KEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_custom_destination_response_forward_destination.rs b/src/datadogV2/model/model_custom_destination_response_forward_destination.rs index abc50fcce..db448feb1 100644 --- a/src/datadogV2/model/model_custom_destination_response_forward_destination.rs +++ b/src/datadogV2/model/model_custom_destination_response_forward_destination.rs @@ -8,19 +8,12 @@ use serde::{Deserialize, Deserializer, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize)] #[serde(untagged)] pub enum CustomDestinationResponseForwardDestination { - CustomDestinationResponseForwardDestinationHttp( - Box, - ), - CustomDestinationResponseForwardDestinationSplunk( - Box, - ), - CustomDestinationResponseForwardDestinationElasticsearch( - Box, - ), - CustomDestinationResponseForwardDestinationMicrosoftSentinel( - Box, - ), - UnparsedObject(crate::datadog::UnparsedObject), + CustomDestinationResponseForwardDestinationHttp(Box), + CustomDestinationResponseForwardDestinationSplunk(Box), + CustomDestinationResponseForwardDestinationElasticsearch(Box), + CustomDestinationResponseForwardDestinationMicrosoftSentinel(Box), + CustomDestinationResponseForwardDestinationGoogleSecurityOperations(Box), + UnparsedObject(crate::datadog::UnparsedObject), } impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestination { @@ -58,6 +51,11 @@ impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestination { return Ok(CustomDestinationResponseForwardDestination::CustomDestinationResponseForwardDestinationMicrosoftSentinel(_v)); } } + if let Ok(_v) = serde_json::from_value::>(value.clone()) { + if !_v._unparsed { + return Ok(CustomDestinationResponseForwardDestination::CustomDestinationResponseForwardDestinationGoogleSecurityOperations(_v)); + } + } return Ok(CustomDestinationResponseForwardDestination::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations.rs b/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations.rs new file mode 100644 index 000000000..35839b52b --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations.rs @@ -0,0 +1,154 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The Google Security Operations destination. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + /// Google Security Operations destination authentication. + #[serde(rename = "auth")] + pub auth: crate::datadogV2::model::CustomDestinationResponseGoogleSecurityOperationsDestinationAuth, + /// The customer ID of the Google Security Operations account. + #[serde(rename = "customer_id")] + pub customer_id: String, + /// The namespace of the Google Security Operations account. + #[serde(rename = "namespace")] + pub namespace: String, + /// The `CustomDestinationResponseForwardDestinationGoogleSecurityOperations` `regional_endpoint`. + #[serde(rename = "regional_endpoint")] + pub regional_endpoint: String, + /// Type of the Google Security Operations destination. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool +} + +impl CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + pub fn new( + auth: crate::datadogV2::model::CustomDestinationResponseGoogleSecurityOperationsDestinationAuth, + customer_id: String, + namespace: String, + regional_endpoint: String, + type_: crate::datadogV2::model::CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType, + ) -> CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + auth, + customer_id, + namespace, + regional_endpoint, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomDestinationResponseForwardDestinationGoogleSecurityOperationsVisitor; + impl<'a> Visitor<'a> + for CustomDestinationResponseForwardDestinationGoogleSecurityOperationsVisitor + { + type Value = CustomDestinationResponseForwardDestinationGoogleSecurityOperations; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut auth: Option = None; + let mut customer_id: Option = None; + let mut namespace: Option = None; + let mut regional_endpoint: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "auth" => { + auth = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "customer_id" => { + customer_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "namespace" => { + namespace = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "regional_endpoint" => { + regional_endpoint = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let auth = auth.ok_or_else(|| M::Error::missing_field("auth"))?; + let customer_id = + customer_id.ok_or_else(|| M::Error::missing_field("customer_id"))?; + let namespace = namespace.ok_or_else(|| M::Error::missing_field("namespace"))?; + let regional_endpoint = regional_endpoint + .ok_or_else(|| M::Error::missing_field("regional_endpoint"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CustomDestinationResponseForwardDestinationGoogleSecurityOperations { + auth, + customer_id, + namespace, + regional_endpoint, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + CustomDestinationResponseForwardDestinationGoogleSecurityOperationsVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations_type.rs b/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations_type.rs new file mode 100644 index 000000000..a5614b9a5 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_response_forward_destination_google_security_operations_type.rs @@ -0,0 +1,50 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType { + GOOGLE_SECURITY_OPERATIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType { + fn to_string(&self) -> String { + match self { + Self::GOOGLE_SECURITY_OPERATIONS => String::from("google_security_operations"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> + for CustomDestinationResponseForwardDestinationGoogleSecurityOperationsType +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "google_security_operations" => Self::GOOGLE_SECURITY_OPERATIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth.rs b/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth.rs new file mode 100644 index 000000000..b831b8c04 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth.rs @@ -0,0 +1,128 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Google Security Operations destination authentication. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + /// The Google Security Operations client email. + #[serde(rename = "client_email")] + pub client_email: String, + /// Google Security Operations project ID. + #[serde(rename = "project_id")] + pub project_id: String, + /// Type of the Google Security Operations destination authentication. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool +} + +impl CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + pub fn new( + client_email: String, + project_id: String, + type_: crate::datadogV2::model::CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType, + ) -> CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + client_email, + project_id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CustomDestinationResponseGoogleSecurityOperationsDestinationAuthVisitor; + impl<'a> Visitor<'a> for CustomDestinationResponseGoogleSecurityOperationsDestinationAuthVisitor { + type Value = CustomDestinationResponseGoogleSecurityOperationsDestinationAuth; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut client_email: Option = None; + let mut project_id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "client_email" => { + client_email = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let client_email = + client_email.ok_or_else(|| M::Error::missing_field("client_email"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CustomDestinationResponseGoogleSecurityOperationsDestinationAuth { + client_email, + project_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any( + CustomDestinationResponseGoogleSecurityOperationsDestinationAuthVisitor, + ) + } +} diff --git a/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth_type.rs b/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth_type.rs new file mode 100644 index 000000000..a47b23de3 --- /dev/null +++ b/src/datadogV2/model/model_custom_destination_response_google_security_operations_destination_auth_type.rs @@ -0,0 +1,50 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType { + GCP_PRIVATE_KEY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType { + fn to_string(&self) -> String { + match self { + Self::GCP_PRIVATE_KEY => String::from("gcp_private_key"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> + for CustomDestinationResponseGoogleSecurityOperationsDestinationAuthType +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "gcp_private_key" => Self::GCP_PRIVATE_KEY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.frozen new file mode 100644 index 000000000..b8d60d065 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-07-09T08:26:14.805Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.json new file mode 100644 index 000000000..238ce3e0d --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Google-Security-Operations-custom-destination-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"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\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"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", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 09 Jul 2025 08:26:14 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/363586eb-0e4c-45c6-ba95-5afaddead03f" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 09 Jul 2025 08:26:14 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/logs_custom_destinations.feature b/tests/scenarios/features/v2/logs_custom_destinations.feature index 44b854048..d56c94570 100644 --- a/tests/scenarios/features/v2/logs_custom_destinations.feature +++ b/tests/scenarios/features/v2/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