Skip to content

Commit bdff2b6

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 898cd727 of spec repo
1 parent 4830082 commit bdff2b6

12 files changed

+1703
-941
lines changed

Diff for: .apigentools-info

+4-4
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-13 18:28:01.987122",
8-
"spec_repo_commit": "3517c947"
7+
"regenerated": "2025-01-14 17:10:31.661898",
8+
"spec_repo_commit": "898cd727"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-13 18:28:02.002232",
13-
"spec_repo_commit": "3517c947"
12+
"regenerated": "2025-01-14 17:10:31.675973",
13+
"spec_repo_commit": "898cd727"
1414
}
1515
}
1616
}

Diff for: .generator/schemas/v2/openapi.yaml

+122
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ components:
213213
required: true
214214
schema:
215215
type: string
216+
CustomFrameworkOrgID:
217+
description: The ID of the organization.
218+
in: path
219+
name: org_id
220+
required: true
221+
schema:
222+
type: string
216223
EntityID:
217224
description: UUID or Entity Ref.
218225
in: path
@@ -7145,6 +7152,44 @@ components:
71457152
type: string
71467153
x-enum-varnames:
71477154
- APPDEFINITIONS
7155+
CreateCustomFrameworkRequest:
7156+
description: Create a custom framework.
7157+
properties:
7158+
description:
7159+
description: Framework Description
7160+
type: string
7161+
handle:
7162+
description: Framework Handle
7163+
example: ''
7164+
type: string
7165+
icon_url:
7166+
description: Framework Icon URL
7167+
type: string
7168+
id:
7169+
description: Custom Framework ID
7170+
type: string
7171+
name:
7172+
description: Framework Name
7173+
example: ''
7174+
type: string
7175+
requirements:
7176+
description: Framework Requirements
7177+
items:
7178+
$ref: '#/components/schemas/FrameworkRequirement'
7179+
type: array
7180+
user_email:
7181+
description: Framework Creator
7182+
type: string
7183+
version:
7184+
description: Framework Version
7185+
example: ''
7186+
type: string
7187+
required:
7188+
- handle
7189+
- version
7190+
- name
7191+
- requirements
7192+
type: object
71487193
CreateDataDeletionRequestBody:
71497194
description: Object needed to create a data deletion request.
71507195
properties:
@@ -11936,6 +11981,40 @@ components:
1193611981
order:
1193711982
$ref: '#/components/schemas/QuerySortOrder'
1193811983
type: object
11984+
FrameworkControl:
11985+
description: Framework Control.
11986+
properties:
11987+
name:
11988+
description: Control Name.
11989+
example: ''
11990+
type: string
11991+
rule_ids:
11992+
description: Rule IDs.
11993+
example:
11994+
- ''
11995+
items:
11996+
type: string
11997+
type: array
11998+
required:
11999+
- name
12000+
- rule_ids
12001+
type: object
12002+
FrameworkRequirement:
12003+
description: Framework Requirement.
12004+
properties:
12005+
controls:
12006+
description: Requirement Controls.
12007+
items:
12008+
$ref: '#/components/schemas/FrameworkControl'
12009+
type: array
12010+
name:
12011+
description: Requirement Name.
12012+
example: ''
12013+
type: string
12014+
required:
12015+
- name
12016+
- controls
12017+
type: object
1193912018
FullAPIKey:
1194012019
description: Datadog API key.
1194112020
properties:
@@ -30263,6 +30342,12 @@ components:
3026330342
scheme: bearer
3026430343
type: http
3026530344
x-env-name: DD_BEARER_TOKEN
30345+
userAuth:
30346+
description: Your Datadog User ID.
30347+
in: header
30348+
name: X-Datadog-UserId
30349+
type: http
30350+
x-env-name: X_Datadog_UserId
3026630351
info:
3026730352
contact:
3026830353
@@ -40135,6 +40220,43 @@ paths:
4013540220
operator: OR
4013640221
permissions:
4013740222
- org_management
40223+
/api/v2/orgs/{org_id}/cloud_security_management/custom_frameworks:
40224+
post:
40225+
description: Create a custom framework.
40226+
operationId: CreateCustomFramework
40227+
parameters:
40228+
- $ref: '#/components/parameters/CustomFrameworkOrgID'
40229+
requestBody:
40230+
content:
40231+
application/json:
40232+
schema:
40233+
$ref: '#/components/schemas/CreateCustomFrameworkRequest'
40234+
required: true
40235+
responses:
40236+
'200':
40237+
description: OK
40238+
'400':
40239+
$ref: '#/components/responses/BadRequestResponse'
40240+
'429':
40241+
$ref: '#/components/responses/TooManyRequestsResponse'
40242+
'500':
40243+
$ref: '#/components/responses/BadRequestResponse'
40244+
security:
40245+
- apiKeyAuth: []
40246+
appKeyAuth: []
40247+
userAuth: []
40248+
- AuthZ:
40249+
- security_monitoring_rules_read
40250+
- security_monitoring_rules_write
40251+
summary: Create a custom framework
40252+
tags:
40253+
- Security Monitoring
40254+
x-codegen-request-body-name: body
40255+
x-permission:
40256+
operator: AND
40257+
permissions:
40258+
- security_monitoring_rules_read
40259+
- security_monitoring_rules_write
4013840260
/api/v2/permissions:
4013940261
get:
4014040262
description: Returns a list of all permissions, including name, description,

