Skip to content

Commit 005375e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add public v2 OpenAPI operations for governance controls (#1779)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 76a67ab commit 005375e

23 files changed

Lines changed: 3356 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 717 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get a governance control returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_governance_controls::GovernanceControlsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.GetGovernanceControl", true);
9+
let api = GovernanceControlsAPI::with_config(configuration);
10+
let resp = api
11+
.get_governance_control("detection_type".to_string())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// List governance controls returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_governance_controls::GovernanceControlsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.ListGovernanceControls", true);
9+
let api = GovernanceControlsAPI::with_config(configuration);
10+
let resp = api.list_governance_controls().await;
11+
if let Ok(value) = resp {
12+
println!("{:#?}", value);
13+
} else {
14+
println!("{:#?}", resp.unwrap_err());
15+
}
16+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Update a governance control returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_governance_controls::GovernanceControlsAPI;
4+
use datadog_api_client::datadogV2::model::GovernanceControlResourceType;
5+
use datadog_api_client::datadogV2::model::GovernanceControlUpdateAttributes;
6+
use datadog_api_client::datadogV2::model::GovernanceControlUpdateData;
7+
use datadog_api_client::datadogV2::model::GovernanceControlUpdateRequest;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = GovernanceControlUpdateRequest::new(
12+
GovernanceControlUpdateData::new(GovernanceControlResourceType::GOVERNANCE_CONTROL)
13+
.attributes(
14+
GovernanceControlUpdateAttributes::new()
15+
.detection_frequency("daily".to_string())
16+
.mitigation_type("revoke_api_key".to_string())
17+
.name("Unused API Keys".to_string())
18+
.notification_frequency("daily".to_string())
19+
.notification_type("slack".to_string()),
20+
)
21+
.id("0d4e6f8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a".to_string()),
22+
);
23+
let mut configuration = datadog::Configuration::new();
24+
configuration.set_unstable_operation_enabled("v2.UpdateGovernanceControl", true);
25+
let api = GovernanceControlsAPI::with_config(configuration);
26+
let resp = api
27+
.update_governance_control("detection_type".to_string(), body)
28+
.await;
29+
if let Ok(value) = resp {
30+
println!("{:#?}", value);
31+
} else {
32+
println!("{:#?}", resp.unwrap_err());
33+
}
34+
}

src/datadog/configuration.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ impl Default for Configuration {
571571
("v2.upsert_and_publish_form_version".to_owned(), false),
572572
("v2.upsert_form_version".to_owned(), false),
573573
("v2.update_org_saml_configurations".to_owned(), false),
574+
("v2.get_governance_control".to_owned(), false),
575+
("v2.list_governance_controls".to_owned(), false),
576+
("v2.update_governance_control".to_owned(), false),
574577
("v2.list_governance_insights".to_owned(), false),
575578
("v2.create_hamr_org_connection".to_owned(), false),
576579
("v2.get_hamr_org_connection".to_owned(), false),

0 commit comments

Comments
 (0)