Skip to content

Commit 32f9ac9

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fab55767 of spec repo
1 parent bece5cf commit 32f9ac9

12 files changed

+4313
-3618
lines changed

.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-14 15:59:11.672589",
8-
"spec_repo_commit": "0457044b"
7+
"regenerated": "2025-01-14 18:26:37.411612",
8+
"spec_repo_commit": "fab55767"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-14 15:59:11.688991",
13-
"spec_repo_commit": "0457044b"
12+
"regenerated": "2025-01-14 18:26:37.426515",
13+
"spec_repo_commit": "fab55767"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+100
Original file line numberDiff line numberDiff line change
@@ -7145,6 +7145,38 @@ components:
71457145
type: string
71467146
x-enum-varnames:
71477147
- APPDEFINITIONS
7148+
CreateCustomFrameworkRequest:
7149+
description: Create a custom framework.
7150+
properties:
7151+
description:
7152+
description: Framework Description
7153+
type: string
7154+
handle:
7155+
description: Framework Handle
7156+
example: ''
7157+
type: string
7158+
icon_url:
7159+
description: Framework Icon URL
7160+
type: string
7161+
name:
7162+
description: Framework Name
7163+
example: ''
7164+
type: string
7165+
requirements:
7166+
description: Framework Requirements
7167+
items:
7168+
$ref: '#/components/schemas/FrameworkRequirement'
7169+
type: array
7170+
version:
7171+
description: Framework Version
7172+
example: ''
7173+
type: string
7174+
required:
7175+
- handle
7176+
- version
7177+
- name
7178+
- requirements
7179+
type: object
71487180
CreateDataDeletionRequestBody:
71497181
description: Object needed to create a data deletion request.
71507182
properties:
@@ -11936,6 +11968,40 @@ components:
1193611968
order:
1193711969
$ref: '#/components/schemas/QuerySortOrder'
1193811970
type: object
11971+
FrameworkControl:
11972+
description: Framework Control.
11973+
properties:
11974+
name:
11975+
description: Control Name.
11976+
example: ''
11977+
type: string
11978+
rule_ids:
11979+
description: Rule IDs.
11980+
example:
11981+
- ''
11982+
items:
11983+
type: string
11984+
type: array
11985+
required:
11986+
- name
11987+
- rule_ids
11988+
type: object
11989+
FrameworkRequirement:
11990+
description: Framework Requirement.
11991+
properties:
11992+
controls:
11993+
description: Requirement Controls.
11994+
items:
11995+
$ref: '#/components/schemas/FrameworkControl'
11996+
type: array
11997+
name:
11998+
description: Requirement Name.
11999+
example: ''
12000+
type: string
12001+
required:
12002+
- name
12003+
- controls
12004+
type: object
1193912005
FullAPIKey:
1194012006
description: Datadog API key.
1194112007
properties:
@@ -33028,6 +33094,40 @@ paths:
3302833094
operator: OR
3302933095
permissions:
3303033096
- ci_visibility_read
33097+
/api/v2/cloud_security_management/custom_frameworks:
33098+
post:
33099+
description: Create a custom framework.
33100+
operationId: CreateCustomFramework
33101+
requestBody:
33102+
content:
33103+
application/json:
33104+
schema:
33105+
$ref: '#/components/schemas/CreateCustomFrameworkRequest'
33106+
required: true
33107+
responses:
33108+
'200':
33109+
description: OK
33110+
'400':
33111+
$ref: '#/components/responses/BadRequestResponse'
33112+
'429':
33113+
$ref: '#/components/responses/TooManyRequestsResponse'
33114+
'500':
33115+
$ref: '#/components/responses/BadRequestResponse'
33116+
security:
33117+
- apiKeyAuth: []
33118+
appKeyAuth: []
33119+
- AuthZ:
33120+
- security_monitoring_rules_read
33121+
- security_monitoring_rules_write
33122+
summary: Create a custom framework
33123+
tags:
33124+
- Security Monitoring
33125+
x-codegen-request-body-name: body
33126+
x-permission:
33127+
operator: AND
33128+
permissions:
33129+
- security_monitoring_rules_read
33130+
- security_monitoring_rules_write
3303133131
/api/v2/container_images:
3303233132
get:
3303333133
description: Get all Container Images for your organization.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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.create_custom_framework(body).await;
22+
if let Ok(value) = resp {
23+
println!("{:#?}", value);
24+
} else {
25+
println!("{:#?}", resp.unwrap_err());
26+
}
27+
}

