diff --git a/.apigentools-info b/.apigentools-info index 3bb30a959..91ed38b41 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 04:31:12.514459", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 14:21:32.705181", + "spec_repo_commit": "022c8d0f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 04:31:12.530271", - "spec_repo_commit": "272cce39" + "regenerated": "2025-05-02 14:21:32.723933", + "spec_repo_commit": "022c8d0f" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 54001549f..6bdbe6b91 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -14222,8 +14222,8 @@ components: operator: $ref: '#/components/schemas/SyntheticsAssertionBodyHashOperator' target: + $ref: '#/components/schemas/SyntheticsAssertionTargetValue' description: Value used by the operator. - example: 123456 type: $ref: '#/components/schemas/SyntheticsAssertionBodyHashType' required: @@ -14279,6 +14279,7 @@ components: description: The specific operator to use on the path. type: string targetValue: + $ref: '#/components/schemas/SyntheticsAssertionTargetValue' description: The path target value to compare to. type: object SyntheticsAssertionJSONSchemaMetaSchema: @@ -14386,8 +14387,8 @@ components: description: The associated assertion property. type: string target: + $ref: '#/components/schemas/SyntheticsAssertionTargetValue' description: Value used by the operator. - example: 123456 timingsScope: $ref: '#/components/schemas/SyntheticsAssertionTimingsScope' type: @@ -14397,6 +14398,19 @@ components: - operator - target type: object + SyntheticsAssertionTargetValue: + description: Value used by the operator in assertions. Can be either a number + or string. + oneOf: + - $ref: '#/components/schemas/SyntheticsAssertionTargetValueNumber' + - $ref: '#/components/schemas/SyntheticsAssertionTargetValueString' + SyntheticsAssertionTargetValueNumber: + description: Numeric value used by the operator in assertions. + format: int64 + type: integer + SyntheticsAssertionTargetValueString: + description: String value used by the operator in assertions. + type: string SyntheticsAssertionTimingsScope: description: Timings scope for response time assertions. enum: @@ -14481,6 +14495,7 @@ components: description: The specific operator to use on the path. type: string targetValue: + $ref: '#/components/schemas/SyntheticsAssertionTargetValue' description: The path target value to compare to. xPath: description: The X path to assert. diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest.rs b/examples/v1_synthetics_CreateSyntheticsAPITest.rs index 10382189c..5f1955b2a 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest.rs @@ -7,6 +7,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsBrowserTestRumSettings; use datadog_api_client::datadogV1::model::SyntheticsTestCiOptions; @@ -21,7 +22,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestOptionsScheduling; use datadog_api_client::datadogV1::model::SyntheticsTestOptionsSchedulingTimeframe; use datadog_api_client::datadogV1::model::SyntheticsTestPauseStatus; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; -use serde_json::Value; #[tokio::main] async fn main() { @@ -30,7 +30,7 @@ async fn main() { .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget( Box::new(SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(1000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(1000), SyntheticsAssertionType::RESPONSE_TIME, )), )]) diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs index f9e988b52..9631d3b94 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1072503741.rs @@ -7,12 +7,12 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType; use datadog_api_client::datadogV1::model::SyntheticsTestOptions; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestPort; -use serde_json::Value; #[tokio::main] async fn main() { @@ -21,7 +21,7 @@ async fn main() { .assertions(vec![SyntheticsAssertion::SyntheticsAssertionTarget( Box::new(SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN, - Value::from(10), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(10), SyntheticsAssertionType::CERTIFICATE, )), )]) diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs index dbe8b1fd8..8606461ba 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1241981394.rs @@ -11,6 +11,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONPathTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONPathTargetTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionTimingsScope; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsAssertionXPathOperator; @@ -32,133 +33,150 @@ use datadog_api_client::datadogV1::model::SyntheticsTestRequestBodyType; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificate; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificateItem; use datadog_api_client::datadogV1::model::SyntheticsTestRequestProxy; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] async fn main() { - let body = SyntheticsAPITest::new( - SyntheticsAPITestConfig::new() - .assertions(vec![ - SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( - SyntheticsAssertionTarget::new( - SyntheticsAssertionOperator::IS, - Value::from("text/html"), - SyntheticsAssertionType::HEADER, - ) - .property("{{ PROPERTY }}".to_string()), - )), - SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( - SyntheticsAssertionTarget::new( - SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), - SyntheticsAssertionType::RESPONSE_TIME, - ) - .timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS), - )), - SyntheticsAssertion::SyntheticsAssertionJSONPathTarget(Box::new( - SyntheticsAssertionJSONPathTarget::new( - SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH, - SyntheticsAssertionType::BODY, - ) - .target( - SyntheticsAssertionJSONPathTargetTarget::new() - .json_path("topKey".to_string()) - .operator("isNot".to_string()) - .target_value(Value::from("0")), - ), - )), - SyntheticsAssertion::SyntheticsAssertionXPathTarget(Box::new( - SyntheticsAssertionXPathTarget::new( - SyntheticsAssertionXPathOperator::VALIDATES_X_PATH, - SyntheticsAssertionType::BODY, - ) - .target( - SyntheticsAssertionXPathTargetTarget::new() - .operator("contains".to_string()) - .target_value(Value::from("0")) - .x_path("target-xpath".to_string()), - ), - )), - ]) - .config_variables(vec![SyntheticsConfigVariable::new( - "PROPERTY".to_string(), - SyntheticsConfigVariableType::TEXT, - ) - .example("content-type".to_string()) - .pattern("content-type".to_string())]) - .request( - SyntheticsTestRequest::new() - .basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient( - Box::new( - SyntheticsBasicAuthOauthClient::new( - "https://datadog-token.com".to_string(), - "client-id".to_string(), - "client-secret".to_string(), - SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER, - SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT, - ) - .audience("audience".to_string()) - .resource("resource".to_string()) - .scope("yoyo".to_string()), + let body = + SyntheticsAPITest::new( + SyntheticsAPITestConfig::new() + .assertions( + vec![ + SyntheticsAssertion::SyntheticsAssertionTarget( + Box::new( + SyntheticsAssertionTarget::new( + SyntheticsAssertionOperator::IS, + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "text/html".to_string(), + ), + SyntheticsAssertionType::HEADER, + ).property("{{ PROPERTY }}".to_string()), + ), + ), + SyntheticsAssertion::SyntheticsAssertionTarget( + Box::new( + SyntheticsAssertionTarget::new( + SyntheticsAssertionOperator::LESS_THAN, + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), + SyntheticsAssertionType::RESPONSE_TIME, + ).timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS), + ), ), - )) - .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM) - .certificate( - SyntheticsTestRequestCertificate::new() - .cert( - SyntheticsTestRequestCertificateItem::new() - .content("cert-content".to_string()) - .filename("cert-filename".to_string()) - .updated_at("2020-10-16T09:23:24.857Z".to_string()), - ) - .key( - SyntheticsTestRequestCertificateItem::new() - .content("key-content".to_string()) - .filename("key-filename".to_string()) - .updated_at("2020-10-16T09:23:24.857Z".to_string()), + SyntheticsAssertion::SyntheticsAssertionJSONPathTarget( + Box::new( + SyntheticsAssertionJSONPathTarget::new( + SyntheticsAssertionJSONPathOperator::VALIDATES_JSON_PATH, + SyntheticsAssertionType::BODY, + ).target( + SyntheticsAssertionJSONPathTargetTarget::new() + .json_path("topKey".to_string()) + .operator("isNot".to_string()) + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), + ), + ), + ), + SyntheticsAssertion::SyntheticsAssertionXPathTarget( + Box::new( + SyntheticsAssertionXPathTarget::new( + SyntheticsAssertionXPathOperator::VALIDATES_X_PATH, + SyntheticsAssertionType::BODY, + ).target( + SyntheticsAssertionXPathTargetTarget::new() + .operator("contains".to_string()) + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ) + .x_path("target-xpath".to_string()), + ), + ), + ) + ], + ) + .config_variables( + vec![ + SyntheticsConfigVariable::new("PROPERTY".to_string(), SyntheticsConfigVariableType::TEXT) + .example("content-type".to_string()) + .pattern("content-type".to_string()) + ], + ) + .request( + SyntheticsTestRequest::new() + .basic_auth( + SyntheticsBasicAuth::SyntheticsBasicAuthOauthClient( + Box::new( + SyntheticsBasicAuthOauthClient::new( + "https://datadog-token.com".to_string(), + "client-id".to_string(), + "client-secret".to_string(), + SyntheticsBasicAuthOauthTokenApiAuthentication::HEADER, + SyntheticsBasicAuthOauthClientType::OAUTH_CLIENT, + ) + .audience("audience".to_string()) + .resource("resource".to_string()) + .scope("yoyo".to_string()), + ), ), - ) - .files(vec![SyntheticsTestRequestBodyFile::new() - .content("file content".to_string()) - .name("file name".to_string()) - .original_file_name("image.png".to_string()) - .type_("file type".to_string())]) - .headers(BTreeMap::from([( - "unique".to_string(), - "examplesynthetic".to_string(), - )])) - .method("GET".to_string()) - .persist_cookies(true) - .proxy( - SyntheticsTestRequestProxy::new("https://datadoghq.com".to_string()) - .headers(BTreeMap::from([])), - ) - .timeout(10.0 as f64) - .url("https://datadoghq.com".to_string()), - ), - vec!["aws:us-east-2".to_string()], - "BDD test payload: synthetics_api_http_test_payload.json".to_string(), - "Example-Synthetic".to_string(), - SyntheticsTestOptions::new() - .accept_self_signed(false) - .allow_insecure(true) - .follow_redirects(true) - .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2) - .min_failure_duration(10) - .min_location_failed(1) - .monitor_name("Example-Synthetic".to_string()) - .monitor_priority(5) - .retry( - SyntheticsTestOptionsRetry::new() - .count(3) - .interval(10.0 as f64), - ) - .tick_every(60), - SyntheticsAPITestType::API, - ) - .subtype(SyntheticsTestDetailsSubType::HTTP) - .tags(vec!["testing:api".to_string()]); + ) + .body_type(SyntheticsTestRequestBodyType::APPLICATION_OCTET_STREAM) + .certificate( + SyntheticsTestRequestCertificate::new() + .cert( + SyntheticsTestRequestCertificateItem::new() + .content("cert-content".to_string()) + .filename("cert-filename".to_string()) + .updated_at("2020-10-16T09:23:24.857Z".to_string()), + ) + .key( + SyntheticsTestRequestCertificateItem::new() + .content("key-content".to_string()) + .filename("key-filename".to_string()) + .updated_at("2020-10-16T09:23:24.857Z".to_string()), + ), + ) + .files( + vec![ + SyntheticsTestRequestBodyFile::new() + .content("file content".to_string()) + .name("file name".to_string()) + .original_file_name("image.png".to_string()) + .type_("file type".to_string()) + ], + ) + .headers(BTreeMap::from([("unique".to_string(), "examplesynthetic".to_string())])) + .method("GET".to_string()) + .persist_cookies(true) + .proxy( + SyntheticsTestRequestProxy::new( + "https://datadoghq.com".to_string(), + ).headers(BTreeMap::from([])), + ) + .timeout(10.0 as f64) + .url("https://datadoghq.com".to_string()), + ), + vec!["aws:us-east-2".to_string()], + "BDD test payload: synthetics_api_http_test_payload.json".to_string(), + "Example-Synthetic".to_string(), + SyntheticsTestOptions::new() + .accept_self_signed(false) + .allow_insecure(true) + .follow_redirects(true) + .http_version(SyntheticsTestOptionsHTTPVersion::HTTP2) + .min_failure_duration(10) + .min_location_failed(1) + .monitor_name("Example-Synthetic".to_string()) + .monitor_priority(5) + .retry(SyntheticsTestOptionsRetry::new().count(3).interval(10.0 as f64)) + .tick_every(60), + SyntheticsAPITestType::API, + ) + .subtype(SyntheticsTestDetailsSubType::HTTP) + .tags(vec!["testing:api".to_string()]); let configuration = datadog::Configuration::new(); let api = SyntheticsAPI::with_config(configuration); let resp = api.create_synthetics_api_test(body).await; diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs index 83aab9db6..fc458256b 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs @@ -13,6 +13,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAPIWaitStepSubtype; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsConfigVariable; use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType; @@ -27,7 +28,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestPort; use datadog_api_client::datadogV1::model::SyntheticsVariableParser; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -52,7 +52,10 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue + ::SyntheticsAssertionTargetValueNumber( + 200, + ), SyntheticsAssertionType::STATUS_CODE, ), ), @@ -102,7 +105,10 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(1000), + SyntheticsAssertionTargetValue + ::SyntheticsAssertionTargetValueNumber( + 1000, + ), SyntheticsAssertionType::RESPONSE_TIME, ), ), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs index 2e3385766..11006821b 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1402674167.rs @@ -8,13 +8,13 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType; use datadog_api_client::datadogV1::model::SyntheticsTestOptions; use datadog_api_client::datadogV1::model::SyntheticsTestOptionsMonitorOptions; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestPort; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -25,21 +25,25 @@ async fn main() { SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(1), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(1), SyntheticsAssertionType::GRPC_HEALTHCHECK_STATUS, ), )), SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("proto target"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "proto target".to_string(), + ), SyntheticsAssertionType::GRPC_PROTO, ), )), SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("123"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "123".to_string(), + ), SyntheticsAssertionType::GRPC_METADATA, ) .property("property".to_string()), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1487281163.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1487281163.rs index dc0578fda..c08406456 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1487281163.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1487281163.rs @@ -20,6 +20,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionJavascript; use datadog_api_client::datadogV1::model::SyntheticsAssertionJavascriptType; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionTimingsScope; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsAssertionXPathOperator; @@ -39,7 +40,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificate; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificateItem; use datadog_api_client::datadogV1::model::SyntheticsTestRequestProxy; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -53,7 +53,9 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("text/html"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "text/html".to_string(), + ), SyntheticsAssertionType::HEADER, ).property("{{ PROPERTY }}".to_string()), ), @@ -62,7 +64,7 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ).timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS), ), @@ -76,7 +78,11 @@ async fn main() { SyntheticsAssertionJSONPathTargetTarget::new() .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), @@ -90,7 +96,11 @@ async fn main() { .elements_operator("atLeastOneElementMatches".to_string()) .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), @@ -116,7 +126,11 @@ async fn main() { ).target( SyntheticsAssertionXPathTargetTarget::new() .operator("contains".to_string()) - .target_value(Value::from("0")) + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ) .x_path("target-xpath".to_string()), ), ), @@ -125,7 +139,9 @@ async fn main() { Box::new( SyntheticsAssertionBodyHashTarget::new( SyntheticsAssertionBodyHashOperator::MD5, - Value::from("a"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "a".to_string(), + ), SyntheticsAssertionBodyHashType::BODY_HASH, ), ), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs index 8dee52ac5..9392478c3 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs @@ -11,6 +11,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsBasicAuth; use datadog_api_client::datadogV1::model::SyntheticsBasicAuthDigest; @@ -29,7 +30,6 @@ use datadog_api_client::datadogV1::model::SyntheticsBasicAuthWebType; use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType; use datadog_api_client::datadogV1::model::SyntheticsTestOptions; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; -use serde_json::Value; #[tokio::main] async fn main() { @@ -39,7 +39,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -56,7 +56,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -74,7 +74,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -95,7 +95,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -112,7 +112,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -133,7 +133,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], @@ -156,7 +156,7 @@ async fn main() { vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from(200), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(200), SyntheticsAssertionType::STATUS_CODE, ), ))], diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_1987645492.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_1987645492.rs index f6dcf39ee..017b7b15c 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_1987645492.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_1987645492.rs @@ -19,6 +19,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionJavascript; use datadog_api_client::datadogV1::model::SyntheticsAssertionJavascriptType; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionTimingsScope; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsAssertionXPathOperator; @@ -38,7 +39,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificate; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificateItem; use datadog_api_client::datadogV1::model::SyntheticsTestRequestProxy; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -52,7 +52,9 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("text/html"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "text/html".to_string(), + ), SyntheticsAssertionType::HEADER, ).property("{{ PROPERTY }}".to_string()), ), @@ -61,7 +63,7 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ).timings_scope(SyntheticsAssertionTimingsScope::WITHOUT_DNS), ), @@ -75,7 +77,11 @@ async fn main() { SyntheticsAssertionJSONPathTargetTarget::new() .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), @@ -89,7 +95,11 @@ async fn main() { .elements_operator("atLeastOneElementMatches".to_string()) .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), @@ -115,7 +125,11 @@ async fn main() { ).target( SyntheticsAssertionXPathTargetTarget::new() .operator("contains".to_string()) - .target_value(Value::from("0")) + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ) .x_path("target-xpath".to_string()), ), ), @@ -124,7 +138,9 @@ async fn main() { Box::new( SyntheticsAssertionBodyHashTarget::new( SyntheticsAssertionBodyHashOperator::MD5, - Value::from("a"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "a".to_string(), + ), SyntheticsAssertionBodyHashType::BODY_HASH, ), ), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs index 48bff2795..b1aacac9a 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_2472747642.rs @@ -8,12 +8,12 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType; use datadog_api_client::datadogV1::model::SyntheticsTestOptions; use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; -use serde_json::Value; #[tokio::main] async fn main() { @@ -23,14 +23,16 @@ async fn main() { SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("message"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "message".to_string(), + ), SyntheticsAssertionType::RECEIVED_MESSAGE, ), )), SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ), )), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs index 78b238695..044a49442 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_3829801148.rs @@ -8,13 +8,13 @@ use datadog_api_client::datadogV1::model::SyntheticsAPITestType; use datadog_api_client::datadogV1::model::SyntheticsAssertion; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType; use datadog_api_client::datadogV1::model::SyntheticsTestOptions; use datadog_api_client::datadogV1::model::SyntheticsTestOptionsRetry; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestPort; -use serde_json::Value; #[tokio::main] async fn main() { @@ -24,14 +24,16 @@ async fn main() { SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("message"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "message".to_string(), + ), SyntheticsAssertionType::RECEIVED_MESSAGE, ), )), SyntheticsAssertion::SyntheticsAssertionTarget(Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ), )), diff --git a/examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs b/examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs index cbf7e19f0..c7327daf7 100644 --- a/examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs +++ b/examples/v1_synthetics_CreateSyntheticsAPITest_960766374.rs @@ -15,6 +15,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTargetTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsAssertionXPathOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionXPathTarget; @@ -32,7 +33,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificate; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificateItem; use datadog_api_client::datadogV1::model::SyntheticsTestRequestProxy; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -46,7 +46,9 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("text/html"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "text/html".to_string(), + ), SyntheticsAssertionType::HEADER, ).property("{{ PROPERTY }}".to_string()), ), @@ -55,7 +57,7 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ), ), @@ -69,7 +71,11 @@ async fn main() { SyntheticsAssertionJSONPathTargetTarget::new() .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), @@ -95,7 +101,11 @@ async fn main() { ).target( SyntheticsAssertionXPathTargetTarget::new() .operator("contains".to_string()) - .target_value(Value::from("0")) + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ) .x_path("target-xpath".to_string()), ), ), diff --git a/examples/v1_synthetics_UpdateAPITest.rs b/examples/v1_synthetics_UpdateAPITest.rs index 811cbf7d7..e695ead91 100644 --- a/examples/v1_synthetics_UpdateAPITest.rs +++ b/examples/v1_synthetics_UpdateAPITest.rs @@ -14,6 +14,7 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionJSONSchemaTargetTarget; use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator; use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget; +use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue; use datadog_api_client::datadogV1::model::SyntheticsAssertionType; use datadog_api_client::datadogV1::model::SyntheticsConfigVariable; use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType; @@ -24,7 +25,6 @@ use datadog_api_client::datadogV1::model::SyntheticsTestPauseStatus; use datadog_api_client::datadogV1::model::SyntheticsTestRequest; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificate; use datadog_api_client::datadogV1::model::SyntheticsTestRequestCertificateItem; -use serde_json::Value; use std::collections::BTreeMap; #[tokio::main] @@ -40,7 +40,9 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::IS, - Value::from("text/html"), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "text/html".to_string(), + ), SyntheticsAssertionType::HEADER, ).property("{{ PROPERTY }}".to_string()), ), @@ -49,7 +51,7 @@ async fn main() { Box::new( SyntheticsAssertionTarget::new( SyntheticsAssertionOperator::LESS_THAN, - Value::from(2000), + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(2000), SyntheticsAssertionType::RESPONSE_TIME, ), ), @@ -63,7 +65,11 @@ async fn main() { SyntheticsAssertionJSONPathTargetTarget::new() .json_path("topKey".to_string()) .operator("isNot".to_string()) - .target_value(Value::from("0")), + .target_value( + SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString( + "0".to_string(), + ), + ), ), ), ), diff --git a/src/datadogV1/model/mod.rs b/src/datadogV1/model/mod.rs index 53204efc8..06116f697 100644 --- a/src/datadogV1/model/mod.rs +++ b/src/datadogV1/model/mod.rs @@ -1342,6 +1342,8 @@ pub mod model_synthetics_assertion_target; pub use self::model_synthetics_assertion_target::SyntheticsAssertionTarget; pub mod model_synthetics_assertion_operator; pub use self::model_synthetics_assertion_operator::SyntheticsAssertionOperator; +pub mod model_synthetics_assertion_target_value; +pub use self::model_synthetics_assertion_target_value::SyntheticsAssertionTargetValue; pub mod model_synthetics_assertion_timings_scope; pub use self::model_synthetics_assertion_timings_scope::SyntheticsAssertionTimingsScope; pub mod model_synthetics_assertion_type; diff --git a/src/datadogV1/model/model_synthetics_assertion_body_hash_target.rs b/src/datadogV1/model/model_synthetics_assertion_body_hash_target.rs index 48db0ed33..0ecbf903a 100644 --- a/src/datadogV1/model/model_synthetics_assertion_body_hash_target.rs +++ b/src/datadogV1/model/model_synthetics_assertion_body_hash_target.rs @@ -14,9 +14,9 @@ pub struct SyntheticsAssertionBodyHashTarget { /// Assertion operator to apply. #[serde(rename = "operator")] pub operator: crate::datadogV1::model::SyntheticsAssertionBodyHashOperator, - /// Value used by the operator. + /// Value used by the operator in assertions. Can be either a number or string. #[serde(rename = "target")] - pub target: serde_json::Value, + pub target: crate::datadogV1::model::SyntheticsAssertionTargetValue, /// Type of the assertion. #[serde(rename = "type")] pub type_: crate::datadogV1::model::SyntheticsAssertionBodyHashType, @@ -30,7 +30,7 @@ pub struct SyntheticsAssertionBodyHashTarget { impl SyntheticsAssertionBodyHashTarget { pub fn new( operator: crate::datadogV1::model::SyntheticsAssertionBodyHashOperator, - target: serde_json::Value, + target: crate::datadogV1::model::SyntheticsAssertionTargetValue, type_: crate::datadogV1::model::SyntheticsAssertionBodyHashType, ) -> SyntheticsAssertionBodyHashTarget { SyntheticsAssertionBodyHashTarget { @@ -71,7 +71,8 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionBodyHashTarget { let mut operator: Option< crate::datadogV1::model::SyntheticsAssertionBodyHashOperator, > = None; - let mut target: Option = None; + let mut target: Option = + None; let mut type_: Option = None; let mut additional_properties: std::collections::BTreeMap< @@ -95,6 +96,14 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionBodyHashTarget { } "target" => { target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target) = target { + match _target { + crate::datadogV1::model::SyntheticsAssertionTargetValue::UnparsedObject(_target) => { + _unparsed = true; + }, + _ => {} + } + } } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); diff --git a/src/datadogV1/model/model_synthetics_assertion_json_path_target_target.rs b/src/datadogV1/model/model_synthetics_assertion_json_path_target_target.rs index 3d8930864..173660b93 100644 --- a/src/datadogV1/model/model_synthetics_assertion_json_path_target_target.rs +++ b/src/datadogV1/model/model_synthetics_assertion_json_path_target_target.rs @@ -20,9 +20,9 @@ pub struct SyntheticsAssertionJSONPathTargetTarget { /// The specific operator to use on the path. #[serde(rename = "operator")] pub operator: Option, - /// The path target value to compare to. + /// Value used by the operator in assertions. Can be either a number or string. #[serde(rename = "targetValue")] - pub target_value: Option, + pub target_value: Option, #[serde(flatten)] pub additional_properties: std::collections::BTreeMap, #[serde(skip)] @@ -57,7 +57,10 @@ impl SyntheticsAssertionJSONPathTargetTarget { self } - pub fn target_value(mut self, value: serde_json::Value) -> Self { + pub fn target_value( + mut self, + value: crate::datadogV1::model::SyntheticsAssertionTargetValue, + ) -> Self { self.target_value = Some(value); self } @@ -97,7 +100,9 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionJSONPathTargetTarget { let mut elements_operator: Option = None; let mut json_path: Option = None; let mut operator: Option = None; - let mut target_value: Option = None; + let mut target_value: Option< + crate::datadogV1::model::SyntheticsAssertionTargetValue, + > = None; let mut additional_properties: std::collections::BTreeMap< String, serde_json::Value, @@ -131,6 +136,14 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionJSONPathTargetTarget { } target_value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target_value) = target_value { + match _target_value { + crate::datadogV1::model::SyntheticsAssertionTargetValue::UnparsedObject(_target_value) => { + _unparsed = true; + }, + _ => {} + } + } } &_ => { if let Ok(value) = serde_json::from_value(v.clone()) { diff --git a/src/datadogV1/model/model_synthetics_assertion_target.rs b/src/datadogV1/model/model_synthetics_assertion_target.rs index 568bc0e2f..ef5885d66 100644 --- a/src/datadogV1/model/model_synthetics_assertion_target.rs +++ b/src/datadogV1/model/model_synthetics_assertion_target.rs @@ -17,9 +17,9 @@ pub struct SyntheticsAssertionTarget { /// The associated assertion property. #[serde(rename = "property")] pub property: Option, - /// Value used by the operator. + /// Value used by the operator in assertions. Can be either a number or string. #[serde(rename = "target")] - pub target: serde_json::Value, + pub target: crate::datadogV1::model::SyntheticsAssertionTargetValue, /// Timings scope for response time assertions. #[serde(rename = "timingsScope")] pub timings_scope: Option, @@ -36,7 +36,7 @@ pub struct SyntheticsAssertionTarget { impl SyntheticsAssertionTarget { pub fn new( operator: crate::datadogV1::model::SyntheticsAssertionOperator, - target: serde_json::Value, + target: crate::datadogV1::model::SyntheticsAssertionTargetValue, type_: crate::datadogV1::model::SyntheticsAssertionType, ) -> SyntheticsAssertionTarget { SyntheticsAssertionTarget { @@ -92,7 +92,8 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionTarget { let mut operator: Option = None; let mut property: Option = None; - let mut target: Option = None; + let mut target: Option = + None; let mut timings_scope: Option< crate::datadogV1::model::SyntheticsAssertionTimingsScope, > = None; @@ -124,6 +125,14 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionTarget { } "target" => { target = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target) = target { + match _target { + crate::datadogV1::model::SyntheticsAssertionTargetValue::UnparsedObject(_target) => { + _unparsed = true; + }, + _ => {} + } + } } "timingsScope" => { if v.is_null() { diff --git a/src/datadogV1/model/model_synthetics_assertion_target_value.rs b/src/datadogV1/model/model_synthetics_assertion_target_value.rs new file mode 100644 index 000000000..901facb69 --- /dev/null +++ b/src/datadogV1/model/model_synthetics_assertion_target_value.rs @@ -0,0 +1,33 @@ +// 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}; + +/// Value used by the operator in assertions. Can be either a number or string. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum SyntheticsAssertionTargetValue { + SyntheticsAssertionTargetValueNumber(i64), + SyntheticsAssertionTargetValueString(String), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for SyntheticsAssertionTargetValue { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(_v)); + } + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueString(_v)); + } + + return Ok(SyntheticsAssertionTargetValue::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV1/model/model_synthetics_assertion_x_path_target_target.rs b/src/datadogV1/model/model_synthetics_assertion_x_path_target_target.rs index 611de2903..27ac22eb3 100644 --- a/src/datadogV1/model/model_synthetics_assertion_x_path_target_target.rs +++ b/src/datadogV1/model/model_synthetics_assertion_x_path_target_target.rs @@ -14,9 +14,9 @@ pub struct SyntheticsAssertionXPathTargetTarget { /// The specific operator to use on the path. #[serde(rename = "operator")] pub operator: Option, - /// The path target value to compare to. + /// Value used by the operator in assertions. Can be either a number or string. #[serde(rename = "targetValue")] - pub target_value: Option, + pub target_value: Option, /// The X path to assert. #[serde(rename = "xPath")] pub x_path: Option, @@ -43,7 +43,10 @@ impl SyntheticsAssertionXPathTargetTarget { self } - pub fn target_value(mut self, value: serde_json::Value) -> Self { + pub fn target_value( + mut self, + value: crate::datadogV1::model::SyntheticsAssertionTargetValue, + ) -> Self { self.target_value = Some(value); self } @@ -86,7 +89,9 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionXPathTargetTarget { M: MapAccess<'a>, { let mut operator: Option = None; - let mut target_value: Option = None; + let mut target_value: Option< + crate::datadogV1::model::SyntheticsAssertionTargetValue, + > = None; let mut x_path: Option = None; let mut additional_properties: std::collections::BTreeMap< String, @@ -108,6 +113,14 @@ impl<'de> Deserialize<'de> for SyntheticsAssertionXPathTargetTarget { } target_value = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _target_value) = target_value { + match _target_value { + crate::datadogV1::model::SyntheticsAssertionTargetValue::UnparsedObject(_target_value) => { + _unparsed = true; + }, + _ => {} + } + } } "xPath" => { if v.is_null() {