Skip to content

Commit 81a2ddc

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3324318 of spec repo
1 parent b8c79ce commit 81a2ddc

File tree

43 files changed

+4581
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4581
-82
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 480 additions & 9 deletions
Large diffs are not rendered by default.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Create an On-Call notification rule for a user returns "Created" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
4+
use datadog_api_client::datadogV2::model::CreateOnCallNotificationRuleRequest;
5+
use datadog_api_client::datadogV2::model::CreateOnCallNotificationRuleRequestData;
6+
use datadog_api_client::datadogV2::model::NotificationChannelType;
7+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleCategory;
8+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationship;
9+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationshipData;
10+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRelationships;
11+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRequestAttributes;
12+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleType;
13+
14+
#[tokio::main]
15+
async fn main() {
16+
// there is a valid "user" in the system
17+
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
18+
19+
// there is a valid "oncall_email_notification_channel" in the system
20+
let oncall_email_notification_channel_data_id =
21+
std::env::var("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID").unwrap();
22+
let body = CreateOnCallNotificationRuleRequest::new(
23+
CreateOnCallNotificationRuleRequestData::new(
24+
OnCallNotificationRuleType::NOTIFICATION_RULES,
25+
)
26+
.attributes(
27+
OnCallNotificationRuleRequestAttributes::new()
28+
.category(OnCallNotificationRuleCategory::HIGH_URGENCY)
29+
.delay_minutes(0),
30+
)
31+
.relationships(
32+
OnCallNotificationRuleRelationships::new().channel(
33+
OnCallNotificationRuleChannelRelationship::new(
34+
OnCallNotificationRuleChannelRelationshipData::new()
35+
.id(oncall_email_notification_channel_data_id.clone())
36+
.type_(NotificationChannelType::NOTIFICATION_CHANNELS),
37+
),
38+
),
39+
),
40+
);
41+
let configuration = datadog::Configuration::new();
42+
let api = OnCallAPI::with_config(configuration);
43+
let resp = api
44+
.create_user_notification_rule(user_data_id.clone(), body)
45+
.await;
46+
if let Ok(value) = resp {
47+
println!("{:#?}", value);
48+
} else {
49+
println!("{:#?}", resp.unwrap_err());
50+
}
51+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Delete an On-Call notification rule for a user returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "user" in the system
8+
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
9+
10+
// there is a valid "oncall_email_notification_rule" in the system
11+
let oncall_email_notification_rule_data_id =
12+
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();
13+
let configuration = datadog::Configuration::new();
14+
let api = OnCallAPI::with_config(configuration);
15+
let resp = api
16+
.delete_user_notification_rule(
17+
user_data_id.clone(),
18+
oncall_email_notification_rule_data_id.clone(),
19+
)
20+
.await;
21+
if let Ok(value) = resp {
22+
println!("{:#?}", value);
23+
} else {
24+
println!("{:#?}", resp.unwrap_err());
25+
}
26+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Get an On-Call notification rule for a user returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::GetUserNotificationRuleOptionalParams;
4+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "user" in the system
9+
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
10+
11+
// there is a valid "oncall_email_notification_rule" in the system
12+
let oncall_email_notification_rule_data_id =
13+
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();
14+
let configuration = datadog::Configuration::new();
15+
let api = OnCallAPI::with_config(configuration);
16+
let resp = api
17+
.get_user_notification_rule(
18+
user_data_id.clone(),
19+
oncall_email_notification_rule_data_id.clone(),
20+
GetUserNotificationRuleOptionalParams::default().include("channel".to_string()),
21+
)
22+
.await;
23+
if let Ok(value) = resp {
24+
println!("{:#?}", value);
25+
} else {
26+
println!("{:#?}", resp.unwrap_err());
27+
}
28+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// List On-Call notification rules for a user returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::ListUserNotificationRulesOptionalParams;
4+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "user" in the system
9+
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
10+
let configuration = datadog::Configuration::new();
11+
let api = OnCallAPI::with_config(configuration);
12+
let resp = api
13+
.list_user_notification_rules(
14+
user_data_id.clone(),
15+
ListUserNotificationRulesOptionalParams::default().include("channel".to_string()),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Update an On-Call notification rule for a user returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
4+
use datadog_api_client::datadogV2::api_on_call::UpdateUserNotificationRuleOptionalParams;
5+
use datadog_api_client::datadogV2::model::NotificationChannelType;
6+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleCategory;
7+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationship;
8+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationshipData;
9+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRelationships;
10+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRequestAttributes;
11+
use datadog_api_client::datadogV2::model::OnCallNotificationRuleType;
12+
use datadog_api_client::datadogV2::model::UpdateOnCallNotificationRuleRequest;
13+
use datadog_api_client::datadogV2::model::UpdateOnCallNotificationRuleRequestData;
14+
15+
#[tokio::main]
16+
async fn main() {
17+
// there is a valid "user" in the system
18+
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
19+
20+
// there is a valid "oncall_email_notification_rule" in the system
21+
let oncall_email_notification_rule_data_id =
22+
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();
23+
24+
// there is a valid "oncall_email_notification_channel" in the system
25+
let oncall_email_notification_channel_data_id =
26+
std::env::var("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID").unwrap();
27+
let body = UpdateOnCallNotificationRuleRequest::new(
28+
UpdateOnCallNotificationRuleRequestData::new(
29+
OnCallNotificationRuleType::NOTIFICATION_RULES,
30+
)
31+
.attributes(
32+
OnCallNotificationRuleRequestAttributes::new()
33+
.category(OnCallNotificationRuleCategory::HIGH_URGENCY)
34+
.delay_minutes(1),
35+
)
36+
.id(oncall_email_notification_rule_data_id.clone())
37+
.relationships(
38+
OnCallNotificationRuleRelationships::new().channel(
39+
OnCallNotificationRuleChannelRelationship::new(
40+
OnCallNotificationRuleChannelRelationshipData::new()
41+
.id(oncall_email_notification_channel_data_id.clone())
42+
.type_(NotificationChannelType::NOTIFICATION_CHANNELS),
43+
),
44+
),
45+
),
46+
);
47+
let configuration = datadog::Configuration::new();
48+
let api = OnCallAPI::with_config(configuration);
49+
let resp = api
50+
.update_user_notification_rule(
51+
user_data_id.clone(),
52+
oncall_email_notification_rule_data_id.clone(),
53+
body,
54+
UpdateUserNotificationRuleOptionalParams::default().include("channel".to_string()),
55+
)
56+
.await;
57+
if let Ok(value) = resp {
58+
println!("{:#?}", value);
59+
} else {
60+
println!("{:#?}", resp.unwrap_err());
61+
}
62+
}

src/datadog/configuration.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,12 @@ impl Default for Configuration {
188188
("v2.update_deployment_gate".to_owned(), false),
189189
("v2.update_deployment_rule".to_owned(), false),
190190
("v2.create_incident".to_owned(), false),
191-
("v2.create_incident_impact".to_owned(), false),
192191
("v2.create_incident_integration".to_owned(), false),
193192
("v2.create_incident_notification_rule".to_owned(), false),
194193
("v2.create_incident_notification_template".to_owned(), false),
195194
("v2.create_incident_todo".to_owned(), false),
196195
("v2.create_incident_type".to_owned(), false),
197196
("v2.delete_incident".to_owned(), false),
198-
("v2.delete_incident_impact".to_owned(), false),
199197
("v2.delete_incident_integration".to_owned(), false),
200198
("v2.delete_incident_notification_rule".to_owned(), false),
201199
("v2.delete_incident_notification_template".to_owned(), false),
@@ -208,7 +206,6 @@ impl Default for Configuration {
208206
("v2.get_incident_todo".to_owned(), false),
209207
("v2.get_incident_type".to_owned(), false),
210208
("v2.list_incident_attachments".to_owned(), false),
211-
("v2.list_incident_impacts".to_owned(), false),
212209
("v2.list_incident_integrations".to_owned(), false),
213210
("v2.list_incident_notification_rules".to_owned(), false),
214211
("v2.list_incident_notification_templates".to_owned(), false),

src/datadogV2/api/api_incidents.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -901,14 +901,6 @@ impl IncidentsAPI {
901901
> {
902902
let local_configuration = &self.config;
903903
let operation_id = "v2.create_incident_impact";
904-
if local_configuration.is_unstable_operation_enabled(operation_id) {
905-
warn!("Using unstable operation {operation_id}");
906-
} else {
907-
let local_error = datadog::UnstableOperationDisabledError {
908-
msg: "Operation 'v2.create_incident_impact' is not enabled".to_string(),
909-
};
910-
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
911-
}
912904

913905
// unbox and build optional parameters
914906
let include = params.include;
@@ -1995,14 +1987,6 @@ impl IncidentsAPI {
19951987
) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteIncidentImpactError>> {
19961988
let local_configuration = &self.config;
19971989
let operation_id = "v2.delete_incident_impact";
1998-
if local_configuration.is_unstable_operation_enabled(operation_id) {
1999-
warn!("Using unstable operation {operation_id}");
2000-
} else {
2001-
let local_error = datadog::UnstableOperationDisabledError {
2002-
msg: "Operation 'v2.delete_incident_impact' is not enabled".to_string(),
2003-
};
2004-
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
2005-
}
20061990

20071991
let local_client = &self.client;
20081992

@@ -3537,14 +3521,6 @@ impl IncidentsAPI {
35373521
> {
35383522
let local_configuration = &self.config;
35393523
let operation_id = "v2.list_incident_impacts";
3540-
if local_configuration.is_unstable_operation_enabled(operation_id) {
3541-
warn!("Using unstable operation {operation_id}");
3542-
} else {
3543-
let local_error = datadog::UnstableOperationDisabledError {
3544-
msg: "Operation 'v2.list_incident_impacts' is not enabled".to_string(),
3545-
};
3546-
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
3547-
}
35483524

35493525
// unbox and build optional parameters
35503526
let include = params.include;

0 commit comments

Comments
 (0)