From 68e45914141e7ef3dc95c0203e1966cb5c088607 Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Fri, 17 Nov 2023 16:39:24 -0500 Subject: [PATCH] fix number and bool parameters, optimize regex and templating with lazy static --- .../generator/templates/function_mappings.j2 | 14 +- .generator/src/generator/templates/model.j2 | 1 - .../src/generator/templates/model_enum.j2 | 17 +- .../src/generator/templates/model_simple.j2 | 1 + Cargo.toml | 4 +- src/datadogV1/model/model_access_role.rs | 1 + .../model_aws_event_bridge_create_status.rs | 1 + .../model_aws_event_bridge_delete_status.rs | 1 + src/datadogV1/model/model_aws_namespace.rs | 1 + src/datadogV1/model/model_content_encoding.rs | 1 + src/datadogV1/model/model_event_alert_type.rs | 1 + src/datadogV1/model/model_event_priority.rs | 1 + ...del_hourly_usage_attribution_usage_type.rs | 1 + src/datadogV1/model/model_logs_sort.rs | 1 + .../model/model_metric_content_encoding.rs | 1 + ...hly_usage_attribution_supported_metrics.rs | 1 + src/datadogV1/model/model_notify_end_state.rs | 1 + src/datadogV1/model/model_notify_end_type.rs | 1 + .../model/model_search_slo_timeframe.rs | 1 + .../model/model_service_check_status.rs | 20 +- .../model/model_signal_archive_reason.rs | 1 + .../model/model_signal_triage_state.rs | 1 + .../model/model_slo_correction_category.rs | 1 + .../model/model_slo_correction_type.rs | 1 + .../model/model_slo_error_timeframe.rs | 1 + src/datadogV1/model/model_slo_state.rs | 1 + src/datadogV1/model/model_slo_timeframe.rs | 1 + src/datadogV1/model/model_slo_type.rs | 1 + src/datadogV1/model/model_slo_type_numeric.rs | 14 +- .../model/model_usage_attribution_sort.rs | 1 + ...del_usage_attribution_supported_metrics.rs | 1 + .../model/model_usage_metric_category.rs | 1 + .../model/model_usage_reports_type.rs | 1 + src/datadogV1/model/model_usage_sort.rs | 1 + .../model/model_usage_sort_direction.rs | 1 + .../model_webhooks_integration_encoding.rs | 1 + .../model/model_apm_retention_filter_type.rs | 1 + .../model/model_audit_logs_event_type.rs | 1 + .../model/model_audit_logs_response_status.rs | 1 + src/datadogV2/model/model_audit_logs_sort.rs | 1 + ...cloud_workload_security_agent_rule_type.rs | 1 + .../model/model_cloudflare_account_type.rs | 1 + .../model/model_confluent_account_type.rs | 1 + .../model/model_confluent_resource_type.rs | 1 + src/datadogV2/model/model_content_encoding.rs | 1 + src/datadogV2/model/model_cost_by_org_type.rs | 1 + src/datadogV2/model/model_dashboard_type.rs | 1 + .../model/model_detailed_finding_type.rs | 1 + src/datadogV2/model/model_event_priority.rs | 1 + .../model/model_event_status_type.rs | 1 + src/datadogV2/model/model_event_type.rs | 1 + src/datadogV2/model/model_events_sort.rs | 1 + .../model/model_fastly_account_type.rs | 1 + .../model/model_fastly_service_type.rs | 1 + .../model/model_finding_evaluation.rs | 1 + .../model/model_finding_mute_reason.rs | 1 + src/datadogV2/model/model_finding_status.rs | 1 + src/datadogV2/model/model_finding_type.rs | 1 + .../model/model_gcp_service_account_type.rs | 1 + .../model_gcpsts_delegate_account_type.rs | 1 + .../model/model_hourly_usage_type.rs | 1 + .../model/model_ip_allowlist_entry_type.rs | 1 + .../model/model_ip_allowlist_type.rs | 1 + ...el_logs_metric_compute_aggregation_type.rs | 1 + ...etric_response_compute_aggregation_type.rs | 1 + src/datadogV2/model/model_logs_metric_type.rs | 1 + .../model/model_metric_content_encoding.rs | 1 + .../model/model_metric_intake_type.rs | 20 +- .../model_on_demand_concurrency_cap_type.rs | 1 + .../model_opsgenie_service_region_type.rs | 1 + .../model/model_opsgenie_service_type.rs | 1 + src/datadogV2/model/model_permissions_type.rs | 1 + .../model/model_process_summary_type.rs | 1 + .../model/model_restriction_policy_type.rs | 1 + .../model/model_retention_filter_all_type.rs | 1 + .../model/model_retention_filter_type.rs | 1 + ...l_spans_metric_compute_aggregation_type.rs | 1 + .../model/model_spans_metric_type.rs | 1 + .../model/model_usage_time_series_type.rs | 1 + tests/main.rs | 35 +- tests/scenarios/fixtures.rs | 77 +- tests/scenarios/function_mappings.rs | 984 +++++++++--------- 82 files changed, 697 insertions(+), 561 deletions(-) diff --git a/.generator/src/generator/templates/function_mappings.j2 b/.generator/src/generator/templates/function_mappings.j2 index 45e002055..db0127396 100644 --- a/.generator/src/generator/templates/function_mappings.j2 +++ b/.generator/src/generator/templates/function_mappings.j2 @@ -40,7 +40,7 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { {%- for version, apis in all_apis.items() %} {%- for _, operations in apis.items() %} {%- for _, _, operation in operations %} - world.function_mappings.insert("{{ operation['operationId'] }}".to_string(), test_{{version}}_{{ operation['operationId'] | snake_case }}); + world.function_mappings.insert("{{version}}.{{ operation['operationId'] }}".to_string(), test_{{version}}_{{ operation['operationId'] | snake_case }}); {%- endfor %} {%- endfor %} {%- endfor %} @@ -57,17 +57,17 @@ fn test_{{version}}_{{ operation['operationId'] | snake_case }}(world: &mut Data {%- for parameter in operationParams %} {%- set schema = parameter[1] | parameter_schema %} {%- if parameter[1].required %} + {%- if schema | is_primitive and schema.get("format") == "binary" -%} + let {{ parameter[0] | variable_name }} = _parameters.get("{{ parameter[0] }}").unwrap().as_str().unwrap().as_bytes().to_vec(); + {%- else -%} let {{ parameter[0] | variable_name }} = serde_json::from_value(_parameters.get("{{ parameter[0] }}").unwrap().clone()).unwrap(); + {%- endif -%} {%- else %} let {{ parameter[0] | variable_name }} = if let Some(param) = _parameters.get("{{ parameter[0] }}") { - {%- if schema | is_primitive -%} - {%- if schema.get("format") == "binary" -%} + {%- if schema | is_primitive and schema.get("format") == "binary" -%} Some(param.as_str().unwrap().as_bytes().to_vec()) {%- else -%} - Some(param.as_str().unwrap().parse().unwrap()) - {%- endif -%} - {%- else -%} - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) {%- endif -%} } else { None diff --git a/.generator/src/generator/templates/model.j2 b/.generator/src/generator/templates/model.j2 index ed17ff6ef..e58604aa6 100644 --- a/.generator/src/generator/templates/model.j2 +++ b/.generator/src/generator/templates/model.j2 @@ -1,5 +1,4 @@ {% include "partial_header.j2" %} -use serde::{Serialize, Deserialize}; {% if "enum" in model -%} {% include "model_enum.j2" %} {%- elif "oneOf" in model -%} diff --git a/.generator/src/generator/templates/model_enum.j2 b/.generator/src/generator/templates/model_enum.j2 index 4be9d183a..c4e7cf4f7 100644 --- a/.generator/src/generator/templates/model_enum.j2 +++ b/.generator/src/generator/templates/model_enum.j2 @@ -1,11 +1,26 @@ -{%- if description is defined %} +{%- if model["type"] == "integer" %} +use serde_repr::{Deserialize_repr, Serialize_repr}; +{%- else %} +use serde::{Serialize, Deserialize}; +{%- endif %} +{% if description is defined %} {{ description | block_comment }} {%- endif %} + +{%- if model["type"] == "integer" %} +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +#[repr({{model | simple_type(False, False)}})] +{%- else %} #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +{%- endif %} pub enum {{name}} { {%- for index, value in enumerate(model.enum) %} +{%- if model["type"] == "integer" %} + {{ model["x-enum-varnames"][index] or value.upper() }} = {{value}}, +{%- else %} #[serde(rename = "{{value}}")] {{ model["x-enum-varnames"][index] or value.upper() }}, +{%- endif %} {%- endfor %} } diff --git a/.generator/src/generator/templates/model_simple.j2 b/.generator/src/generator/templates/model_simple.j2 index 04a60fa16..576e1533a 100644 --- a/.generator/src/generator/templates/model_simple.j2 +++ b/.generator/src/generator/templates/model_simple.j2 @@ -1,3 +1,4 @@ +use serde::{Serialize, Deserialize}; use serde_with::skip_serializing_none; {{ model.description | block_comment }} diff --git a/Cargo.toml b/Cargo.toml index d49089423..626114c12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ rustc_version = "0.4.0" serde = "^1.0" serde_derive = "^1.0" serde_json = "^1.0" +serde_repr = "0.1.17" serde_with = "^2.0" url = "^2.2" @@ -28,7 +29,8 @@ rvcr = { git = "https://github.com/nkzou/rvcr.git", rev = "b8f84bc0dfacd539fdc6f vcr-cassette = "^2.0" sha256 = "1.4.0" tokio = { version = "1.10", features = ["macros", "rt-multi-thread", "time"] } +lazy_static = "1.4.0" [[test]] harness = false # allows Cucumber to print output instead of libtest -name = "main" \ No newline at end of file +name = "main" diff --git a/src/datadogV1/model/model_access_role.rs b/src/datadogV1/model/model_access_role.rs index c8b667953..cf5c12d31 100644 --- a/src/datadogV1/model/model_access_role.rs +++ b/src/datadogV1/model/model_access_role.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_aws_event_bridge_create_status.rs b/src/datadogV1/model/model_aws_event_bridge_create_status.rs index 452dfbd27..0bcc1a66a 100644 --- a/src/datadogV1/model/model_aws_event_bridge_create_status.rs +++ b/src/datadogV1/model/model_aws_event_bridge_create_status.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_aws_event_bridge_delete_status.rs b/src/datadogV1/model/model_aws_event_bridge_delete_status.rs index af7186457..856a6ef9c 100644 --- a/src/datadogV1/model/model_aws_event_bridge_delete_status.rs +++ b/src/datadogV1/model/model_aws_event_bridge_delete_status.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_aws_namespace.rs b/src/datadogV1/model/model_aws_namespace.rs index 8f55aace7..7dae91e26 100644 --- a/src/datadogV1/model/model_aws_namespace.rs +++ b/src/datadogV1/model/model_aws_namespace.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_content_encoding.rs b/src/datadogV1/model/model_content_encoding.rs index 0b0055b82..b02d60db0 100644 --- a/src/datadogV1/model/model_content_encoding.rs +++ b/src/datadogV1/model/model_content_encoding.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_event_alert_type.rs b/src/datadogV1/model/model_event_alert_type.rs index 681abb351..d110685e3 100644 --- a/src/datadogV1/model/model_event_alert_type.rs +++ b/src/datadogV1/model/model_event_alert_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_event_priority.rs b/src/datadogV1/model/model_event_priority.rs index 4157e2a2c..f6c339c74 100644 --- a/src/datadogV1/model/model_event_priority.rs +++ b/src/datadogV1/model/model_event_priority.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_hourly_usage_attribution_usage_type.rs b/src/datadogV1/model/model_hourly_usage_attribution_usage_type.rs index 517932ffa..95bb2a2fa 100644 --- a/src/datadogV1/model/model_hourly_usage_attribution_usage_type.rs +++ b/src/datadogV1/model/model_hourly_usage_attribution_usage_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_logs_sort.rs b/src/datadogV1/model/model_logs_sort.rs index 2c150049d..61e4f60a3 100644 --- a/src/datadogV1/model/model_logs_sort.rs +++ b/src/datadogV1/model/model_logs_sort.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_metric_content_encoding.rs b/src/datadogV1/model/model_metric_content_encoding.rs index ac7a86c8e..98acbd9e2 100644 --- a/src/datadogV1/model/model_metric_content_encoding.rs +++ b/src/datadogV1/model/model_metric_content_encoding.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_monthly_usage_attribution_supported_metrics.rs b/src/datadogV1/model/model_monthly_usage_attribution_supported_metrics.rs index fb56a8e41..4afa1f0d3 100644 --- a/src/datadogV1/model/model_monthly_usage_attribution_supported_metrics.rs +++ b/src/datadogV1/model/model_monthly_usage_attribution_supported_metrics.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_notify_end_state.rs b/src/datadogV1/model/model_notify_end_state.rs index c3840a8e6..06af46dc4 100644 --- a/src/datadogV1/model/model_notify_end_state.rs +++ b/src/datadogV1/model/model_notify_end_state.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_notify_end_type.rs b/src/datadogV1/model/model_notify_end_type.rs index 0458189c1..3b0e20969 100644 --- a/src/datadogV1/model/model_notify_end_type.rs +++ b/src/datadogV1/model/model_notify_end_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_search_slo_timeframe.rs b/src/datadogV1/model/model_search_slo_timeframe.rs index ac9360143..63e5de5c6 100644 --- a/src/datadogV1/model/model_search_slo_timeframe.rs +++ b/src/datadogV1/model/model_search_slo_timeframe.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_service_check_status.rs b/src/datadogV1/model/model_service_check_status.rs index 14e391269..6dd3d5468 100644 --- a/src/datadogV1/model/model_service_check_status.rs +++ b/src/datadogV1/model/model_service_check_status.rs @@ -1,18 +1,18 @@ // 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, Serialize}; -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +use serde_repr::{Deserialize_repr, Serialize_repr}; + +#[derive( + Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, +)] +#[repr(i32)] pub enum ServiceCheckStatus { - #[serde(rename = "0")] - OK, - #[serde(rename = "1")] - WARNING, - #[serde(rename = "2")] - CRITICAL, - #[serde(rename = "3")] - UNKNOWN, + OK = 0, + WARNING = 1, + CRITICAL = 2, + UNKNOWN = 3, } impl ToString for ServiceCheckStatus { diff --git a/src/datadogV1/model/model_signal_archive_reason.rs b/src/datadogV1/model/model_signal_archive_reason.rs index 39ee1e55b..b64bc29ed 100644 --- a/src/datadogV1/model/model_signal_archive_reason.rs +++ b/src/datadogV1/model/model_signal_archive_reason.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_signal_triage_state.rs b/src/datadogV1/model/model_signal_triage_state.rs index 04a29cd1d..30b682d3d 100644 --- a/src/datadogV1/model/model_signal_triage_state.rs +++ b/src/datadogV1/model/model_signal_triage_state.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_correction_category.rs b/src/datadogV1/model/model_slo_correction_category.rs index 6edf3d247..4c91babdb 100644 --- a/src/datadogV1/model/model_slo_correction_category.rs +++ b/src/datadogV1/model/model_slo_correction_category.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_correction_type.rs b/src/datadogV1/model/model_slo_correction_type.rs index 553963531..ff8a81156 100644 --- a/src/datadogV1/model/model_slo_correction_type.rs +++ b/src/datadogV1/model/model_slo_correction_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_error_timeframe.rs b/src/datadogV1/model/model_slo_error_timeframe.rs index 946220b00..c79936596 100644 --- a/src/datadogV1/model/model_slo_error_timeframe.rs +++ b/src/datadogV1/model/model_slo_error_timeframe.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_state.rs b/src/datadogV1/model/model_slo_state.rs index f35334ebe..a4e9fa92e 100644 --- a/src/datadogV1/model/model_slo_state.rs +++ b/src/datadogV1/model/model_slo_state.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_timeframe.rs b/src/datadogV1/model/model_slo_timeframe.rs index 2982f9686..a4a93e4bd 100644 --- a/src/datadogV1/model/model_slo_timeframe.rs +++ b/src/datadogV1/model/model_slo_timeframe.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_type.rs b/src/datadogV1/model/model_slo_type.rs index b6a8404c8..f61e39a95 100644 --- a/src/datadogV1/model/model_slo_type.rs +++ b/src/datadogV1/model/model_slo_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_slo_type_numeric.rs b/src/datadogV1/model/model_slo_type_numeric.rs index 14938b536..e43ab8c6a 100644 --- a/src/datadogV1/model/model_slo_type_numeric.rs +++ b/src/datadogV1/model/model_slo_type_numeric.rs @@ -1,14 +1,16 @@ // 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, Serialize}; -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +use serde_repr::{Deserialize_repr, Serialize_repr}; + +#[derive( + Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, +)] +#[repr(i32)] pub enum SLOTypeNumeric { - #[serde(rename = "0")] - MONITOR, - #[serde(rename = "1")] - METRIC, + MONITOR = 0, + METRIC = 1, } impl ToString for SLOTypeNumeric { diff --git a/src/datadogV1/model/model_usage_attribution_sort.rs b/src/datadogV1/model/model_usage_attribution_sort.rs index 8fad80b41..94d32a206 100644 --- a/src/datadogV1/model/model_usage_attribution_sort.rs +++ b/src/datadogV1/model/model_usage_attribution_sort.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_usage_attribution_supported_metrics.rs b/src/datadogV1/model/model_usage_attribution_supported_metrics.rs index 1a275d58c..79fc8dbaa 100644 --- a/src/datadogV1/model/model_usage_attribution_supported_metrics.rs +++ b/src/datadogV1/model/model_usage_attribution_supported_metrics.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_usage_metric_category.rs b/src/datadogV1/model/model_usage_metric_category.rs index 90379d40f..46d72f923 100644 --- a/src/datadogV1/model/model_usage_metric_category.rs +++ b/src/datadogV1/model/model_usage_metric_category.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_usage_reports_type.rs b/src/datadogV1/model/model_usage_reports_type.rs index 995364435..f1b302ab3 100644 --- a/src/datadogV1/model/model_usage_reports_type.rs +++ b/src/datadogV1/model/model_usage_reports_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_usage_sort.rs b/src/datadogV1/model/model_usage_sort.rs index 381fd4bbd..bb2cd7758 100644 --- a/src/datadogV1/model/model_usage_sort.rs +++ b/src/datadogV1/model/model_usage_sort.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_usage_sort_direction.rs b/src/datadogV1/model/model_usage_sort_direction.rs index e6529cce9..f90d44d9d 100644 --- a/src/datadogV1/model/model_usage_sort_direction.rs +++ b/src/datadogV1/model/model_usage_sort_direction.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV1/model/model_webhooks_integration_encoding.rs b/src/datadogV1/model/model_webhooks_integration_encoding.rs index b181f7b9f..087193ed3 100644 --- a/src/datadogV1/model/model_webhooks_integration_encoding.rs +++ b/src/datadogV1/model/model_webhooks_integration_encoding.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_apm_retention_filter_type.rs b/src/datadogV2/model/model_apm_retention_filter_type.rs index b27a697c6..77210a0bf 100644 --- a/src/datadogV2/model/model_apm_retention_filter_type.rs +++ b/src/datadogV2/model/model_apm_retention_filter_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_audit_logs_event_type.rs b/src/datadogV2/model/model_audit_logs_event_type.rs index 22fe2effe..e4bcaf7d6 100644 --- a/src/datadogV2/model/model_audit_logs_event_type.rs +++ b/src/datadogV2/model/model_audit_logs_event_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_audit_logs_response_status.rs b/src/datadogV2/model/model_audit_logs_response_status.rs index 4cbd26858..7c748e36b 100644 --- a/src/datadogV2/model/model_audit_logs_response_status.rs +++ b/src/datadogV2/model/model_audit_logs_response_status.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_audit_logs_sort.rs b/src/datadogV2/model/model_audit_logs_sort.rs index 8a9943fe3..12c142be4 100644 --- a/src/datadogV2/model/model_audit_logs_sort.rs +++ b/src/datadogV2/model/model_audit_logs_sort.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_cloud_workload_security_agent_rule_type.rs b/src/datadogV2/model/model_cloud_workload_security_agent_rule_type.rs index 0842c9482..dd15e9b6f 100644 --- a/src/datadogV2/model/model_cloud_workload_security_agent_rule_type.rs +++ b/src/datadogV2/model/model_cloud_workload_security_agent_rule_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_cloudflare_account_type.rs b/src/datadogV2/model/model_cloudflare_account_type.rs index 684b19472..87e7336ad 100644 --- a/src/datadogV2/model/model_cloudflare_account_type.rs +++ b/src/datadogV2/model/model_cloudflare_account_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_confluent_account_type.rs b/src/datadogV2/model/model_confluent_account_type.rs index 3aab253a7..4202fec8b 100644 --- a/src/datadogV2/model/model_confluent_account_type.rs +++ b/src/datadogV2/model/model_confluent_account_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_confluent_resource_type.rs b/src/datadogV2/model/model_confluent_resource_type.rs index 423a67657..621ccf466 100644 --- a/src/datadogV2/model/model_confluent_resource_type.rs +++ b/src/datadogV2/model/model_confluent_resource_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_content_encoding.rs b/src/datadogV2/model/model_content_encoding.rs index c04c09ae1..11f72b34b 100644 --- a/src/datadogV2/model/model_content_encoding.rs +++ b/src/datadogV2/model/model_content_encoding.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_cost_by_org_type.rs b/src/datadogV2/model/model_cost_by_org_type.rs index 378edeb28..7e81c4610 100644 --- a/src/datadogV2/model/model_cost_by_org_type.rs +++ b/src/datadogV2/model/model_cost_by_org_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_dashboard_type.rs b/src/datadogV2/model/model_dashboard_type.rs index 56a277d5d..2ba607a03 100644 --- a/src/datadogV2/model/model_dashboard_type.rs +++ b/src/datadogV2/model/model_dashboard_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_detailed_finding_type.rs b/src/datadogV2/model/model_detailed_finding_type.rs index 66e9f7d75..1b95316ec 100644 --- a/src/datadogV2/model/model_detailed_finding_type.rs +++ b/src/datadogV2/model/model_detailed_finding_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_event_priority.rs b/src/datadogV2/model/model_event_priority.rs index 4157e2a2c..f6c339c74 100644 --- a/src/datadogV2/model/model_event_priority.rs +++ b/src/datadogV2/model/model_event_priority.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_event_status_type.rs b/src/datadogV2/model/model_event_status_type.rs index c92e0b7ff..71a1c9448 100644 --- a/src/datadogV2/model/model_event_status_type.rs +++ b/src/datadogV2/model/model_event_status_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_event_type.rs b/src/datadogV2/model/model_event_type.rs index 07eed1067..29969b866 100644 --- a/src/datadogV2/model/model_event_type.rs +++ b/src/datadogV2/model/model_event_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_events_sort.rs b/src/datadogV2/model/model_events_sort.rs index 6dc812e13..4cc74f61d 100644 --- a/src/datadogV2/model/model_events_sort.rs +++ b/src/datadogV2/model/model_events_sort.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_fastly_account_type.rs b/src/datadogV2/model/model_fastly_account_type.rs index af397f560..6e87988af 100644 --- a/src/datadogV2/model/model_fastly_account_type.rs +++ b/src/datadogV2/model/model_fastly_account_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_fastly_service_type.rs b/src/datadogV2/model/model_fastly_service_type.rs index fd3981b5d..41afcce75 100644 --- a/src/datadogV2/model/model_fastly_service_type.rs +++ b/src/datadogV2/model/model_fastly_service_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_finding_evaluation.rs b/src/datadogV2/model/model_finding_evaluation.rs index d30ef0b5a..2cbf8ef3a 100644 --- a/src/datadogV2/model/model_finding_evaluation.rs +++ b/src/datadogV2/model/model_finding_evaluation.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_finding_mute_reason.rs b/src/datadogV2/model/model_finding_mute_reason.rs index 441a6218e..d5e5127a1 100644 --- a/src/datadogV2/model/model_finding_mute_reason.rs +++ b/src/datadogV2/model/model_finding_mute_reason.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_finding_status.rs b/src/datadogV2/model/model_finding_status.rs index fb990d781..d6d355d81 100644 --- a/src/datadogV2/model/model_finding_status.rs +++ b/src/datadogV2/model/model_finding_status.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_finding_type.rs b/src/datadogV2/model/model_finding_type.rs index 61928b400..223a41609 100644 --- a/src/datadogV2/model/model_finding_type.rs +++ b/src/datadogV2/model/model_finding_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_gcp_service_account_type.rs b/src/datadogV2/model/model_gcp_service_account_type.rs index b0d888bed..aa78b7da5 100644 --- a/src/datadogV2/model/model_gcp_service_account_type.rs +++ b/src/datadogV2/model/model_gcp_service_account_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_gcpsts_delegate_account_type.rs b/src/datadogV2/model/model_gcpsts_delegate_account_type.rs index cec64d6e8..ce9942525 100644 --- a/src/datadogV2/model/model_gcpsts_delegate_account_type.rs +++ b/src/datadogV2/model/model_gcpsts_delegate_account_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_hourly_usage_type.rs b/src/datadogV2/model/model_hourly_usage_type.rs index c7c5c59f9..91db38a98 100644 --- a/src/datadogV2/model/model_hourly_usage_type.rs +++ b/src/datadogV2/model/model_hourly_usage_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_ip_allowlist_entry_type.rs b/src/datadogV2/model/model_ip_allowlist_entry_type.rs index fd9471a8a..7f24147e1 100644 --- a/src/datadogV2/model/model_ip_allowlist_entry_type.rs +++ b/src/datadogV2/model/model_ip_allowlist_entry_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_ip_allowlist_type.rs b/src/datadogV2/model/model_ip_allowlist_type.rs index 3eb84178d..adbb81a2d 100644 --- a/src/datadogV2/model/model_ip_allowlist_type.rs +++ b/src/datadogV2/model/model_ip_allowlist_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_logs_metric_compute_aggregation_type.rs b/src/datadogV2/model/model_logs_metric_compute_aggregation_type.rs index 3ed2b5e81..713e899dc 100644 --- a/src/datadogV2/model/model_logs_metric_compute_aggregation_type.rs +++ b/src/datadogV2/model/model_logs_metric_compute_aggregation_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_logs_metric_response_compute_aggregation_type.rs b/src/datadogV2/model/model_logs_metric_response_compute_aggregation_type.rs index 2eef46513..8f4d6b729 100644 --- a/src/datadogV2/model/model_logs_metric_response_compute_aggregation_type.rs +++ b/src/datadogV2/model/model_logs_metric_response_compute_aggregation_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_logs_metric_type.rs b/src/datadogV2/model/model_logs_metric_type.rs index 751fbbb79..c887ac134 100644 --- a/src/datadogV2/model/model_logs_metric_type.rs +++ b/src/datadogV2/model/model_logs_metric_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_metric_content_encoding.rs b/src/datadogV2/model/model_metric_content_encoding.rs index 962e7f8ea..fcad7ad08 100644 --- a/src/datadogV2/model/model_metric_content_encoding.rs +++ b/src/datadogV2/model/model_metric_content_encoding.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_metric_intake_type.rs b/src/datadogV2/model/model_metric_intake_type.rs index ffcbea8b3..3ef49735e 100644 --- a/src/datadogV2/model/model_metric_intake_type.rs +++ b/src/datadogV2/model/model_metric_intake_type.rs @@ -1,18 +1,18 @@ // 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, Serialize}; -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +use serde_repr::{Deserialize_repr, Serialize_repr}; + +#[derive( + Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr, +)] +#[repr(i32)] pub enum MetricIntakeType { - #[serde(rename = "0")] - UNSPECIFIED, - #[serde(rename = "1")] - COUNT, - #[serde(rename = "2")] - RATE, - #[serde(rename = "3")] - GAUGE, + UNSPECIFIED = 0, + COUNT = 1, + RATE = 2, + GAUGE = 3, } impl ToString for MetricIntakeType { diff --git a/src/datadogV2/model/model_on_demand_concurrency_cap_type.rs b/src/datadogV2/model/model_on_demand_concurrency_cap_type.rs index 4d29a217b..5fcdb2a37 100644 --- a/src/datadogV2/model/model_on_demand_concurrency_cap_type.rs +++ b/src/datadogV2/model/model_on_demand_concurrency_cap_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_opsgenie_service_region_type.rs b/src/datadogV2/model/model_opsgenie_service_region_type.rs index daa3b3f5f..40dd27549 100644 --- a/src/datadogV2/model/model_opsgenie_service_region_type.rs +++ b/src/datadogV2/model/model_opsgenie_service_region_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_opsgenie_service_type.rs b/src/datadogV2/model/model_opsgenie_service_type.rs index ada73aec8..d1117a560 100644 --- a/src/datadogV2/model/model_opsgenie_service_type.rs +++ b/src/datadogV2/model/model_opsgenie_service_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_permissions_type.rs b/src/datadogV2/model/model_permissions_type.rs index 7aa97f196..318f3f720 100644 --- a/src/datadogV2/model/model_permissions_type.rs +++ b/src/datadogV2/model/model_permissions_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_process_summary_type.rs b/src/datadogV2/model/model_process_summary_type.rs index 97d017dc9..849989dad 100644 --- a/src/datadogV2/model/model_process_summary_type.rs +++ b/src/datadogV2/model/model_process_summary_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_restriction_policy_type.rs b/src/datadogV2/model/model_restriction_policy_type.rs index 5739165c1..6bb097846 100644 --- a/src/datadogV2/model/model_restriction_policy_type.rs +++ b/src/datadogV2/model/model_restriction_policy_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_retention_filter_all_type.rs b/src/datadogV2/model/model_retention_filter_all_type.rs index d63518855..48d37f945 100644 --- a/src/datadogV2/model/model_retention_filter_all_type.rs +++ b/src/datadogV2/model/model_retention_filter_all_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_retention_filter_type.rs b/src/datadogV2/model/model_retention_filter_type.rs index cd3da7c6a..bb2e9ce90 100644 --- a/src/datadogV2/model/model_retention_filter_type.rs +++ b/src/datadogV2/model/model_retention_filter_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_spans_metric_compute_aggregation_type.rs b/src/datadogV2/model/model_spans_metric_compute_aggregation_type.rs index 26291b2c0..cd82152cc 100644 --- a/src/datadogV2/model/model_spans_metric_compute_aggregation_type.rs +++ b/src/datadogV2/model/model_spans_metric_compute_aggregation_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_spans_metric_type.rs b/src/datadogV2/model/model_spans_metric_type.rs index 36522dba8..f40e3bda9 100644 --- a/src/datadogV2/model/model_spans_metric_type.rs +++ b/src/datadogV2/model/model_spans_metric_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/src/datadogV2/model/model_usage_time_series_type.rs b/src/datadogV2/model/model_usage_time_series_type.rs index d44a85119..5ef777830 100644 --- a/src/datadogV2/model/model_usage_time_series_type.rs +++ b/src/datadogV2/model/model_usage_time_series_type.rs @@ -1,6 +1,7 @@ // 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, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] diff --git a/tests/main.rs b/tests/main.rs index 178cb8bfd..d84bdeeae 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,5 +1,3 @@ -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] mod scenarios; use cucumber::World; @@ -8,24 +6,17 @@ use scenarios::fixtures::{after_scenario, before_scenario, DatadogWorld}; #[tokio::main] async fn main() { env_logger::init(); - - for api_version in 1..3 { - println!("[Testing v{}]", api_version); - DatadogWorld::cucumber() - .before(|_feature, _rule, _scenario, world| { - Box::pin(before_scenario(_feature, _rule, _scenario, world)) - }) - .after(|_feature, _rule, _scenario, _ev, _world| { - Box::pin(after_scenario(_feature, _rule, _scenario, _ev, _world)) - }) - .filter_run( - format!("tests/scenarios/features/v{}/", api_version), - |_, _, sc| { - sc.tags - .iter() - .all(|tag| tag != "skip" && tag != "skip-rust") - }, - ) - .await; - } + DatadogWorld::cucumber() + .before(|feature, rule, scenario, world| { + Box::pin(before_scenario(feature, rule, scenario, world)) + }) + .after(|feature, rule, scenario, ev, world| { + Box::pin(after_scenario(feature, rule, scenario, ev, world)) + }) + .filter_run(format!("tests/scenarios/features/"), |_, _, sc| { + sc.tags + .iter() + .all(|tag| tag != "skip" && tag != "skip-rust") + }) + .await; } diff --git a/tests/scenarios/fixtures.rs b/tests/scenarios/fixtures.rs index 54d90bbe6..4e3eb1179 100644 --- a/tests/scenarios/fixtures.rs +++ b/tests/scenarios/fixtures.rs @@ -9,6 +9,7 @@ use cucumber::{ }; use datadog_api_client::datadog::configuration::Configuration; use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError}; +use lazy_static::lazy_static; use regex::Regex; use reqwest_middleware::ClientBuilder; use rvcr::{VCRMiddleware, VCRMode}; @@ -21,6 +22,7 @@ use std::{ io::BufReader, ops::Add, path::PathBuf, + str::FromStr, }; pub type TestCall = fn(&mut DatadogWorld, &HashMap); @@ -61,16 +63,31 @@ impl std::fmt::Debug for DatadogWorld { } } +lazy_static! { + static ref API_VERSION_RE: Regex = Regex::new(r"tests/scenarios/features/v(\d+)/").unwrap(); + static ref NUMBER_RE: Regex = Regex::new(r"^\d+$").unwrap(); + static ref BOOL_RE: Regex = Regex::new(r"^(true|false)$").unwrap(); + static ref INDEX_RE: Regex = Regex::new(r"\[(\d+)\]+").unwrap(); + static ref NON_ALNUM_RE: Regex = Regex::new(r"[^A-Za-z0-9]+").unwrap(); + static ref TIME_FMT_HELPER_RE: Regex = + Regex::new(r"now(?: *([+-]) *(\d+)([smhdMy]))?").unwrap(); + static ref TIME_FUNC_HELPER_RE: Regex = Regex::new(r"(?:timestamp|timeISO)\([^{}]*\)").unwrap(); + static ref HANDLEBARS: Handlebars<'static> = { + let mut hb = Handlebars::new(); + hb.register_helper("timeISO", Box::new(time_iso_helper)); + hb.register_helper("timestamp", Box::new(timestamp_helper)); + hb + }; +} + pub async fn before_scenario( feature: &Feature, _rule: Option<&Rule>, scenario: &Scenario, world: &mut DatadogWorld, ) { - let api_version_re = - Regex::new(r"tests/scenarios/features/v(\d+)/").expect("api version regex failed"); // TODO: refactor this lol - world.api_version = api_version_re + world.api_version = API_VERSION_RE .captures(feature.path.as_ref().unwrap().to_str().unwrap()) .unwrap() .get(1) @@ -95,8 +112,7 @@ pub async fn before_scenario( world.undo_map = serde_json::from_reader(BufReader::new(undo_file)) .expect("failed to deserialize undo.json"); - let non_alnum_re = Regex::new(r"[^A-Za-z0-9]+").expect("non alnum regex failed"); - let escaped_filename = non_alnum_re + let escaped_filename = NON_ALNUM_RE .replace_all(scenario.name.as_str(), "-") .to_string(); let filename = match escaped_filename.len() > 100 { @@ -177,7 +193,7 @@ pub async fn before_scenario( config.app_key_auth = Some("0000000000000000000000000000000000000000".to_string()); world.config = config; - let escaped_name = non_alnum_re + let escaped_name = NON_ALNUM_RE .replace_all(scenario.name.as_str(), "_") .to_string(); let name = match escaped_name.len() > 100 { @@ -185,7 +201,7 @@ pub async fn before_scenario( false => escaped_name, }; let unique = format!("{}-{}-{}", prefix, name, frozen_time.num_seconds()); - let unique_alnum = non_alnum_re.replace_all(unique.as_str(), "").to_string(); + let unique_alnum = NON_ALNUM_RE.replace_all(unique.as_str(), "").to_string(); world.fixtures = json!({ "unique": unique, "unique_lower": unique.to_ascii_lowercase(), @@ -210,7 +226,7 @@ pub async fn after_scenario( for undo in world.undo_operations.clone().iter().rev() { world .function_mappings - .get(&undo.operation_id) + .get(&format!("v{}.{}", world.api_version, &undo.operation_id)) .expect("undo operation not found")(world, &undo.parameters); } } @@ -252,8 +268,10 @@ fn given_resource_in_system(world: &mut DatadogWorld, given_key: String) { } }; if let Some(template_value) = param.get("value") { - let mut rendered = template(template_value.to_string(), &world.fixtures); - rendered = serde_json::from_str(rendered.as_str()).unwrap(); + let rendered = template( + template_value.as_str().unwrap().to_string(), + &world.fixtures, + ); given_parameters.insert( param_name.clone(), serde_json::from_str(rendered.as_str()).unwrap(), @@ -280,7 +298,7 @@ fn given_resource_in_system(world: &mut DatadogWorld, given_key: String) { world .function_mappings - .get(&operation_id) + .get(&format!("v{}.{}", world.api_version, &operation_id)) .expect("given operation not found")(world, &given_parameters); match build_undo(world, &operation_id) { Ok(Some(undo)) => world.undo_operations.push(undo), @@ -325,7 +343,7 @@ fn body_from_file(world: &mut DatadogWorld, path: String) { #[given(expr = "request contains {string} parameter from {string}")] fn request_parameter_from_path(world: &mut DatadogWorld, param: String, path: String) { - let lookup = lookup(&path, &world.fixtures).unwrap(); + let lookup = lookup(&path, &world.fixtures).expect("failed to lookup parameter"); world.parameters.insert(param, lookup); } @@ -333,14 +351,23 @@ fn request_parameter_from_path(world: &mut DatadogWorld, param: String, path: St fn request_parameter_with_value(world: &mut DatadogWorld, param: String, value: String) { let trimmed_value = value.trim_matches('"').to_string(); let rendered = template(trimmed_value, &world.fixtures); - world.parameters.insert(param, Value::from(rendered)); + if NUMBER_RE.is_match(&rendered) { + let number = + serde_json::Number::from_str(&rendered).expect("couldn't parse param as number"); + world.parameters.insert(param, Value::Number(number)); + } else if BOOL_RE.is_match(&rendered) { + let boolean = Value::Bool(rendered == "true"); + world.parameters.insert(param, boolean); + } else { + world.parameters.insert(param, Value::from(rendered)); + } } #[when(regex = r"^the request is sent$")] fn request_sent(world: &mut DatadogWorld) { world .function_mappings - .get(&world.operation_id) + .get(&format!("v{}.{}", world.api_version, &world.operation_id)) .expect(&format!( "{:?} request operation id not found", world.operation_id @@ -406,13 +433,12 @@ fn req_eq(lhs: &vcr_cassette::Request, rhs: &vcr_cassette::Request) -> bool { } fn lookup(path: &String, object: &Value) -> Option { - let index_re = Regex::new(r"\[(\d+)\]+").expect("index regex failed"); let mut json_pointer = format!("/{}", path).replace('.', "/"); - for (_, [idx]) in index_re + for (_, [idx]) in INDEX_RE .captures_iter(&json_pointer.clone()) .map(|c| c.extract()) { - json_pointer = index_re + json_pointer = INDEX_RE .replace(&json_pointer, format!("/{idx}")) .to_string(); } @@ -421,8 +447,7 @@ fn lookup(path: &String, object: &Value) -> Option { fn relative_time_helper(v: &String, c: &Context) -> DateTime { // get parameter from helper or throw an error - let time_helper_re = Regex::new(r"now(?: *([+-]) *(\d+)([smhdMy]))?").unwrap(); - let caps = time_helper_re + let caps = TIME_FMT_HELPER_RE .captures(&v) .expect("failed to parse timeISO template function"); let ts = c.data().get("now_millis").unwrap().as_i64().unwrap(); @@ -464,7 +489,7 @@ fn relative_time_helper(v: &String, c: &Context) -> DateTime { } } -fn timeISO_helper( +fn time_iso_helper( h: &Helper, _: &Handlebars, c: &Context, @@ -493,8 +518,7 @@ fn timestamp_helper( } fn template(string: String, fixtures: &Value) -> String { - let time_helper_re = Regex::new(r"(?:timestamp|timeISO)\([^{}]*\)").unwrap(); - let helper_parsed_string = time_helper_re + let helper_parsed_string = TIME_FUNC_HELPER_RE .replace_all(&string, |caps: ®ex::Captures| { caps.get(0) .unwrap() @@ -503,11 +527,7 @@ fn template(string: String, fixtures: &Value) -> String { .replace(')', "") }) .to_string(); - - let mut handlebars = Handlebars::new(); - handlebars.register_helper("timeISO", Box::new(timeISO_helper)); - handlebars.register_helper("timestamp", Box::new(timestamp_helper)); - handlebars + HANDLEBARS .render_template(helper_parsed_string.as_str(), &fixtures) .expect("failed to apply template") } @@ -516,6 +536,9 @@ fn build_undo( world: &mut DatadogWorld, operation_id: &String, ) -> Result, Value> { + if world.response.code < 200 || world.response.code >= 300 { + return Ok(None); + } let undo = world .undo_map .get(operation_id) diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 6225b55f9..c975a2104 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -441,906 +441,932 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings - .insert("GetIPRanges".to_string(), test_v1_get_ip_ranges); + .insert("v1.GetIPRanges".to_string(), test_v1_get_ip_ranges); world .function_mappings - .insert("ListAPIKeys".to_string(), test_v1_list_api_keys); + .insert("v1.ListAPIKeys".to_string(), test_v1_list_api_keys); world .function_mappings - .insert("CreateAPIKey".to_string(), test_v1_create_api_key); + .insert("v1.CreateAPIKey".to_string(), test_v1_create_api_key); world .function_mappings - .insert("DeleteAPIKey".to_string(), test_v1_delete_api_key); + .insert("v1.DeleteAPIKey".to_string(), test_v1_delete_api_key); world .function_mappings - .insert("GetAPIKey".to_string(), test_v1_get_api_key); + .insert("v1.GetAPIKey".to_string(), test_v1_get_api_key); world .function_mappings - .insert("UpdateAPIKey".to_string(), test_v1_update_api_key); + .insert("v1.UpdateAPIKey".to_string(), test_v1_update_api_key); world.function_mappings.insert( - "ListApplicationKeys".to_string(), + "v1.ListApplicationKeys".to_string(), test_v1_list_application_keys, ); world.function_mappings.insert( - "CreateApplicationKey".to_string(), + "v1.CreateApplicationKey".to_string(), test_v1_create_application_key, ); world.function_mappings.insert( - "DeleteApplicationKey".to_string(), + "v1.DeleteApplicationKey".to_string(), test_v1_delete_application_key, ); - world - .function_mappings - .insert("GetApplicationKey".to_string(), test_v1_get_application_key); world.function_mappings.insert( - "UpdateApplicationKey".to_string(), + "v1.GetApplicationKey".to_string(), + test_v1_get_application_key, + ); + world.function_mappings.insert( + "v1.UpdateApplicationKey".to_string(), test_v1_update_application_key, ); world.function_mappings.insert( - "SubmitServiceCheck".to_string(), + "v1.SubmitServiceCheck".to_string(), test_v1_submit_service_check, ); world.function_mappings.insert( - "GetDailyCustomReports".to_string(), + "v1.GetDailyCustomReports".to_string(), test_v1_get_daily_custom_reports, ); world.function_mappings.insert( - "GetSpecifiedDailyCustomReports".to_string(), + "v1.GetSpecifiedDailyCustomReports".to_string(), test_v1_get_specified_daily_custom_reports, ); world.function_mappings.insert( - "GetMonthlyCustomReports".to_string(), + "v1.GetMonthlyCustomReports".to_string(), test_v1_get_monthly_custom_reports, ); world.function_mappings.insert( - "GetSpecifiedMonthlyCustomReports".to_string(), + "v1.GetSpecifiedMonthlyCustomReports".to_string(), test_v1_get_specified_monthly_custom_reports, ); world.function_mappings.insert( - "GetUsageAnalyzedLogs".to_string(), + "v1.GetUsageAnalyzedLogs".to_string(), test_v1_get_usage_analyzed_logs, ); world.function_mappings.insert( - "GetUsageAttribution".to_string(), + "v1.GetUsageAttribution".to_string(), test_v1_get_usage_attribution, ); world.function_mappings.insert( - "GetUsageAuditLogs".to_string(), + "v1.GetUsageAuditLogs".to_string(), test_v1_get_usage_audit_logs, ); world .function_mappings - .insert("GetUsageLambda".to_string(), test_v1_get_usage_lambda); + .insert("v1.GetUsageLambda".to_string(), test_v1_get_usage_lambda); world.function_mappings.insert( - "GetUsageBillableSummary".to_string(), + "v1.GetUsageBillableSummary".to_string(), test_v1_get_usage_billable_summary, ); world .function_mappings - .insert("GetUsageCIApp".to_string(), test_v1_get_usage_ci_app); + .insert("v1.GetUsageCIApp".to_string(), test_v1_get_usage_ci_app); world.function_mappings.insert( - "GetUsageCloudSecurityPostureManagement".to_string(), + "v1.GetUsageCloudSecurityPostureManagement".to_string(), test_v1_get_usage_cloud_security_posture_management, ); world .function_mappings - .insert("GetUsageCWS".to_string(), test_v1_get_usage_cws); + .insert("v1.GetUsageCWS".to_string(), test_v1_get_usage_cws); world .function_mappings - .insert("GetUsageDBM".to_string(), test_v1_get_usage_dbm); + .insert("v1.GetUsageDBM".to_string(), test_v1_get_usage_dbm); world .function_mappings - .insert("GetUsageFargate".to_string(), test_v1_get_usage_fargate); + .insert("v1.GetUsageFargate".to_string(), test_v1_get_usage_fargate); world .function_mappings - .insert("GetUsageHosts".to_string(), test_v1_get_usage_hosts); + .insert("v1.GetUsageHosts".to_string(), test_v1_get_usage_hosts); world.function_mappings.insert( - "GetHourlyUsageAttribution".to_string(), + "v1.GetHourlyUsageAttribution".to_string(), test_v1_get_hourly_usage_attribution, ); world.function_mappings.insert( - "GetIncidentManagement".to_string(), + "v1.GetIncidentManagement".to_string(), test_v1_get_incident_management, ); world.function_mappings.insert( - "GetUsageIndexedSpans".to_string(), + "v1.GetUsageIndexedSpans".to_string(), test_v1_get_usage_indexed_spans, ); - world - .function_mappings - .insert("GetIngestedSpans".to_string(), test_v1_get_ingested_spans); world.function_mappings.insert( - "GetUsageInternetOfThings".to_string(), + "v1.GetIngestedSpans".to_string(), + test_v1_get_ingested_spans, + ); + world.function_mappings.insert( + "v1.GetUsageInternetOfThings".to_string(), test_v1_get_usage_internet_of_things, ); world .function_mappings - .insert("GetUsageLogs".to_string(), test_v1_get_usage_logs); + .insert("v1.GetUsageLogs".to_string(), test_v1_get_usage_logs); world.function_mappings.insert( - "GetUsageLogsByRetention".to_string(), + "v1.GetUsageLogsByRetention".to_string(), test_v1_get_usage_logs_by_retention, ); world.function_mappings.insert( - "GetUsageLogsByIndex".to_string(), + "v1.GetUsageLogsByIndex".to_string(), test_v1_get_usage_logs_by_index, ); world.function_mappings.insert( - "GetMonthlyUsageAttribution".to_string(), + "v1.GetMonthlyUsageAttribution".to_string(), test_v1_get_monthly_usage_attribution, ); world.function_mappings.insert( - "GetUsageNetworkFlows".to_string(), + "v1.GetUsageNetworkFlows".to_string(), test_v1_get_usage_network_flows, ); world.function_mappings.insert( - "GetUsageNetworkHosts".to_string(), + "v1.GetUsageNetworkHosts".to_string(), test_v1_get_usage_network_hosts, ); world.function_mappings.insert( - "GetUsageOnlineArchive".to_string(), + "v1.GetUsageOnlineArchive".to_string(), test_v1_get_usage_online_archive, ); - world - .function_mappings - .insert("GetUsageProfiling".to_string(), test_v1_get_usage_profiling); - world - .function_mappings - .insert("GetUsageRumUnits".to_string(), test_v1_get_usage_rum_units); world.function_mappings.insert( - "GetUsageRumSessions".to_string(), + "v1.GetUsageProfiling".to_string(), + test_v1_get_usage_profiling, + ); + world.function_mappings.insert( + "v1.GetUsageRumUnits".to_string(), + test_v1_get_usage_rum_units, + ); + world.function_mappings.insert( + "v1.GetUsageRumSessions".to_string(), test_v1_get_usage_rum_sessions, ); world .function_mappings - .insert("GetUsageSDS".to_string(), test_v1_get_usage_sds); + .insert("v1.GetUsageSDS".to_string(), test_v1_get_usage_sds); world .function_mappings - .insert("GetUsageSNMP".to_string(), test_v1_get_usage_snmp); + .insert("v1.GetUsageSNMP".to_string(), test_v1_get_usage_snmp); world .function_mappings - .insert("GetUsageSummary".to_string(), test_v1_get_usage_summary); + .insert("v1.GetUsageSummary".to_string(), test_v1_get_usage_summary); world.function_mappings.insert( - "GetUsageSynthetics".to_string(), + "v1.GetUsageSynthetics".to_string(), test_v1_get_usage_synthetics, ); world.function_mappings.insert( - "GetUsageSyntheticsAPI".to_string(), + "v1.GetUsageSyntheticsAPI".to_string(), test_v1_get_usage_synthetics_api, ); world.function_mappings.insert( - "GetUsageSyntheticsBrowser".to_string(), + "v1.GetUsageSyntheticsBrowser".to_string(), test_v1_get_usage_synthetics_browser, ); world.function_mappings.insert( - "GetUsageTimeseries".to_string(), + "v1.GetUsageTimeseries".to_string(), test_v1_get_usage_timeseries, ); world.function_mappings.insert( - "GetUsageTopAvgMetrics".to_string(), + "v1.GetUsageTopAvgMetrics".to_string(), test_v1_get_usage_top_avg_metrics, ); world.function_mappings.insert( - "ListDashboardLists".to_string(), + "v1.ListDashboardLists".to_string(), test_v1_list_dashboard_lists, ); world.function_mappings.insert( - "CreateDashboardList".to_string(), + "v1.CreateDashboardList".to_string(), test_v1_create_dashboard_list, ); world.function_mappings.insert( - "DeleteDashboardList".to_string(), + "v1.DeleteDashboardList".to_string(), test_v1_delete_dashboard_list, ); - world - .function_mappings - .insert("GetDashboardList".to_string(), test_v1_get_dashboard_list); world.function_mappings.insert( - "UpdateDashboardList".to_string(), + "v1.GetDashboardList".to_string(), + test_v1_get_dashboard_list, + ); + world.function_mappings.insert( + "v1.UpdateDashboardList".to_string(), test_v1_update_dashboard_list, ); world .function_mappings - .insert("ListDowntimes".to_string(), test_v1_list_downtimes); + .insert("v1.ListDowntimes".to_string(), test_v1_list_downtimes); world .function_mappings - .insert("CreateDowntime".to_string(), test_v1_create_downtime); + .insert("v1.CreateDowntime".to_string(), test_v1_create_downtime); world.function_mappings.insert( - "CancelDowntimesByScope".to_string(), + "v1.CancelDowntimesByScope".to_string(), test_v1_cancel_downtimes_by_scope, ); world .function_mappings - .insert("CancelDowntime".to_string(), test_v1_cancel_downtime); + .insert("v1.CancelDowntime".to_string(), test_v1_cancel_downtime); world .function_mappings - .insert("GetDowntime".to_string(), test_v1_get_downtime); + .insert("v1.GetDowntime".to_string(), test_v1_get_downtime); world .function_mappings - .insert("UpdateDowntime".to_string(), test_v1_update_downtime); + .insert("v1.UpdateDowntime".to_string(), test_v1_update_downtime); world.function_mappings.insert( - "ListMonitorDowntimes".to_string(), + "v1.ListMonitorDowntimes".to_string(), test_v1_list_monitor_downtimes, ); world .function_mappings - .insert("ListEvents".to_string(), test_v1_list_events); - world - .function_mappings - .insert("CreateEvent".to_string(), test_v1_create_event); - world - .function_mappings - .insert("GetEvent".to_string(), test_v1_get_event); - world - .function_mappings - .insert("GetGraphSnapshot".to_string(), test_v1_get_graph_snapshot); + .insert("v1.ListEvents".to_string(), test_v1_list_events); world .function_mappings - .insert("MuteHost".to_string(), test_v1_mute_host); + .insert("v1.CreateEvent".to_string(), test_v1_create_event); world .function_mappings - .insert("UnmuteHost".to_string(), test_v1_unmute_host); - world - .function_mappings - .insert("ListHosts".to_string(), test_v1_list_hosts); + .insert("v1.GetEvent".to_string(), test_v1_get_event); + world.function_mappings.insert( + "v1.GetGraphSnapshot".to_string(), + test_v1_get_graph_snapshot, + ); world .function_mappings - .insert("GetHostTotals".to_string(), test_v1_get_host_totals); + .insert("v1.MuteHost".to_string(), test_v1_mute_host); world .function_mappings - .insert("DeleteAWSAccount".to_string(), test_v1_delete_aws_account); + .insert("v1.UnmuteHost".to_string(), test_v1_unmute_host); world .function_mappings - .insert("ListAWSAccounts".to_string(), test_v1_list_aws_accounts); + .insert("v1.ListHosts".to_string(), test_v1_list_hosts); world .function_mappings - .insert("CreateAWSAccount".to_string(), test_v1_create_aws_account); + .insert("v1.GetHostTotals".to_string(), test_v1_get_host_totals); + world.function_mappings.insert( + "v1.DeleteAWSAccount".to_string(), + test_v1_delete_aws_account, + ); world .function_mappings - .insert("UpdateAWSAccount".to_string(), test_v1_update_aws_account); + .insert("v1.ListAWSAccounts".to_string(), test_v1_list_aws_accounts); world.function_mappings.insert( - "ListAvailableAWSNamespaces".to_string(), + "v1.CreateAWSAccount".to_string(), + test_v1_create_aws_account, + ); + world.function_mappings.insert( + "v1.UpdateAWSAccount".to_string(), + test_v1_update_aws_account, + ); + world.function_mappings.insert( + "v1.ListAvailableAWSNamespaces".to_string(), test_v1_list_available_aws_namespaces, ); world.function_mappings.insert( - "DeleteAWSEventBridgeSource".to_string(), + "v1.DeleteAWSEventBridgeSource".to_string(), test_v1_delete_aws_event_bridge_source, ); world.function_mappings.insert( - "ListAWSEventBridgeSources".to_string(), + "v1.ListAWSEventBridgeSources".to_string(), test_v1_list_aws_event_bridge_sources, ); world.function_mappings.insert( - "CreateAWSEventBridgeSource".to_string(), + "v1.CreateAWSEventBridgeSource".to_string(), test_v1_create_aws_event_bridge_source, ); world.function_mappings.insert( - "DeleteAWSTagFilter".to_string(), + "v1.DeleteAWSTagFilter".to_string(), test_v1_delete_aws_tag_filter, ); world.function_mappings.insert( - "ListAWSTagFilters".to_string(), + "v1.ListAWSTagFilters".to_string(), test_v1_list_aws_tag_filters, ); world.function_mappings.insert( - "CreateAWSTagFilter".to_string(), + "v1.CreateAWSTagFilter".to_string(), test_v1_create_aws_tag_filter, ); world.function_mappings.insert( - "CreateNewAWSExternalID".to_string(), + "v1.CreateNewAWSExternalID".to_string(), test_v1_create_new_aws_external_id, ); world.function_mappings.insert( - "DeleteAWSLambdaARN".to_string(), + "v1.DeleteAWSLambdaARN".to_string(), test_v1_delete_aws_lambda_arn, ); world.function_mappings.insert( - "ListAWSLogsIntegrations".to_string(), + "v1.ListAWSLogsIntegrations".to_string(), test_v1_list_aws_logs_integrations, ); world.function_mappings.insert( - "CreateAWSLambdaARN".to_string(), + "v1.CreateAWSLambdaARN".to_string(), test_v1_create_aws_lambda_arn, ); world.function_mappings.insert( - "CheckAWSLogsLambdaAsync".to_string(), + "v1.CheckAWSLogsLambdaAsync".to_string(), test_v1_check_aws_logs_lambda_async, ); world.function_mappings.insert( - "ListAWSLogsServices".to_string(), + "v1.ListAWSLogsServices".to_string(), test_v1_list_aws_logs_services, ); world.function_mappings.insert( - "EnableAWSLogServices".to_string(), + "v1.EnableAWSLogServices".to_string(), test_v1_enable_aws_log_services, ); world.function_mappings.insert( - "CheckAWSLogsServicesAsync".to_string(), + "v1.CheckAWSLogsServicesAsync".to_string(), test_v1_check_aws_logs_services_async, ); world.function_mappings.insert( - "DeleteAzureIntegration".to_string(), + "v1.DeleteAzureIntegration".to_string(), test_v1_delete_azure_integration, ); world.function_mappings.insert( - "ListAzureIntegration".to_string(), + "v1.ListAzureIntegration".to_string(), test_v1_list_azure_integration, ); world.function_mappings.insert( - "CreateAzureIntegration".to_string(), + "v1.CreateAzureIntegration".to_string(), test_v1_create_azure_integration, ); world.function_mappings.insert( - "UpdateAzureIntegration".to_string(), + "v1.UpdateAzureIntegration".to_string(), test_v1_update_azure_integration, ); world.function_mappings.insert( - "UpdateAzureHostFilters".to_string(), + "v1.UpdateAzureHostFilters".to_string(), test_v1_update_azure_host_filters, ); world.function_mappings.insert( - "DeleteGCPIntegration".to_string(), + "v1.DeleteGCPIntegration".to_string(), test_v1_delete_gcp_integration, ); world.function_mappings.insert( - "ListGCPIntegration".to_string(), + "v1.ListGCPIntegration".to_string(), test_v1_list_gcp_integration, ); world.function_mappings.insert( - "CreateGCPIntegration".to_string(), + "v1.CreateGCPIntegration".to_string(), test_v1_create_gcp_integration, ); world.function_mappings.insert( - "UpdateGCPIntegration".to_string(), + "v1.UpdateGCPIntegration".to_string(), test_v1_update_gcp_integration, ); world.function_mappings.insert( - "CreatePagerDutyIntegrationService".to_string(), + "v1.CreatePagerDutyIntegrationService".to_string(), test_v1_create_pager_duty_integration_service, ); world.function_mappings.insert( - "DeletePagerDutyIntegrationService".to_string(), + "v1.DeletePagerDutyIntegrationService".to_string(), test_v1_delete_pager_duty_integration_service, ); world.function_mappings.insert( - "GetPagerDutyIntegrationService".to_string(), + "v1.GetPagerDutyIntegrationService".to_string(), test_v1_get_pager_duty_integration_service, ); world.function_mappings.insert( - "UpdatePagerDutyIntegrationService".to_string(), + "v1.UpdatePagerDutyIntegrationService".to_string(), test_v1_update_pager_duty_integration_service, ); world.function_mappings.insert( - "GetSlackIntegrationChannels".to_string(), + "v1.GetSlackIntegrationChannels".to_string(), test_v1_get_slack_integration_channels, ); world.function_mappings.insert( - "CreateSlackIntegrationChannel".to_string(), + "v1.CreateSlackIntegrationChannel".to_string(), test_v1_create_slack_integration_channel, ); world.function_mappings.insert( - "RemoveSlackIntegrationChannel".to_string(), + "v1.RemoveSlackIntegrationChannel".to_string(), test_v1_remove_slack_integration_channel, ); world.function_mappings.insert( - "GetSlackIntegrationChannel".to_string(), + "v1.GetSlackIntegrationChannel".to_string(), test_v1_get_slack_integration_channel, ); world.function_mappings.insert( - "UpdateSlackIntegrationChannel".to_string(), + "v1.UpdateSlackIntegrationChannel".to_string(), test_v1_update_slack_integration_channel, ); world.function_mappings.insert( - "CreateWebhooksIntegrationCustomVariable".to_string(), + "v1.CreateWebhooksIntegrationCustomVariable".to_string(), test_v1_create_webhooks_integration_custom_variable, ); world.function_mappings.insert( - "DeleteWebhooksIntegrationCustomVariable".to_string(), + "v1.DeleteWebhooksIntegrationCustomVariable".to_string(), test_v1_delete_webhooks_integration_custom_variable, ); world.function_mappings.insert( - "GetWebhooksIntegrationCustomVariable".to_string(), + "v1.GetWebhooksIntegrationCustomVariable".to_string(), test_v1_get_webhooks_integration_custom_variable, ); world.function_mappings.insert( - "UpdateWebhooksIntegrationCustomVariable".to_string(), + "v1.UpdateWebhooksIntegrationCustomVariable".to_string(), test_v1_update_webhooks_integration_custom_variable, ); world.function_mappings.insert( - "CreateWebhooksIntegration".to_string(), + "v1.CreateWebhooksIntegration".to_string(), test_v1_create_webhooks_integration, ); world.function_mappings.insert( - "DeleteWebhooksIntegration".to_string(), + "v1.DeleteWebhooksIntegration".to_string(), test_v1_delete_webhooks_integration, ); world.function_mappings.insert( - "GetWebhooksIntegration".to_string(), + "v1.GetWebhooksIntegration".to_string(), test_v1_get_webhooks_integration, ); world.function_mappings.insert( - "UpdateWebhooksIntegration".to_string(), + "v1.UpdateWebhooksIntegration".to_string(), test_v1_update_webhooks_integration, ); world .function_mappings - .insert("ListLogs".to_string(), test_v1_list_logs); + .insert("v1.ListLogs".to_string(), test_v1_list_logs); world .function_mappings - .insert("SubmitLog".to_string(), test_v1_submit_log); + .insert("v1.SubmitLog".to_string(), test_v1_submit_log); world.function_mappings.insert( - "GetLogsIndexOrder".to_string(), + "v1.GetLogsIndexOrder".to_string(), test_v1_get_logs_index_order, ); world.function_mappings.insert( - "UpdateLogsIndexOrder".to_string(), + "v1.UpdateLogsIndexOrder".to_string(), test_v1_update_logs_index_order, ); world .function_mappings - .insert("ListLogIndexes".to_string(), test_v1_list_log_indexes); - world - .function_mappings - .insert("CreateLogsIndex".to_string(), test_v1_create_logs_index); - world - .function_mappings - .insert("GetLogsIndex".to_string(), test_v1_get_logs_index); + .insert("v1.ListLogIndexes".to_string(), test_v1_list_log_indexes); world .function_mappings - .insert("UpdateLogsIndex".to_string(), test_v1_update_logs_index); + .insert("v1.CreateLogsIndex".to_string(), test_v1_create_logs_index); world .function_mappings - .insert("ListActiveMetrics".to_string(), test_v1_list_active_metrics); + .insert("v1.GetLogsIndex".to_string(), test_v1_get_logs_index); world .function_mappings - .insert("GetMetricMetadata".to_string(), test_v1_get_metric_metadata); + .insert("v1.UpdateLogsIndex".to_string(), test_v1_update_logs_index); + world.function_mappings.insert( + "v1.ListActiveMetrics".to_string(), + test_v1_list_active_metrics, + ); world.function_mappings.insert( - "UpdateMetricMetadata".to_string(), + "v1.GetMetricMetadata".to_string(), + test_v1_get_metric_metadata, + ); + world.function_mappings.insert( + "v1.UpdateMetricMetadata".to_string(), test_v1_update_metric_metadata, ); world .function_mappings - .insert("QueryMetrics".to_string(), test_v1_query_metrics); - world - .function_mappings - .insert("ListMetrics".to_string(), test_v1_list_metrics); + .insert("v1.QueryMetrics".to_string(), test_v1_query_metrics); world .function_mappings - .insert("SubmitMetrics".to_string(), test_v1_submit_metrics); + .insert("v1.ListMetrics".to_string(), test_v1_list_metrics); world .function_mappings - .insert("ListOrgs".to_string(), test_v1_list_orgs); + .insert("v1.SubmitMetrics".to_string(), test_v1_submit_metrics); world .function_mappings - .insert("CreateChildOrg".to_string(), test_v1_create_child_org); + .insert("v1.ListOrgs".to_string(), test_v1_list_orgs); world .function_mappings - .insert("GetOrg".to_string(), test_v1_get_org); + .insert("v1.CreateChildOrg".to_string(), test_v1_create_child_org); world .function_mappings - .insert("UpdateOrg".to_string(), test_v1_update_org); + .insert("v1.GetOrg".to_string(), test_v1_get_org); world .function_mappings - .insert("DowngradeOrg".to_string(), test_v1_downgrade_org); + .insert("v1.UpdateOrg".to_string(), test_v1_update_org); world .function_mappings - .insert("UploadIdPForOrg".to_string(), test_v1_upload_id_p_for_org); + .insert("v1.DowngradeOrg".to_string(), test_v1_downgrade_org); world.function_mappings.insert( - "AddSecurityMonitoringSignalToIncident".to_string(), + "v1.UploadIdPForOrg".to_string(), + test_v1_upload_id_p_for_org, + ); + world.function_mappings.insert( + "v1.AddSecurityMonitoringSignalToIncident".to_string(), test_v1_add_security_monitoring_signal_to_incident, ); world.function_mappings.insert( - "EditSecurityMonitoringSignalAssignee".to_string(), + "v1.EditSecurityMonitoringSignalAssignee".to_string(), test_v1_edit_security_monitoring_signal_assignee, ); world.function_mappings.insert( - "EditSecurityMonitoringSignalState".to_string(), + "v1.EditSecurityMonitoringSignalState".to_string(), test_v1_edit_security_monitoring_signal_state, ); world .function_mappings - .insert("ListSLOs".to_string(), test_v1_list_sl_os); + .insert("v1.ListSLOs".to_string(), test_v1_list_sl_os); world .function_mappings - .insert("CreateSLO".to_string(), test_v1_create_slo); + .insert("v1.CreateSLO".to_string(), test_v1_create_slo); world.function_mappings.insert( - "DeleteSLOTimeframeInBulk".to_string(), + "v1.DeleteSLOTimeframeInBulk".to_string(), test_v1_delete_slo_timeframe_in_bulk, ); world.function_mappings.insert( - "CheckCanDeleteSLO".to_string(), + "v1.CheckCanDeleteSLO".to_string(), test_v1_check_can_delete_slo, ); world .function_mappings - .insert("SearchSLO".to_string(), test_v1_search_slo); - world - .function_mappings - .insert("DeleteSLO".to_string(), test_v1_delete_slo); - world - .function_mappings - .insert("GetSLO".to_string(), test_v1_get_slo); + .insert("v1.SearchSLO".to_string(), test_v1_search_slo); world .function_mappings - .insert("UpdateSLO".to_string(), test_v1_update_slo); + .insert("v1.DeleteSLO".to_string(), test_v1_delete_slo); world .function_mappings - .insert("GetSLOCorrections".to_string(), test_v1_get_slo_corrections); + .insert("v1.GetSLO".to_string(), test_v1_get_slo); world .function_mappings - .insert("GetSLOHistory".to_string(), test_v1_get_slo_history); + .insert("v1.UpdateSLO".to_string(), test_v1_update_slo); + world.function_mappings.insert( + "v1.GetSLOCorrections".to_string(), + test_v1_get_slo_corrections, + ); world .function_mappings - .insert("ListSLOCorrection".to_string(), test_v1_list_slo_correction); + .insert("v1.GetSLOHistory".to_string(), test_v1_get_slo_history); + world.function_mappings.insert( + "v1.ListSLOCorrection".to_string(), + test_v1_list_slo_correction, + ); world.function_mappings.insert( - "CreateSLOCorrection".to_string(), + "v1.CreateSLOCorrection".to_string(), test_v1_create_slo_correction, ); world.function_mappings.insert( - "DeleteSLOCorrection".to_string(), + "v1.DeleteSLOCorrection".to_string(), test_v1_delete_slo_correction, ); - world - .function_mappings - .insert("GetSLOCorrection".to_string(), test_v1_get_slo_correction); world.function_mappings.insert( - "UpdateSLOCorrection".to_string(), + "v1.GetSLOCorrection".to_string(), + test_v1_get_slo_correction, + ); + world.function_mappings.insert( + "v1.UpdateSLOCorrection".to_string(), test_v1_update_slo_correction, ); world .function_mappings - .insert("ListHostTags".to_string(), test_v1_list_host_tags); - world - .function_mappings - .insert("DeleteHostTags".to_string(), test_v1_delete_host_tags); - world - .function_mappings - .insert("GetHostTags".to_string(), test_v1_get_host_tags); - world - .function_mappings - .insert("CreateHostTags".to_string(), test_v1_create_host_tags); - world - .function_mappings - .insert("UpdateHostTags".to_string(), test_v1_update_host_tags); + .insert("v1.ListHostTags".to_string(), test_v1_list_host_tags); world .function_mappings - .insert("ListUsers".to_string(), test_v1_list_users); + .insert("v1.DeleteHostTags".to_string(), test_v1_delete_host_tags); world .function_mappings - .insert("CreateUser".to_string(), test_v1_create_user); + .insert("v1.GetHostTags".to_string(), test_v1_get_host_tags); world .function_mappings - .insert("DisableUser".to_string(), test_v1_disable_user); + .insert("v1.CreateHostTags".to_string(), test_v1_create_host_tags); world .function_mappings - .insert("GetUser".to_string(), test_v1_get_user); + .insert("v1.UpdateHostTags".to_string(), test_v1_update_host_tags); world .function_mappings - .insert("UpdateUser".to_string(), test_v1_update_user); + .insert("v1.ListUsers".to_string(), test_v1_list_users); world .function_mappings - .insert("Validate".to_string(), test_v1_validate); + .insert("v1.CreateUser".to_string(), test_v1_create_user); world .function_mappings - .insert("ListSpansMetrics".to_string(), test_v2_list_spans_metrics); + .insert("v1.DisableUser".to_string(), test_v1_disable_user); world .function_mappings - .insert("CreateSpansMetric".to_string(), test_v2_create_spans_metric); + .insert("v1.GetUser".to_string(), test_v1_get_user); world .function_mappings - .insert("DeleteSpansMetric".to_string(), test_v2_delete_spans_metric); + .insert("v1.UpdateUser".to_string(), test_v1_update_user); world .function_mappings - .insert("GetSpansMetric".to_string(), test_v2_get_spans_metric); + .insert("v1.Validate".to_string(), test_v1_validate); + world.function_mappings.insert( + "v2.ListSpansMetrics".to_string(), + test_v2_list_spans_metrics, + ); + world.function_mappings.insert( + "v2.CreateSpansMetric".to_string(), + test_v2_create_spans_metric, + ); + world.function_mappings.insert( + "v2.DeleteSpansMetric".to_string(), + test_v2_delete_spans_metric, + ); world .function_mappings - .insert("UpdateSpansMetric".to_string(), test_v2_update_spans_metric); + .insert("v2.GetSpansMetric".to_string(), test_v2_get_spans_metric); + world.function_mappings.insert( + "v2.UpdateSpansMetric".to_string(), + test_v2_update_spans_metric, + ); world.function_mappings.insert( - "ListApmRetentionFilters".to_string(), + "v2.ListApmRetentionFilters".to_string(), test_v2_list_apm_retention_filters, ); world.function_mappings.insert( - "CreateApmRetentionFilter".to_string(), + "v2.CreateApmRetentionFilter".to_string(), test_v2_create_apm_retention_filter, ); world.function_mappings.insert( - "ReorderApmRetentionFilters".to_string(), + "v2.ReorderApmRetentionFilters".to_string(), test_v2_reorder_apm_retention_filters, ); world.function_mappings.insert( - "DeleteApmRetentionFilter".to_string(), + "v2.DeleteApmRetentionFilter".to_string(), test_v2_delete_apm_retention_filter, ); world.function_mappings.insert( - "GetApmRetentionFilter".to_string(), + "v2.GetApmRetentionFilter".to_string(), test_v2_get_apm_retention_filter, ); world.function_mappings.insert( - "UpdateApmRetentionFilter".to_string(), + "v2.UpdateApmRetentionFilter".to_string(), test_v2_update_apm_retention_filter, ); world .function_mappings - .insert("ListAuditLogs".to_string(), test_v2_list_audit_logs); + .insert("v2.ListAuditLogs".to_string(), test_v2_list_audit_logs); world .function_mappings - .insert("SearchAuditLogs".to_string(), test_v2_search_audit_logs); + .insert("v2.SearchAuditLogs".to_string(), test_v2_search_audit_logs); world.function_mappings.insert( - "DeleteDashboardListItems".to_string(), + "v2.DeleteDashboardListItems".to_string(), test_v2_delete_dashboard_list_items, ); world.function_mappings.insert( - "GetDashboardListItems".to_string(), + "v2.GetDashboardListItems".to_string(), test_v2_get_dashboard_list_items, ); world.function_mappings.insert( - "CreateDashboardListItems".to_string(), + "v2.CreateDashboardListItems".to_string(), test_v2_create_dashboard_list_items, ); world.function_mappings.insert( - "UpdateDashboardListItems".to_string(), + "v2.UpdateDashboardListItems".to_string(), test_v2_update_dashboard_list_items, ); world .function_mappings - .insert("ListEvents".to_string(), test_v2_list_events); + .insert("v2.ListEvents".to_string(), test_v2_list_events); world .function_mappings - .insert("SearchEvents".to_string(), test_v2_search_events); + .insert("v2.SearchEvents".to_string(), test_v2_search_events); world.function_mappings.insert( - "ListGCPSTSAccounts".to_string(), + "v2.ListGCPSTSAccounts".to_string(), test_v2_list_gcpsts_accounts, ); world.function_mappings.insert( - "CreateGCPSTSAccount".to_string(), + "v2.CreateGCPSTSAccount".to_string(), test_v2_create_gcpsts_account, ); world.function_mappings.insert( - "DeleteGCPSTSAccount".to_string(), + "v2.DeleteGCPSTSAccount".to_string(), test_v2_delete_gcpsts_account, ); world.function_mappings.insert( - "UpdateGCPSTSAccount".to_string(), + "v2.UpdateGCPSTSAccount".to_string(), test_v2_update_gcpsts_account, ); - world - .function_mappings - .insert("GetGCPSTSDelegate".to_string(), test_v2_get_gcpsts_delegate); world.function_mappings.insert( - "MakeGCPSTSDelegate".to_string(), + "v2.GetGCPSTSDelegate".to_string(), + test_v2_get_gcpsts_delegate, + ); + world.function_mappings.insert( + "v2.MakeGCPSTSDelegate".to_string(), test_v2_make_gcpsts_delegate, ); world.function_mappings.insert( - "ListOpsgenieServices".to_string(), + "v2.ListOpsgenieServices".to_string(), test_v2_list_opsgenie_services, ); world.function_mappings.insert( - "CreateOpsgenieService".to_string(), + "v2.CreateOpsgenieService".to_string(), test_v2_create_opsgenie_service, ); world.function_mappings.insert( - "DeleteOpsgenieService".to_string(), + "v2.DeleteOpsgenieService".to_string(), test_v2_delete_opsgenie_service, ); world.function_mappings.insert( - "GetOpsgenieService".to_string(), + "v2.GetOpsgenieService".to_string(), test_v2_get_opsgenie_service, ); world.function_mappings.insert( - "UpdateOpsgenieService".to_string(), + "v2.UpdateOpsgenieService".to_string(), test_v2_update_opsgenie_service, ); world.function_mappings.insert( - "ListCloudflareAccounts".to_string(), + "v2.ListCloudflareAccounts".to_string(), test_v2_list_cloudflare_accounts, ); world.function_mappings.insert( - "CreateCloudflareAccount".to_string(), + "v2.CreateCloudflareAccount".to_string(), test_v2_create_cloudflare_account, ); world.function_mappings.insert( - "DeleteCloudflareAccount".to_string(), + "v2.DeleteCloudflareAccount".to_string(), test_v2_delete_cloudflare_account, ); world.function_mappings.insert( - "GetCloudflareAccount".to_string(), + "v2.GetCloudflareAccount".to_string(), test_v2_get_cloudflare_account, ); world.function_mappings.insert( - "UpdateCloudflareAccount".to_string(), + "v2.UpdateCloudflareAccount".to_string(), test_v2_update_cloudflare_account, ); world.function_mappings.insert( - "ListConfluentAccount".to_string(), + "v2.ListConfluentAccount".to_string(), test_v2_list_confluent_account, ); world.function_mappings.insert( - "CreateConfluentAccount".to_string(), + "v2.CreateConfluentAccount".to_string(), test_v2_create_confluent_account, ); world.function_mappings.insert( - "DeleteConfluentAccount".to_string(), + "v2.DeleteConfluentAccount".to_string(), test_v2_delete_confluent_account, ); world.function_mappings.insert( - "GetConfluentAccount".to_string(), + "v2.GetConfluentAccount".to_string(), test_v2_get_confluent_account, ); world.function_mappings.insert( - "UpdateConfluentAccount".to_string(), + "v2.UpdateConfluentAccount".to_string(), test_v2_update_confluent_account, ); world.function_mappings.insert( - "ListConfluentResource".to_string(), + "v2.ListConfluentResource".to_string(), test_v2_list_confluent_resource, ); world.function_mappings.insert( - "CreateConfluentResource".to_string(), + "v2.CreateConfluentResource".to_string(), test_v2_create_confluent_resource, ); world.function_mappings.insert( - "DeleteConfluentResource".to_string(), + "v2.DeleteConfluentResource".to_string(), test_v2_delete_confluent_resource, ); world.function_mappings.insert( - "GetConfluentResource".to_string(), + "v2.GetConfluentResource".to_string(), test_v2_get_confluent_resource, ); world.function_mappings.insert( - "UpdateConfluentResource".to_string(), + "v2.UpdateConfluentResource".to_string(), test_v2_update_confluent_resource, ); world.function_mappings.insert( - "ListFastlyAccounts".to_string(), + "v2.ListFastlyAccounts".to_string(), test_v2_list_fastly_accounts, ); world.function_mappings.insert( - "CreateFastlyAccount".to_string(), + "v2.CreateFastlyAccount".to_string(), test_v2_create_fastly_account, ); world.function_mappings.insert( - "DeleteFastlyAccount".to_string(), + "v2.DeleteFastlyAccount".to_string(), test_v2_delete_fastly_account, ); - world - .function_mappings - .insert("GetFastlyAccount".to_string(), test_v2_get_fastly_account); world.function_mappings.insert( - "UpdateFastlyAccount".to_string(), + "v2.GetFastlyAccount".to_string(), + test_v2_get_fastly_account, + ); + world.function_mappings.insert( + "v2.UpdateFastlyAccount".to_string(), test_v2_update_fastly_account, ); world.function_mappings.insert( - "ListFastlyServices".to_string(), + "v2.ListFastlyServices".to_string(), test_v2_list_fastly_services, ); world.function_mappings.insert( - "CreateFastlyService".to_string(), + "v2.CreateFastlyService".to_string(), test_v2_create_fastly_service, ); world.function_mappings.insert( - "DeleteFastlyService".to_string(), + "v2.DeleteFastlyService".to_string(), test_v2_delete_fastly_service, ); - world - .function_mappings - .insert("GetFastlyService".to_string(), test_v2_get_fastly_service); world.function_mappings.insert( - "UpdateFastlyService".to_string(), + "v2.GetFastlyService".to_string(), + test_v2_get_fastly_service, + ); + world.function_mappings.insert( + "v2.UpdateFastlyService".to_string(), test_v2_update_fastly_service, ); world .function_mappings - .insert("GetIPAllowlist".to_string(), test_v2_get_ip_allowlist); - world - .function_mappings - .insert("UpdateIPAllowlist".to_string(), test_v2_update_ip_allowlist); - world - .function_mappings - .insert("SubmitLog".to_string(), test_v2_submit_log); - world - .function_mappings - .insert("ListLogsMetrics".to_string(), test_v2_list_logs_metrics); - world - .function_mappings - .insert("CreateLogsMetric".to_string(), test_v2_create_logs_metric); + .insert("v2.GetIPAllowlist".to_string(), test_v2_get_ip_allowlist); + world.function_mappings.insert( + "v2.UpdateIPAllowlist".to_string(), + test_v2_update_ip_allowlist, + ); world .function_mappings - .insert("DeleteLogsMetric".to_string(), test_v2_delete_logs_metric); + .insert("v2.SubmitLog".to_string(), test_v2_submit_log); world .function_mappings - .insert("GetLogsMetric".to_string(), test_v2_get_logs_metric); + .insert("v2.ListLogsMetrics".to_string(), test_v2_list_logs_metrics); + world.function_mappings.insert( + "v2.CreateLogsMetric".to_string(), + test_v2_create_logs_metric, + ); + world.function_mappings.insert( + "v2.DeleteLogsMetric".to_string(), + test_v2_delete_logs_metric, + ); world .function_mappings - .insert("UpdateLogsMetric".to_string(), test_v2_update_logs_metric); + .insert("v2.GetLogsMetric".to_string(), test_v2_get_logs_metric); + world.function_mappings.insert( + "v2.UpdateLogsMetric".to_string(), + test_v2_update_logs_metric, + ); world .function_mappings - .insert("ListPermissions".to_string(), test_v2_list_permissions); + .insert("v2.ListPermissions".to_string(), test_v2_list_permissions); world .function_mappings - .insert("ListFindings".to_string(), test_v2_list_findings); + .insert("v2.ListFindings".to_string(), test_v2_list_findings); world .function_mappings - .insert("GetFinding".to_string(), test_v2_get_finding); + .insert("v2.GetFinding".to_string(), test_v2_get_finding); world .function_mappings - .insert("UpdateFinding".to_string(), test_v2_update_finding); + .insert("v2.UpdateFinding".to_string(), test_v2_update_finding); world .function_mappings - .insert("ListProcesses".to_string(), test_v2_list_processes); + .insert("v2.ListProcesses".to_string(), test_v2_list_processes); world.function_mappings.insert( - "DeleteRestrictionPolicy".to_string(), + "v2.DeleteRestrictionPolicy".to_string(), test_v2_delete_restriction_policy, ); world.function_mappings.insert( - "GetRestrictionPolicy".to_string(), + "v2.GetRestrictionPolicy".to_string(), test_v2_get_restriction_policy, ); world.function_mappings.insert( - "UpdateRestrictionPolicy".to_string(), + "v2.UpdateRestrictionPolicy".to_string(), test_v2_update_restriction_policy, ); world.function_mappings.insert( - "UploadIdPMetadata".to_string(), + "v2.UploadIdPMetadata".to_string(), test_v2_upload_id_p_metadata, ); world.function_mappings.insert( - "DownloadCloudWorkloadPolicyFile".to_string(), + "v2.DownloadCloudWorkloadPolicyFile".to_string(), test_v2_download_cloud_workload_policy_file, ); world.function_mappings.insert( - "ListCloudWorkloadSecurityAgentRules".to_string(), + "v2.ListCloudWorkloadSecurityAgentRules".to_string(), test_v2_list_cloud_workload_security_agent_rules, ); world.function_mappings.insert( - "CreateCloudWorkloadSecurityAgentRule".to_string(), + "v2.CreateCloudWorkloadSecurityAgentRule".to_string(), test_v2_create_cloud_workload_security_agent_rule, ); world.function_mappings.insert( - "DeleteCloudWorkloadSecurityAgentRule".to_string(), + "v2.DeleteCloudWorkloadSecurityAgentRule".to_string(), test_v2_delete_cloud_workload_security_agent_rule, ); world.function_mappings.insert( - "GetCloudWorkloadSecurityAgentRule".to_string(), + "v2.GetCloudWorkloadSecurityAgentRule".to_string(), test_v2_get_cloud_workload_security_agent_rule, ); world.function_mappings.insert( - "UpdateCloudWorkloadSecurityAgentRule".to_string(), + "v2.UpdateCloudWorkloadSecurityAgentRule".to_string(), test_v2_update_cloud_workload_security_agent_rule, ); world .function_mappings - .insert("SubmitMetrics".to_string(), test_v2_submit_metrics); + .insert("v2.SubmitMetrics".to_string(), test_v2_submit_metrics); world.function_mappings.insert( - "GetOnDemandConcurrencyCap".to_string(), + "v2.GetOnDemandConcurrencyCap".to_string(), test_v2_get_on_demand_concurrency_cap, ); world.function_mappings.insert( - "SetOnDemandConcurrencyCap".to_string(), + "v2.SetOnDemandConcurrencyCap".to_string(), test_v2_set_on_demand_concurrency_cap, ); world.function_mappings.insert( - "GetUsageApplicationSecurityMonitoring".to_string(), + "v2.GetUsageApplicationSecurityMonitoring".to_string(), test_v2_get_usage_application_security_monitoring, ); world .function_mappings - .insert("GetCostByOrg".to_string(), test_v2_get_cost_by_org); + .insert("v2.GetCostByOrg".to_string(), test_v2_get_cost_by_org); world.function_mappings.insert( - "GetEstimatedCostByOrg".to_string(), + "v2.GetEstimatedCostByOrg".to_string(), test_v2_get_estimated_cost_by_org, ); world.function_mappings.insert( - "GetHistoricalCostByOrg".to_string(), + "v2.GetHistoricalCostByOrg".to_string(), test_v2_get_historical_cost_by_org, ); world .function_mappings - .insert("GetHourlyUsage".to_string(), test_v2_get_hourly_usage); + .insert("v2.GetHourlyUsage".to_string(), test_v2_get_hourly_usage); world.function_mappings.insert( - "GetUsageLambdaTracedInvocations".to_string(), + "v2.GetUsageLambdaTracedInvocations".to_string(), test_v2_get_usage_lambda_traced_invocations, ); world.function_mappings.insert( - "GetUsageObservabilityPipelines".to_string(), + "v2.GetUsageObservabilityPipelines".to_string(), test_v2_get_usage_observability_pipelines, ); } @@ -1603,22 +1629,22 @@ fn test_v1_get_daily_custom_reports( .as_ref() .expect("api instance not found"); let page_size = if let Some(param) = _parameters.get("page[size]") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let page_number = if let Some(param) = _parameters.get("page[number]") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort_dir = if let Some(param) = _parameters.get("sort_dir") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort = if let Some(param) = _parameters.get("sort") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; @@ -1676,22 +1702,22 @@ fn test_v1_get_monthly_custom_reports( .as_ref() .expect("api instance not found"); let page_size = if let Some(param) = _parameters.get("page[size]") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let page_number = if let Some(param) = _parameters.get("page[number]") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort_dir = if let Some(param) = _parameters.get("sort_dir") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort = if let Some(param) = _parameters.get("sort") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; @@ -1747,7 +1773,7 @@ fn test_v1_get_usage_analyzed_logs(world: &mut DatadogWorld, _parameters: &HashM .expect("api instance not found"); let start_hr = serde_json::from_value(_parameters.get("start_hr").unwrap().clone()).unwrap(); let end_hr = if let Some(param) = _parameters.get("end_hr") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; @@ -1776,32 +1802,32 @@ fn test_v1_get_usage_attribution(world: &mut DatadogWorld, _parameters: &HashMap serde_json::from_value(_parameters.get("start_month").unwrap().clone()).unwrap(); let fields = serde_json::from_value(_parameters.get("fields").unwrap().clone()).unwrap(); let end_month = if let Some(param) = _parameters.get("end_month") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort_direction = if let Some(param) = _parameters.get("sort_direction") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let sort_name = if let Some(param) = _parameters.get("sort_name") { - serde_json::from_value(param.clone()).unwrap() + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let include_descendants = if let Some(param) = _parameters.get("include_descendants") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let offset = if let Some(param) = _parameters.get("offset") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; let limit = if let Some(param) = _parameters.get("limit") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; @@ -1836,7 +1862,7 @@ fn test_v1_get_usage_audit_logs(world: &mut DatadogWorld, _parameters: &HashMap< .expect("api instance not found"); let start_hr = serde_json::from_value(_parameters.get("start_hr").unwrap().clone()).unwrap(); let end_hr = if let Some(param) = _parameters.get("end_hr") { - Some(param.as_str().unwrap().parse().unwrap()) + Some(serde_json::from_value(param.clone()).unwrap()) } else { None }; @@ -1862,7 +1888,7 @@ fn test_v1_get_usage_lambda(world: &mut DatadogWorld, _parameters: &HashMap