Diff for: LICENSE-3rdparty.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ log,https://github.com/rust-lang/log,MIT OR Apache-2.0,The Rust Project Develope
7777
memchr,https://github.com/BurntSushi/memchr,Unlicense OR MIT,"Andrew Gallant <[email protected]>, bluss"
7878
mime,https://github.com/hyperium/mime,MIT OR Apache-2.0,Sean McArthur <[email protected]>
7979
mime_guess,https://github.com/abonander/mime_guess,MIT,Austin Bonander <[email protected]>
80-
miniz_oxide,https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide,MIT OR Zlib OR Apache-2.0,"Frommi <[email protected]>, oyvindln <[email protected]>"
80+
miniz_oxide,https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide,MIT OR Zlib OR Apache-2.0,"Frommi <[email protected]>, oyvindln <[email protected]>, Rich Geldreich [email protected]"
8181
mio,https://github.com/tokio-rs/mio,MIT,"Carl Lerche <[email protected]>, Thomas de Zeeuw <[email protected]>, Tokio Contributors <[email protected]>"
8282
native-tls,https://github.com/sfackler/rust-native-tls,MIT OR Apache-2.0,Steven Fackler <[email protected]>
8383
num-conv,https://github.com/jhpratt/num-conv,MIT OR Apache-2.0,Jacob Pratt <[email protected]>
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Create a custom framework returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
use datadog_api_client::datadogV2::model::CreateCustomFrameworkRequest;
5+
use datadog_api_client::datadogV2::model::FrameworkControl;
6+
use datadog_api_client::datadogV2::model::FrameworkRequirement;
7+
8+
#[tokio::main]
9+
async fn main() {
10+
let body = CreateCustomFrameworkRequest::new(
11+
"".to_string(),
12+
"".to_string(),
13+
vec![FrameworkRequirement::new(
14+
vec![FrameworkControl::new("".to_string(), vec!["".to_string()])],
15+
"".to_string(),
16+
)],
17+
"".to_string(),
18+
);
19+
let configuration = datadog::Configuration::new();
20+
let api = SecurityMonitoringAPI::with_config(configuration);
21+
let resp = api
22+
.create_custom_framework("org_id".to_string(), body)
23+
.await;
24+
if let Ok(value) = resp {
25+
println!("{:#?}", value);
26+
} else {
27+
println!("{:#?}", resp.unwrap_err());
28+
}
29+
}

Diff for: src/datadogV2/api/api_security_monitoring.rs

+147
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,14 @@ pub enum ConvertSecurityMonitoringRuleFromJSONToTerraformError {
714714
UnknownValue(serde_json::Value),
715715
}
716716

717+
/// CreateCustomFrameworkError is a struct for typed errors of method [`SecurityMonitoringAPI::create_custom_framework`]
718+
#[derive(Debug, Clone, Serialize, Deserialize)]
719+
#[serde(untagged)]
720+
pub enum CreateCustomFrameworkError {
721+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
722+
UnknownValue(serde_json::Value),
723+
}
724+
717725
/// CreateSecurityFilterError is a struct for typed errors of method [`SecurityMonitoringAPI::create_security_filter`]
718726
#[derive(Debug, Clone, Serialize, Deserialize)]
719727
#[serde(untagged)]
@@ -1557,6 +1565,145 @@ impl SecurityMonitoringAPI {
15571565
}
15581566
}
15591567