src/datadog/configuration.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ impl Default for Configuration {
142142
("v2.get_app".to_owned(), false),
143143
("v2.list_apps".to_owned(), false),
144144
("v2.update_app".to_owned(), false),
145+
("v2.cancel_historical_job".to_owned(), false),
146+
("v2.convert_job_result_to_signal".to_owned(), false),
147+
("v2.delete_historical_job".to_owned(), false),
148+
("v2.get_finding".to_owned(), false),
149+
("v2.get_historical_job".to_owned(), false),
150+
("v2.list_findings".to_owned(), false),
151+
("v2.list_historical_jobs".to_owned(), false),
152+
("v2.list_vulnerabilities".to_owned(), false),
153+
("v2.list_vulnerable_assets".to_owned(), false),
154+
("v2.mute_findings".to_owned(), false),
155+
("v2.run_historical_job".to_owned(), false),
145156
("v2.get_active_billing_dimensions".to_owned(), false),
146157
("v2.get_billing_dimension_mapping".to_owned(), false),
147158
("v2.get_monthly_cost_attribution".to_owned(), false),
@@ -181,17 +192,6 @@ impl Default for Configuration {
181192
("v2.list_aws_namespaces".to_owned(), false),
182193
("v2.update_aws_account".to_owned(), false),
183194
("v2.list_aws_logs_services".to_owned(), false),
184-
("v2.cancel_historical_job".to_owned(), false),
185-
("v2.convert_job_result_to_signal".to_owned(), false),
186-
("v2.delete_historical_job".to_owned(), false),
187-
("v2.get_finding".to_owned(), false),
188-
("v2.get_historical_job".to_owned(), false),
189-
("v2.list_findings".to_owned(), false),
190-
("v2.list_historical_jobs".to_owned(), false),
191-
("v2.list_vulnerabilities".to_owned(), false),
192-
("v2.list_vulnerable_assets".to_owned(), false),
193-
("v2.mute_findings".to_owned(), false),
194-
("v2.run_historical_job".to_owned(), false),
195195
("v2.create_scorecard_outcomes_batch".to_owned(), false),
196196
("v2.create_scorecard_rule".to_owned(), false),
197197
("v2.delete_scorecard_rule".to_owned(), false),

src/datadogV2/api/api_security_monitoring.rs

+141
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,139 @@ impl SecurityMonitoringAPI {
15571565
}
15581566
}
15591567

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

src/datadogV2/model/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,12 @@ pub mod model_ci_app_test_event_type_name;
870870
pub use self::model_ci_app_test_event_type_name::CIAppTestEventTypeName;
871871
pub mod model_ci_app_test_events_request;
872872
pub use self::model_ci_app_test_events_request::CIAppTestEventsRequest;
873+
pub mod model_create_custom_framework_request;
874+
pub use self::model_create_custom_framework_request::CreateCustomFrameworkRequest;
875+
pub mod model_framework_requirement;
876+
pub use self::model_framework_requirement::FrameworkRequirement;
877+
pub mod model_framework_control;
878+
pub use self::model_framework_control::FrameworkControl;
873879
pub mod model_container_images_response;
874880
pub use self::model_container_images_response::ContainerImagesResponse;
875881
pub mod model_container_image;

0 commit comments

Comments
 (0)