Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions examples/v2_pup-bump-test_GetPupBumpTest.rs
Original file line number Diff line number Diff line change
@@ -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());
}
}
1 change: 1 addition & 0 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
206 changes: 206 additions & 0 deletions src/datadogV2/api/api_pup_bump_test.rs
Original file line number Diff line number Diff line change
@@ -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<reqwest::Response, reqwest_middleware::Error>,
) -> Option<reqwest_retry::Retryable> {
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<crate::datadogV2::model::PupBumpTestResponse, datadog::Error<GetPupBumpTestError>>
{
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<crate::datadogV2::model::PupBumpTestResponse>,
datadog::Error<GetPupBumpTestError>,
> {
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::<crate::datadogV2::model::PupBumpTestResponse>(
&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<GetPupBumpTestError> =
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))
}
}
}
1 change: 1 addition & 0 deletions src/datadogV2/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/datadogV2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading