Skip to content

Commit db7a19a

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1920836f of spec repo
1 parent aac95d5 commit db7a19a

16 files changed

+849
-6
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-01-07 19:53:45.490384",
8-
"spec_repo_commit": "d63fa330"
7+
"regenerated": "2025-01-08 14:02:28.490914",
8+
"spec_repo_commit": "1920836f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-07 19:53:45.505099",
13-
"spec_repo_commit": "d63fa330"
12+
"regenerated": "2025-01-08 14:02:28.507147",
13+
"spec_repo_commit": "1920836f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,57 @@ components:
27322732
$ref: '#/components/schemas/AwsCURConfig'
27332733
type: array
27342734
type: object
2735+
AwsScanOptionsAttributes:
2736+
description: Attributes for the AWS scan options.
2737+
properties:
2738+
lambda:
2739+
description: Indicates if scanning of Lambda functions is enabled.
2740+
example: true
2741+
type: boolean
2742+
sensitive_data:
2743+
description: Indicates if scanning for sensitive data is enabled.
2744+
example: false
2745+
type: boolean
2746+
vuln_containers_os:
2747+
description: Indicates if scanning for vulnerabilities in containers is
2748+
enabled.
2749+
example: true
2750+
type: boolean
2751+
vuln_host_os:
2752+
description: Indicates if scanning for vulnerabilities in hosts is enabled.
2753+
example: true
2754+
type: boolean
2755+
type: object
2756+
AwsScanOptionsData:
2757+
description: Single AWS Scan Options entry.
2758+
properties:
2759+
attributes:
2760+
$ref: '#/components/schemas/AwsScanOptionsAttributes'
2761+
id:
2762+
description: The ID of the AWS account.
2763+
example: '184366314700'
2764+
type: string
2765+
type:
2766+
$ref: '#/components/schemas/AwsScanOptionsType'
2767+
type: object
2768+
AwsScanOptionsResponse:
2769+
description: Response object that includes a list of AWS scan options.
2770+
properties:
2771+
data:
2772+
description: A list of AWS scan options.
2773+
items:
2774+
$ref: '#/components/schemas/AwsScanOptionsData'
2775+
type: array
2776+
type: object
2777+
AwsScanOptionsType:
2778+
default: aws_scan_options
2779+
description: The type of the resource. The value should always be `aws_scan_options`.
2780+
enum:
2781+
- aws_scan_options
2782+
example: aws_scan_options
2783+
type: string
2784+
x-enum-varnames:
2785+
- AWS_SCAN_OPTIONS
27352786
AzureUCConfig:
27362787
description: Azure config.
27372788
properties:
@@ -30222,6 +30273,24 @@ info:
3022230273
version: '1.0'
3022330274
openapi: 3.0.0
3022430275
paths:
30276+
/api/v2/agentless_scanning/accounts/aws:
30277+
get:
30278+
description: Fetches the scan options configured for AWS accounts.
30279+
operationId: ListAwsScanOptions
30280+
responses:
30281+
'200':
30282+
content:
30283+
application/json:
30284+
schema:
30285+
$ref: '#/components/schemas/AwsScanOptionsResponse'
30286+
description: OK
30287+
'403':
30288+
$ref: '#/components/responses/NotAuthorizedResponse'
30289+
'429':
30290+
$ref: '#/components/responses/TooManyRequestsResponse'
30291+
summary: Get AWS Scan Options
30292+
tags:
30293+
- Agentless Scanning
3022530294
/api/v2/api_keys:
3022630295
get:
3022730296
description: List all API keys available for your account.
@@ -48131,6 +48200,11 @@ tags:
4813148200
externalDocs:
4813248201
url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection
4813348202
name: AWS Logs Integration
48203+
- description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin
48204+
your hosts, running containers, and serverless functions\u2014all without\nrequiring
48205+
teams to install Agents on every host or where Agents cannot be installed.\nGo
48206+
to https://www.datadoghq.com/blog/agentless-scanning/ to learn more"
48207+
name: Agentless Scanning
4813448208
- description: Datadog App Builder provides a low-code solution to rapidly develop
4813548209
and integrate secure, customized applications into your monitoring stack that
4813648210
are built to accelerate remediation at scale. These API endpoints allow you to
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Get AWS Scan Options returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_agentless_scanning::AgentlessScanningAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = AgentlessScanningAPI::with_config(configuration);
9+
let resp = api.list_aws_scan_options().await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
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+
/// ListAwsScanOptionsError is a struct for typed errors of method [`AgentlessScanningAPI::list_aws_scan_options`]
9+
#[derive(Debug, Clone, Serialize, Deserialize)]
10+
#[serde(untagged)]
11+
pub enum ListAwsScanOptionsError {
12+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
13+
UnknownValue(serde_json::Value),
14+
}
15+
16+
/// Datadog Agentless Scanning provides visibility into risks and vulnerabilities
17+
/// within your hosts, running containers, and serverless functions—all without
18+
/// requiring teams to install Agents on every host or where Agents cannot be installed.
19+
/// Go to <https://www.datadoghq.com/blog/agentless-scanning/> to learn more
20+
#[derive(Debug, Clone)]
21+
pub struct AgentlessScanningAPI {
22+
config: datadog::Configuration,
23+
client: reqwest_middleware::ClientWithMiddleware,
24+
}
25+
26+
impl Default for AgentlessScanningAPI {
27+
fn default() -> Self {
28+
Self::with_config(datadog::Configuration::default())
29+
}
30+
}
31+
32+
impl AgentlessScanningAPI {
33+
pub fn new() -> Self {
34+
Self::default()
35+
}
36+
pub fn with_config(config: datadog::Configuration) -> Self {
37+
let mut reqwest_client_builder = reqwest::Client::builder();
38+
39+
if let Some(proxy_url) = &config.proxy_url {
40+
let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL");
41+
reqwest_client_builder = reqwest_client_builder.proxy(proxy);
42+
}
43+
44+
let mut middleware_client_builder =
45+
reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap());
46+
47+
if config.enable_retry {
48+
struct RetryableStatus;
49+
impl reqwest_retry::RetryableStrategy for RetryableStatus {
50+
fn handle(
51+
&self,
52+
res: &Result<reqwest::Response, reqwest_middleware::Error>,
53+
) -> Option<reqwest_retry::Retryable> {
54+
match res {
55+
Ok(success) => reqwest_retry::default_on_request_success(success),
56+
Err(_) => None,
57+
}
58+
}
59+
}
60+
let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder()
61+
.build_with_max_retries(config.max_retries);
62+
63+
let retry_middleware =
64+
reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy(
65+
backoff_policy,
66+
RetryableStatus,
67+
);
68+
69+
middleware_client_builder = middleware_client_builder.with(retry_middleware);
70+
}
71+
72+
let client = middleware_client_builder.build();
73+
74+
Self { config, client }
75+
}
76+
77+
pub fn with_client_and_config(
78+
config: datadog::Configuration,
79+
client: reqwest_middleware::ClientWithMiddleware,
80+
) -> Self {
81+
Self { config, client }
82+
}
83+
84+
/// Fetches the scan options configured for AWS accounts.
85+
pub async fn list_aws_scan_options(
86+
&self,
87+
) -> Result<
88+
crate::datadogV2::model::AwsScanOptionsResponse,
89+
datadog::Error<ListAwsScanOptionsError>,
90+
> {
91+
match self.list_aws_scan_options_with_http_info().await {
92+
Ok(response_content) => {
93+
if let Some(e) = response_content.entity {
94+
Ok(e)
95+
} else {
96+
Err(datadog::Error::Serde(serde::de::Error::custom(
97+
"response content was None",
98+
)))
99+
}
100+
}
101+
Err(err) => Err(err),
102+
}
103+
}
104+
105+
/// Fetches the scan options configured for AWS accounts.
106+
pub async fn list_aws_scan_options_with_http_info(
107+
&self,
108+
) -> Result<
109+
datadog::ResponseContent<crate::datadogV2::model::AwsScanOptionsResponse>,
110+
datadog::Error<ListAwsScanOptionsError>,
111+
> {
112+
let local_configuration = &self.config;
113+
let operation_id = "v2.list_aws_scan_options";
114+
115+
let local_client = &self.client;
116+
117+
let local_uri_str = format!(
118+
"{}/api/v2/agentless_scanning/accounts/aws",
119+
local_configuration.get_operation_host(operation_id)
120+
);
121+
let mut local_req_builder =
122+
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
123+
124+
// build headers
125+
let mut headers = HeaderMap::new();
126+
headers.insert("Accept", HeaderValue::from_static("application/json"));
127+
128+
// build user agent
129+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
130+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
131+
Err(e) => {
132+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
133+
headers.insert(
134+
reqwest::header::USER_AGENT,
135+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
136+
)
137+
}
138+
};
139+
140+
// build auth
141+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
142+
headers.insert(
143+
"DD-API-KEY",
144+
HeaderValue::from_str(local_key.key.as_str())
145+
.expect("failed to parse DD-API-KEY header"),
146+
);
147+
};
148+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
149+
headers.insert(
150+
"DD-APPLICATION-KEY",
151+
HeaderValue::from_str(local_key.key.as_str())
152+
.expect("failed to parse DD-APPLICATION-KEY header"),
153+
);
154+
};
155+
156+
local_req_builder = local_req_builder.headers(headers);
157+
let local_req = local_req_builder.build()?;
158+
log::debug!("request content: {:?}", local_req.body());
159+
let local_resp = local_client.execute(local_req).await?;
160+
161+
let local_status = local_resp.status();
162+
let local_content = local_resp.text().await?;
163+
log::debug!("response content: {}", local_content);
164+
165+
if !local_status.is_client_error() && !local_status.is_server_error() {
166+
match serde_json::from_str::<crate::datadogV2::model::AwsScanOptionsResponse>(
167+
&local_content,
168+
) {
169+
Ok(e) => {
170+
return Ok(datadog::ResponseContent {
171+
status: local_status,
172+
content: local_content,
173+
entity: Some(e),
174+
})
175+
}
176+
Err(e) => return Err(datadog::Error::Serde(e)),
177+
};
178+
} else {
179+
let local_entity: Option<ListAwsScanOptionsError> =
180+
serde_json::from_str(&local_content).ok();
181+
let local_error = datadog::ResponseContent {
182+
status: local_status,
183+
content: local_content,
184+
entity: local_entity,
185+
};
186+
Err(datadog::Error::ResponseError(local_error))
187+
}
188+
}
189+
}

src/datadogV2/api/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// This product includes software developed at Datadog (https://www.datadoghq.com/).
33
// Copyright 2019-Present Datadog, Inc.
44

5+
pub mod api_agentless_scanning;
56
pub mod api_api_management;
67
pub mod api_apm_retention_filters;
78
pub mod api_apps;

src/datadogV2/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Copyright 2019-Present Datadog, Inc.
44

55
pub mod api;
6+
pub use self::api::api_agentless_scanning;
67
pub use self::api::api_api_management;
78
pub use self::api::api_apm_retention_filters;
89
pub use self::api::api_apps;

src/datadogV2/model/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
// This product includes software developed at Datadog (https://www.datadoghq.com/).
33
// Copyright 2019-Present Datadog, Inc.
44

5+
pub mod model_aws_scan_options_response;
6+
pub use self::model_aws_scan_options_response::AwsScanOptionsResponse;
7+
pub mod model_aws_scan_options_data;
8+
pub use self::model_aws_scan_options_data::AwsScanOptionsData;
9+
pub mod model_aws_scan_options_attributes;
10+
pub use self::model_aws_scan_options_attributes::AwsScanOptionsAttributes;
11+
pub mod model_aws_scan_options_type;
12+
pub use self::model_aws_scan_options_type::AwsScanOptionsType;
13+
pub mod model_api_error_response;
14+
pub use self::model_api_error_response::APIErrorResponse;
515
pub mod model_api_keys_sort;
616
pub use self::model_api_keys_sort::APIKeysSort;
717
pub mod model_api_keys_response;
@@ -58,8 +68,6 @@ pub mod model_api_keys_response_meta;
5868
pub use self::model_api_keys_response_meta::APIKeysResponseMeta;
5969
pub mod model_api_keys_response_meta_page;
6070
pub use self::model_api_keys_response_meta_page::APIKeysResponseMetaPage;
61-
pub mod model_api_error_response;
62-
pub use self::model_api_error_response::APIErrorResponse;
6371
pub mod model_api_key_create_request;
6472
pub use self::model_api_key_create_request::APIKeyCreateRequest;
6573
pub mod model_api_key_create_data;

0 commit comments

Comments
 (0)