1568+
/// Create a custom framework.
1569+
pub async fn create_custom_framework(
1570+
&self,
1571+
org_id: String,
1572+
body: crate::datadogV2::model::CreateCustomFrameworkRequest,
1573+
) -> Result<(), datadog::Error<CreateCustomFrameworkError>> {
1574+
match self
1575+
.create_custom_framework_with_http_info(org_id, body)
1576+
.await
1577+
{
1578+
Ok(_) => Ok(()),
1579+
Err(err) => Err(err),
1580+
}
1581+
}
1582+
1583+
/// Create a custom framework.
1584+
pub async fn create_custom_framework_with_http_info(
1585+
&self,
1586+
org_id: String,
1587+
body: crate::datadogV2::model::CreateCustomFrameworkRequest,
1588+
) -> Result<datadog::ResponseContent<()>, datadog::Error<CreateCustomFrameworkError>> {
1589+
let local_configuration = &self.config;
1590+
let operation_id = "v2.create_custom_framework";
1591+
1592+
let local_client = &self.client;
1593+
1594+
let local_uri_str = format!(
1595+
"{}/api/v2/orgs/{org_id}/cloud_security_management/custom_frameworks",
1596+
local_configuration.get_operation_host(operation_id),
1597+
org_id = datadog::urlencode(org_id)
1598+
);
1599+
let mut local_req_builder =
1600+
local_client.request(reqwest::Method::POST, local_uri_str.as_str());
1601+
1602+
// build headers
1603+
let mut headers = HeaderMap::new();
1604+
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
1605+
headers.insert("Accept", HeaderValue::from_static("*/*"));
1606+
1607+
// build user agent
1608+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1609+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1610+
Err(e) => {
1611+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
1612+
headers.insert(
1613+
reqwest::header::USER_AGENT,
1614+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1615+
)
1616+
}
1617+
};
1618+
1619+
// build auth
1620+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1621+
headers.insert(
1622+
"DD-API-KEY",
1623+
HeaderValue::from_str(local_key.key.as_str())
1624+
.expect("failed to parse DD-API-KEY header"),
1625+
);
1626+
};
1627+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1628+
headers.insert(
1629+
"DD-APPLICATION-KEY",
1630+
HeaderValue::from_str(local_key.key.as_str())
1631+
.expect("failed to parse DD-APPLICATION-KEY header"),
1632+
);
1633+
};
1634+
1635+
// build body parameters
1636+
let output = Vec::new();
1637+
let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
1638+
if body.serialize(&mut ser).is_ok() {
1639+
if let Some(content_encoding) = headers.get("Content-Encoding") {
1640+
match content_encoding.to_str().unwrap_or_default() {
1641+
"gzip" => {
1642+
let mut enc = GzEncoder::new(Vec::new(), Compression::default());
1643+
let _ = enc.write_all(ser.into_inner().as_slice());
1644+
match enc.finish() {
1645+
Ok(buf) => {
1646+
local_req_builder = local_req_builder.body(buf);
1647+
}
1648+
Err(e) => return Err(datadog::Error::Io(e)),
1649+
}
1650+
}
1651+
"deflate" => {
1652+
let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
1653+
let _ = enc.write_all(ser.into_inner().as_slice());
1654+
match enc.finish() {
1655+
Ok(buf) => {
1656+
local_req_builder = local_req_builder.body(buf);
1657+
}
1658+
Err(e) => return Err(datadog::Error::Io(e)),
1659+
}
1660+
}
1661+
"zstd1" => {
1662+
let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1663+
let _ = enc.write_all(ser.into_inner().as_slice());
1664+
match enc.finish() {
1665+
Ok(buf) => {
1666+
local_req_builder = local_req_builder.body(buf);
1667+
}
1668+
Err(e) => return Err(datadog::Error::Io(e)),
1669+
}
1670+
}
1671+
_ => {
1672+
local_req_builder = local_req_builder.body(ser.into_inner());
1673+
}
1674+
}
1675+
} else {
1676+
local_req_builder = local_req_builder.body(ser.into_inner());
1677+
}
1678+
}
1679+
1680+
local_req_builder = local_req_builder.headers(headers);
1681+
let local_req = local_req_builder.build()?;
1682+
log::debug!("request content: {:?}", local_req.body());
1683+
let local_resp = local_client.execute(local_req).await?;
1684+
1685+
let local_status = local_resp.status();
1686+
let local_content = local_resp.text().await?;
1687+
log::debug!("response content: {}", local_content);
1688+
1689+
if !local_status.is_client_error() && !local_status.is_server_error() {
1690+
Ok(datadog::ResponseContent {
1691+
status: local_status,
1692+
content: local_content,
1693+
entity: None,
1694+
})
1695+
} else {
1696+
let local_entity: Option<CreateCustomFrameworkError> =
1697+
serde_json::from_str(&local_content).ok();
1698+
let local_error = datadog::ResponseContent {
1699+
status: local_status,
1700+
content: local_content,
1701+
entity: local_entity,
1702+
};
1703+
Err(datadog::Error::ResponseError(local_error))
1704+
}
1705+
}
1706+
15601707
/// Create a security filter.
15611708
///
15621709
/// See the [security filter guide](<https://docs.datadoghq.com/security_platform/guide/how-to-setup-security-filters-using-security-monitoring-api/>)

Diff for: src/datadogV2/model/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,12 @@ pub mod model_org_config_write;
23322332
pub use self::model_org_config_write::OrgConfigWrite;
23332333
pub mod model_org_config_write_attributes;
23342334
pub use self::model_org_config_write_attributes::OrgConfigWriteAttributes;
2335+
pub mod model_create_custom_framework_request;
2336+
pub use self::model_create_custom_framework_request::CreateCustomFrameworkRequest;
2337+
pub mod model_framework_requirement;
2338+
pub use self::model_framework_requirement::FrameworkRequirement;
2339+
pub mod model_framework_control;
2340+
pub use self::model_framework_control::FrameworkControl;
23352341
pub mod model_permissions_response;
23362342
pub use self::model_permissions_response::PermissionsResponse;
23372343
pub mod model_permission;

0 commit comments

Comments
 (0)