diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 90e119682..6eeb7ac78 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -78894,6 +78894,49 @@ components: type: string x-enum-varnames: - PUBLISHREQUEST + PupBumpTestData: + description: Pup bump test resource data. + properties: + attributes: + $ref: "#/components/schemas/PupBumpTestDataAttributes" + id: + description: Pup bump test identifier. + example: "pup-bump-test-1" + type: string + type: + $ref: "#/components/schemas/PupBumpTestType" + required: + - id + - type + - attributes + type: object + PupBumpTestDataAttributes: + description: Attributes of the pup bump test resource. + properties: + message: + description: A test message. + example: "hello from pup bump test" + type: string + required: + - message + type: object + PupBumpTestResponse: + description: Response for the pup bump test endpoint. + properties: + data: + $ref: "#/components/schemas/PupBumpTestData" + required: + - data + type: object + PupBumpTestType: + default: pup_bump_test + description: Pup bump test resource type. + enum: + - pup_bump_test + example: "pup_bump_test" + type: string + x-enum-varnames: + - PUP_BUMP_TEST PutAppsDatastoreItemResponseArray: description: Response after successfully inserting multiple items into a datastore, containing the identifiers of the created items. properties: @@ -169631,6 +169674,41 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/pup_bump_test: + get: + description: |- + Temporary test-only endpoint used to exercise the pup dependency-bump + generation and merge pipeline. Not a real product feature. + operationId: GetPupBumpTest + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + message: "hello from pup bump test" + id: "pup-bump-test-1" + type: pup_bump_test + schema: + $ref: "#/components/schemas/PupBumpTestResponse" + description: OK + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get pup bump test resource + tags: + - Pup Bump Test + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/query/scalar: post: description: |- @@ -203918,6 +203996,10 @@ tags: **Note**: Sending server-side events impacts billing. Review the [pricing page](https://www.datadoghq.com/pricing/?product=product-analytics#products) and contact your Customer Success Manager for more information. name: Product Analytics + - description: |- + Temporary test-only tag used to exercise the pup dependency-bump + generation and merge pipeline. Not a real product feature. + name: Pup Bump Test - description: |- Manage your Real User Monitoring (RUM) applications, and search or aggregate your RUM events over HTTP. See the [RUM & Session Replay page](https://docs.datadoghq.com/real_user_monitoring/) for more information name: RUM diff --git a/examples/v2_pup-bump-test_GetPupBumpTest.rs b/examples/v2_pup-bump-test_GetPupBumpTest.rs new file mode 100644 index 000000000..92591654c --- /dev/null +++ b/examples/v2_pup-bump-test_GetPupBumpTest.rs @@ -0,0 +1,16 @@ +// Get pup bump test resource returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_pup_bump_test::PupBumpTestAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetPupBumpTest", true); + let api = PupBumpTestAPI::with_config(configuration); + let resp = api.get_pup_bump_test().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 99416e6fc..03c9e1e37 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -712,6 +712,7 @@ impl Default for Configuration { ("v2.update_connection".to_owned(), false), ("v2.get_pruned_trace_by_id".to_owned(), false), ("v2.get_trace_by_id".to_owned(), false), + ("v2.get_pup_bump_test".to_owned(), false), ("v2.get_asm_service_by_name".to_owned(), false), ("v2.get_rum_sdk_config".to_owned(), false), ("v2.update_rum_sdk_config".to_owned(), false), diff --git a/src/datadogV2/api/api_pup_bump_test.rs b/src/datadogV2/api/api_pup_bump_test.rs new file mode 100644 index 000000000..4ba65025b --- /dev/null +++ b/src/datadogV2/api/api_pup_bump_test.rs @@ -0,0 +1,206 @@ +// 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 crate::datadog; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; + +/// GetPupBumpTestError is a struct for typed errors of method [`PupBumpTestAPI::get_pup_bump_test`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPupBumpTestError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Temporary test-only tag used to exercise the pup dependency-bump +/// generation and merge pipeline. Not a real product feature. +#[derive(Debug, Clone)] +pub struct PupBumpTestAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for PupBumpTestAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl PupBumpTestAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let reqwest_client_builder = { + let builder = reqwest::Client::builder(); + #[cfg(not(target_arch = "wasm32"))] + let builder = if let Some(proxy_url) = &config.proxy_url { + builder.proxy(reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL")) + } else { + builder + }; + builder + }; + + let middleware_client_builder = { + let builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + #[cfg(feature = "retry")] + let builder = if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + builder.with(retry_middleware) + } else { + builder + }; + builder + }; + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Temporary test-only endpoint used to exercise the pup dependency-bump + /// generation and merge pipeline. Not a real product feature. + pub async fn get_pup_bump_test( + &self, + ) -> Result> + { + match self.get_pup_bump_test_with_http_info().await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Temporary test-only endpoint used to exercise the pup dependency-bump + /// generation and merge pipeline. Not a real product feature. + pub async fn get_pup_bump_test_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_pup_bump_test"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_pup_bump_test' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/pup_bump_test", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } +} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 1bb4db19d..eded8a80b 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -95,6 +95,7 @@ pub mod api_organizations; pub mod api_powerpack; pub mod api_processes; pub mod api_product_analytics; +pub mod api_pup_bump_test; pub mod api_reference_tables; pub mod api_report_schedules; pub mod api_reporting_and_sharing; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index cf3a37a3a..d74fa1e7b 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -96,6 +96,7 @@ pub use self::api::api_organizations; pub use self::api::api_powerpack; pub use self::api::api_processes; pub use self::api::api_product_analytics; +pub use self::api::api_pup_bump_test; pub use self::api::api_reference_tables; pub use self::api::api_report_schedules; pub use self::api::api_reporting_and_sharing; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index afd71a72d..3d8960b71 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -9064,6 +9064,14 @@ pub mod model_apm_span_error_flag; pub use self::model_apm_span_error_flag::APMSpanErrorFlag; pub mod model_pruned_trace_type; pub use self::model_pruned_trace_type::PrunedTraceType; +pub mod model_pup_bump_test_response; +pub use self::model_pup_bump_test_response::PupBumpTestResponse; +pub mod model_pup_bump_test_data; +pub use self::model_pup_bump_test_data::PupBumpTestData; +pub mod model_pup_bump_test_data_attributes; +pub use self::model_pup_bump_test_data_attributes::PupBumpTestDataAttributes; +pub mod model_pup_bump_test_type; +pub use self::model_pup_bump_test_type::PupBumpTestType; pub mod model_scalar_formula_query_request; pub use self::model_scalar_formula_query_request::ScalarFormulaQueryRequest; pub mod model_scalar_formula_request; diff --git a/src/datadogV2/model/model_pup_bump_test_data.rs b/src/datadogV2/model/model_pup_bump_test_data.rs new file mode 100644 index 000000000..2099a635b --- /dev/null +++ b/src/datadogV2/model/model_pup_bump_test_data.rs @@ -0,0 +1,127 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Pup bump test resource data. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PupBumpTestData { + /// Attributes of the pup bump test resource. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::PupBumpTestDataAttributes, + /// Pup bump test identifier. + #[serde(rename = "id")] + pub id: String, + /// Pup bump test resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::PupBumpTestType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PupBumpTestData { + pub fn new( + attributes: crate::datadogV2::model::PupBumpTestDataAttributes, + id: String, + type_: crate::datadogV2::model::PupBumpTestType, + ) -> PupBumpTestData { + PupBumpTestData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for PupBumpTestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PupBumpTestDataVisitor; + impl<'a> Visitor<'a> for PupBumpTestDataVisitor { + type Value = PupBumpTestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::PupBumpTestType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = PupBumpTestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PupBumpTestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_pup_bump_test_data_attributes.rs b/src/datadogV2/model/model_pup_bump_test_data_attributes.rs new file mode 100644 index 000000000..3a6450dbc --- /dev/null +++ b/src/datadogV2/model/model_pup_bump_test_data_attributes.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of the pup bump test resource. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PupBumpTestDataAttributes { + /// A test message. + #[serde(rename = "message")] + pub message: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PupBumpTestDataAttributes { + pub fn new(message: String) -> PupBumpTestDataAttributes { + PupBumpTestDataAttributes { + message, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for PupBumpTestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PupBumpTestDataAttributesVisitor; + impl<'a> Visitor<'a> for PupBumpTestDataAttributesVisitor { + type Value = PupBumpTestDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut message: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "message" => { + message = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let message = message.ok_or_else(|| M::Error::missing_field("message"))?; + + let content = PupBumpTestDataAttributes { + message, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PupBumpTestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_pup_bump_test_response.rs b/src/datadogV2/model/model_pup_bump_test_response.rs new file mode 100644 index 000000000..810a210f6 --- /dev/null +++ b/src/datadogV2/model/model_pup_bump_test_response.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response for the pup bump test endpoint. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PupBumpTestResponse { + /// Pup bump test resource data. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::PupBumpTestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PupBumpTestResponse { + pub fn new(data: crate::datadogV2::model::PupBumpTestData) -> PupBumpTestResponse { + PupBumpTestResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for PupBumpTestResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PupBumpTestResponseVisitor; + impl<'a> Visitor<'a> for PupBumpTestResponseVisitor { + type Value = PupBumpTestResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = PupBumpTestResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PupBumpTestResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_pup_bump_test_type.rs b/src/datadogV2/model/model_pup_bump_test_type.rs new file mode 100644 index 000000000..5c92cff49 --- /dev/null +++ b/src/datadogV2/model/model_pup_bump_test_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum PupBumpTestType { + PUP_BUMP_TEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for PupBumpTestType { + fn to_string(&self) -> String { + match self { + Self::PUP_BUMP_TEST => String::from("pup_bump_test"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for PupBumpTestType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for PupBumpTestType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "pup_bump_test" => Self::PUP_BUMP_TEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/features/v2/pup_bump_test.feature b/tests/scenarios/features/v2/pup_bump_test.feature new file mode 100644 index 000000000..43a2dd763 --- /dev/null +++ b/tests/scenarios/features/v2/pup_bump_test.feature @@ -0,0 +1,21 @@ +@endpoint(pup-bump-test) @endpoint(pup-bump-test-v2) +Feature: Pup Bump Test + Temporary test-only tag used to exercise the pup dependency-bump + generation and merge pipeline. Not a real product feature. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "PupBumpTest" API + And operation "GetPupBumpTest" enabled + And new "GetPupBumpTest" request + + @generated @skip @team:DataDog/monitor-app + Scenario: Get pup bump test resource returns "Not Found" response + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/monitor-app + Scenario: Get pup bump test resource returns "OK" response + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index e72767d8e..84e827a40 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -6284,6 +6284,12 @@ "type": "safe" } }, + "GetPupBumpTest": { + "tag": "Pup Bump Test", + "undo": { + "type": "safe" + } + }, "QueryScalarData": { "tag": "Metrics", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 3f5c3795a..ab3c28397 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -185,6 +185,7 @@ pub struct ApiInstances { pub v2_api_rum_audience_management: Option, pub v2_api_apm_trace: Option, + pub v2_api_pup_bump_test: Option, pub v2_api_reference_tables: Option, pub v2_api_application_security: Option, @@ -1225,6 +1226,14 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { ), ); } + "PupBumpTest" => { + world.api_instances.v2_api_pup_bump_test = Some( + datadogV2::api_pup_bump_test::PupBumpTestAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); + } "ReferenceTables" => { world.api_instances.v2_api_reference_tables = Some( datadogV2::api_reference_tables::ReferenceTablesAPI::with_client_and_config( @@ -6574,6 +6583,9 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.GetTraceByID".into(), test_v2_get_trace_by_id); + world + .function_mappings + .insert("v2.GetPupBumpTest".into(), test_v2_get_pup_bump_test); world .function_mappings .insert("v2.BatchRowsQuery".into(), test_v2_batch_rows_query); @@ -51407,6 +51419,30 @@ fn test_v2_get_trace_by_id(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_pup_bump_test + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.get_pup_bump_test_with_http_info()) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_batch_rows_query(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances