Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
495 changes: 495 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions examples/v2_on-call_CreateUserNotificationRule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Create an On-Call notification rule for a user returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
use datadog_api_client::datadogV2::model::CreateOnCallNotificationRuleRequest;
use datadog_api_client::datadogV2::model::CreateOnCallNotificationRuleRequestData;
use datadog_api_client::datadogV2::model::NotificationChannelType;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleCategory;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationship;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationshipData;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRelationships;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRequestAttributes;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleType;

#[tokio::main]
async fn main() {
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();

// there is a valid "oncall_email_notification_channel" in the system
let oncall_email_notification_channel_data_id =
std::env::var("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID").unwrap();
let body = CreateOnCallNotificationRuleRequest::new(
CreateOnCallNotificationRuleRequestData::new(
OnCallNotificationRuleType::NOTIFICATION_RULES,
)
.attributes(
OnCallNotificationRuleRequestAttributes::new()
.category(OnCallNotificationRuleCategory::HIGH_URGENCY)
.delay_minutes(0),
)
.relationships(
OnCallNotificationRuleRelationships::new().channel(
OnCallNotificationRuleChannelRelationship::new(
OnCallNotificationRuleChannelRelationshipData::new()
.id(oncall_email_notification_channel_data_id.clone())
.type_(NotificationChannelType::NOTIFICATION_CHANNELS),
),
),
),
);
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.create_user_notification_rule(user_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
26 changes: 26 additions & 0 deletions examples/v2_on-call_DeleteUserNotificationRule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Delete an On-Call notification rule for a user returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;

#[tokio::main]
async fn main() {
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();

// there is a valid "oncall_email_notification_rule" in the system
let oncall_email_notification_rule_data_id =
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.delete_user_notification_rule(
user_data_id.clone(),
oncall_email_notification_rule_data_id.clone(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
28 changes: 28 additions & 0 deletions examples/v2_on-call_GetUserNotificationRule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Get an On-Call notification rule for a user returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::GetUserNotificationRuleOptionalParams;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;

#[tokio::main]
async fn main() {
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();

// there is a valid "oncall_email_notification_rule" in the system
let oncall_email_notification_rule_data_id =
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.get_user_notification_rule(
user_data_id.clone(),
oncall_email_notification_rule_data_id.clone(),
GetUserNotificationRuleOptionalParams::default().include("channel".to_string()),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
23 changes: 23 additions & 0 deletions examples/v2_on-call_ListUserNotificationRules.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// List On-Call notification rules for a user returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::ListUserNotificationRulesOptionalParams;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;

#[tokio::main]
async fn main() {
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.list_user_notification_rules(
user_data_id.clone(),
ListUserNotificationRulesOptionalParams::default().include("channel".to_string()),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
62 changes: 62 additions & 0 deletions examples/v2_on-call_UpdateUserNotificationRule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Update an On-Call notification rule for a user returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
use datadog_api_client::datadogV2::api_on_call::UpdateUserNotificationRuleOptionalParams;
use datadog_api_client::datadogV2::model::NotificationChannelType;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleCategory;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationship;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleChannelRelationshipData;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleRelationships;
use datadog_api_client::datadogV2::model::OnCallNotificationRuleType;
use datadog_api_client::datadogV2::model::UpdateOnCallNotificationRuleRequest;
use datadog_api_client::datadogV2::model::UpdateOnCallNotificationRuleRequestAttributes;
use datadog_api_client::datadogV2::model::UpdateOnCallNotificationRuleRequestData;

#[tokio::main]
async fn main() {
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();

// there is a valid "oncall_email_notification_rule" in the system
let oncall_email_notification_rule_data_id =
std::env::var("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID").unwrap();

// there is a valid "oncall_email_notification_channel" in the system
let oncall_email_notification_channel_data_id =
std::env::var("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID").unwrap();
let body = UpdateOnCallNotificationRuleRequest::new(
UpdateOnCallNotificationRuleRequestData::new(
OnCallNotificationRuleType::NOTIFICATION_RULES,
)
.attributes(
UpdateOnCallNotificationRuleRequestAttributes::new()
.category(OnCallNotificationRuleCategory::HIGH_URGENCY)
.delay_minutes(1),
)
.id(oncall_email_notification_rule_data_id.clone())
.relationships(
OnCallNotificationRuleRelationships::new().channel(
OnCallNotificationRuleChannelRelationship::new(
OnCallNotificationRuleChannelRelationshipData::new()
.id(oncall_email_notification_channel_data_id.clone())
.type_(NotificationChannelType::NOTIFICATION_CHANNELS),
),
),
),
);
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.update_user_notification_rule(
user_data_id.clone(),
oncall_email_notification_rule_data_id.clone(),
body,
UpdateUserNotificationRuleOptionalParams::default().include("channel".to_string()),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Loading