Skip to content

Commit 7c79a96

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4a60f0e of spec repo
1 parent beba5f3 commit 7c79a96

File tree

14 files changed

+850
-0
lines changed

14 files changed

+850
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50937,6 +50937,49 @@ components:
5093750937
$ref: '#/components/schemas/ServiceDefinitionData'
5093850938
type: array
5093950939
type: object
50940+
ServiceList:
50941+
properties:
50942+
data:
50943+
$ref: '#/components/schemas/ServiceListData'
50944+
type: object
50945+
ServiceListData:
50946+
properties:
50947+
attributes:
50948+
$ref: '#/components/schemas/ServiceListDataAttributes'
50949+
id:
50950+
type: string
50951+
type:
50952+
$ref: '#/components/schemas/ServiceListDataType'
50953+
required:
50954+
- type
50955+
type: object
50956+
ServiceListDataAttributes:
50957+
properties:
50958+
metadata:
50959+
items:
50960+
$ref: '#/components/schemas/ServiceListDataAttributesMetadataItems'
50961+
type: array
50962+
services:
50963+
items:
50964+
type: string
50965+
type: array
50966+
type: object
50967+
ServiceListDataAttributesMetadataItems:
50968+
properties:
50969+
isTraced:
50970+
type: boolean
50971+
isUsm:
50972+
type: boolean
50973+
type: object
50974+
ServiceListDataType:
50975+
default: services_list
50976+
description: Services list resource type.
50977+
enum:
50978+
- services_list
50979+
example: services_list
50980+
type: string
50981+
x-enum-varnames:
50982+
- SERVICES_LIST
5094050983
ServiceNowBasicAuth:
5094150984
description: The definition of the `ServiceNowBasicAuth` object.
5094250985
properties:
@@ -61130,6 +61173,26 @@ paths:
6113061173
permissions:
6113161174
- apm_retention_filter_write
6113261175
- apm_pipelines_write
61176+
/api/v2/apm/services:
61177+
get:
61178+
operationId: GetServiceList
61179+
responses:
61180+
'200':
61181+
content:
61182+
application/json:
61183+
schema:
61184+
$ref: '#/components/schemas/ServiceList'
61185+
description: OK
61186+
'429':
61187+
$ref: '#/components/responses/TooManyRequestsResponse'
61188+
security:
61189+
- apiKeyAuth: []
61190+
appKeyAuth: []
61191+
- AuthZ:
61192+
- apm_read
61193+
summary: Get service list
61194+
tags:
61195+
- Apm
6113361196
/api/v2/app-builder/apps:
6113461197
delete:
6113561198
description: Delete multiple apps in a single request from a list of app IDs.
@@ -87764,6 +87827,8 @@ tags:
8776487827
offers also Sensitive Data Scanning capabilities on your storage.\nGo to https://www.datadoghq.com/blog/agentless-scanning/
8776587828
to learn more."
8776687829
name: Agentless Scanning
87830+
- description: Auto-generated tag Apm
87831+
name: Apm
8776787832
- description: Datadog App Builder provides a low-code solution to rapidly develop
8776887833
and integrate secure, customized applications into your monitoring stack that
8776987834
are built to accelerate remediation at scale. These API endpoints allow you to

examples/v2_apm_GetServiceList.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Get service list returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_apm::ApmAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = ApmAPI::with_config(configuration);
9+
let resp = api.get_service_list().await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}

src/datadogV2/api/api_apm.rs

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use crate::datadog;
5+
use reqwest::header::{HeaderMap, HeaderValue};
6+
use serde::{Deserialize, Serialize};
7+
8+
/// GetServiceListError is a struct for typed errors of method [`ApmAPI::get_service_list`]
9+
#[derive(Debug, Clone, Serialize, Deserialize)]
10+
#[serde(untagged)]
11+
pub enum GetServiceListError {
12+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
13+
UnknownValue(serde_json::Value),
14+
}
15+
16+
/// Auto-generated tag Apm
17+
#[derive(Debug, Clone)]
18+
pub struct ApmAPI {
19+
config: datadog::Configuration,
20+
client: reqwest_middleware::ClientWithMiddleware,
21+
}
22+
23+
impl Default for ApmAPI {
24+
fn default() -> Self {
25+
Self::with_config(datadog::Configuration::default())
26+
}
27+
}
28+
29+
impl ApmAPI {
30+
pub fn new() -> Self {
31+
Self::default()
32+
}
33+
pub fn with_config(config: datadog::Configuration) -> Self {
34+
let mut reqwest_client_builder = reqwest::Client::builder();
35+
36+
if let Some(proxy_url) = &config.proxy_url {
37+
let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL");
38+
reqwest_client_builder = reqwest_client_builder.proxy(proxy);
39+
}
40+
41+
let mut middleware_client_builder =
42+
reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap());
43+
44+
if config.enable_retry {
45+
struct RetryableStatus;
46+
impl reqwest_retry::RetryableStrategy for RetryableStatus {
47+
fn handle(
48+
&self,
49+
res: &Result<reqwest::Response, reqwest_middleware::Error>,
50+
) -> Option<reqwest_retry::Retryable> {
51+
match res {
52+
Ok(success) => reqwest_retry::default_on_request_success(success),
53+
Err(_) => None,
54+
}
55+
}
56+
}
57+
let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder()
58+
.build_with_max_retries(config.max_retries);
59+
60+
let retry_middleware =
61+
reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy(
62+
backoff_policy,
63+
RetryableStatus,
64+
);
65+
66+
middleware_client_builder = middleware_client_builder.with(retry_middleware);
67+
}
68+
69+
let client = middleware_client_builder.build();
70+
71+
Self { config, client }
72+
}
73+
74+
pub fn with_client_and_config(
75+
config: datadog::Configuration,
76+
client: reqwest_middleware::ClientWithMiddleware,
77+
) -> Self {
78+
Self { config, client }
79+
}
80+
81+
pub async fn get_service_list(
82+
&self,
83+
) -> Result<crate::datadogV2::model::ServiceList, datadog::Error<GetServiceListError>> {
84+
match self.get_service_list_with_http_info().await {
85+
Ok(response_content) => {
86+
if let Some(e) = response_content.entity {
87+
Ok(e)
88+
} else {
89+
Err(datadog::Error::Serde(serde::de::Error::custom(
90+
"response content was None",
91+
)))
92+
}
93+
}
94+
Err(err) => Err(err),
95+
}
96+
}
97+
98+
pub async fn get_service_list_with_http_info(
99+
&self,
100+
) -> Result<
101+
datadog::ResponseContent<crate::datadogV2::model::ServiceList>,
102+
datadog::Error<GetServiceListError>,
103+
> {
104+
let local_configuration = &self.config;
105+
let operation_id = "v2.get_service_list";
106+
107+
let local_client = &self.client;
108+
109+
let local_uri_str = format!(
110+
"{}/api/v2/apm/services",
111+
local_configuration.get_operation_host(operation_id)
112+
);
113+
let mut local_req_builder =
114+
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
115+
116+
// build headers
117+
let mut headers = HeaderMap::new();
118+
headers.insert("Accept", HeaderValue::from_static("application/json"));
119+
120+
// build user agent
121+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
122+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
123+
Err(e) => {
124+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
125+
headers.insert(
126+
reqwest::header::USER_AGENT,
127+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
128+
)
129+
}
130+
};
131+
132+
// build auth
133+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
134+
headers.insert(
135+
"DD-API-KEY",
136+
HeaderValue::from_str(local_key.key.as_str())
137+
.expect("failed to parse DD-API-KEY header"),
138+
);
139+
};
140+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
141+
headers.insert(
142+
"DD-APPLICATION-KEY",
143+
HeaderValue::from_str(local_key.key.as_str())
144+
.expect("failed to parse DD-APPLICATION-KEY header"),
145+
);
146+
};
147+
148+
local_req_builder = local_req_builder.headers(headers);
149+
let local_req = local_req_builder.build()?;
150+
log::debug!("request content: {:?}", local_req.body());
151+
let local_resp = local_client.execute(local_req).await?;
152+
153+
let local_status = local_resp.status();
154+
let local_content = local_resp.text().await?;
155+
log::debug!("response content: {}", local_content);
156+
157+
if !local_status.is_client_error() && !local_status.is_server_error() {
158+
match serde_json::from_str::<crate::datadogV2::model::ServiceList>(&local_content) {
159+
Ok(e) => {
160+
return Ok(datadog::ResponseContent {
161+
status: local_status,
162+
content: local_content,
163+
entity: Some(e),
164+
})
165+
}
166+
Err(e) => return Err(datadog::Error::Serde(e)),
167+
};
168+
} else {
169+
let local_entity: Option<GetServiceListError> =
170+
serde_json::from_str(&local_content).ok();
171+
let local_error = datadog::ResponseContent {
172+
status: local_status,
173+
content: local_content,
174+
entity: local_entity,
175+
};
176+
Err(datadog::Error::ResponseError(local_error))
177+
}
178+
}
179+
}

src/datadogV2/api/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub mod api_action_connection;
66
pub mod api_actions_datastores;
77
pub mod api_agentless_scanning;
88
pub mod api_api_management;
9+
pub mod api_apm;
910
pub mod api_apm_retention_filters;
1011
pub mod api_app_builder;
1112
pub mod api_application_security;

src/datadogV2/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub use self::api::api_action_connection;
77
pub use self::api::api_actions_datastores;
88
pub use self::api::api_agentless_scanning;
99
pub use self::api::api_api_management;
10+
pub use self::api::api_apm;
1011
pub use self::api::api_apm_retention_filters;
1112
pub use self::api::api_app_builder;
1213
pub use self::api::api_application_security;

src/datadogV2/model/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,16 @@ pub mod model_retention_filter_update_data;
900900
pub use self::model_retention_filter_update_data::RetentionFilterUpdateData;
901901
pub mod model_retention_filter_update_attributes;
902902
pub use self::model_retention_filter_update_attributes::RetentionFilterUpdateAttributes;
903+
pub mod model_service_list;
904+
pub use self::model_service_list::ServiceList;
905+
pub mod model_service_list_data;
906+
pub use self::model_service_list_data::ServiceListData;
907+
pub mod model_service_list_data_attributes;
908+
pub use self::model_service_list_data_attributes::ServiceListDataAttributes;
909+
pub mod model_service_list_data_attributes_metadata_items;
910+
pub use self::model_service_list_data_attributes_metadata_items::ServiceListDataAttributesMetadataItems;
911+
pub mod model_service_list_data_type;
912+
pub use self::model_service_list_data_type::ServiceListDataType;
903913
pub mod model_delete_apps_request;
904914
pub use self::model_delete_apps_request::DeleteAppsRequest;
905915
pub mod model_delete_apps_request_data_items;

0 commit comments

Comments
 (0)