pub struct OnCallAPI { /* private fields */ }
Expand description
Configure your Datadog On-Call directly through the Datadog API.
Implementations§
Source§impl OnCallAPI
impl OnCallAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
6async fn main() {
7 // there is a valid "schedule" in the system
8 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = OnCallAPI::with_config(configuration);
11 let resp = api.delete_on_call_schedule(schedule_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
More examples
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = OnCallAPI::with_config(configuration);
10 let resp = api
11 .get_on_call_team_routing_rules(
12 "27590dae-47be-4a7d-9abf-8f4e45124020".to_string(),
13 GetOnCallTeamRoutingRulesOptionalParams::default(),
14 )
15 .await;
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21}
6async fn main() {
7 // there is a valid "escalation_policy" in the system
8 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = OnCallAPI::with_config(configuration);
11 let resp = api
12 .delete_on_call_escalation_policy(escalation_policy_data_id.clone())
13 .await;
14 if let Ok(value) = resp {
15 println!("{:#?}", value);
16 } else {
17 println!("{:#?}", resp.unwrap_err());
18 }
19}
7async fn main() {
8 // there is a valid "schedule" in the system
9 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_on_call_schedule(
14 schedule_data_id.clone(),
15 GetOnCallScheduleOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
7async fn main() {
8 // there is a valid "schedule" in the system
9 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_schedule_on_call_user(
14 schedule_data_id.clone(),
15 GetScheduleOnCallUserOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
7async fn main() {
8 // there is a valid "escalation_policy" in the system
9 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_on_call_escalation_policy(
14 escalation_policy_data_id.clone(),
15 GetOnCallEscalationPolicyOptionalParams::default().include("steps.targets".to_string()),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn create_on_call_escalation_policy(
&self,
body: EscalationPolicyCreateRequest,
params: CreateOnCallEscalationPolicyOptionalParams,
) -> Result<EscalationPolicy, Error<CreateOnCallEscalationPolicyError>>
pub async fn create_on_call_escalation_policy( &self, body: EscalationPolicyCreateRequest, params: CreateOnCallEscalationPolicyOptionalParams, ) -> Result<EscalationPolicy, Error<CreateOnCallEscalationPolicyError>>
Create a new On-Call escalation policy
Examples found in repository?
19async fn main() {
20 // there is a valid "user" in the system
21 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
22
23 // there is a valid "schedule" in the system
24 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
25
26 // there is a valid "dd_team" in the system
27 let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
28 let body = EscalationPolicyCreateRequest::new(
29 EscalationPolicyCreateRequestData::new(
30 EscalationPolicyCreateRequestDataAttributes::new(
31 "Example-On-Call".to_string(),
32 vec![
33 EscalationPolicyCreateRequestDataAttributesStepsItems::new(vec![
34 EscalationPolicyStepTarget::new()
35 .id(user_data_id.clone())
36 .type_(EscalationPolicyStepTargetType::USERS),
37 EscalationPolicyStepTarget::new()
38 .id(schedule_data_id.clone())
39 .type_(EscalationPolicyStepTargetType::SCHEDULES),
40 EscalationPolicyStepTarget::new()
41 .id(dd_team_data_id.clone())
42 .type_(EscalationPolicyStepTargetType::TEAMS),
43 ])
44 .assignment(EscalationPolicyStepAttributesAssignment::DEFAULT)
45 .escalate_after_seconds(3600),
46 EscalationPolicyCreateRequestDataAttributesStepsItems::new(vec![
47 EscalationPolicyStepTarget::new()
48 .id(dd_team_data_id.clone())
49 .type_(EscalationPolicyStepTargetType::TEAMS),
50 ])
51 .assignment(EscalationPolicyStepAttributesAssignment::ROUND_ROBIN)
52 .escalate_after_seconds(3600),
53 ],
54 )
55 .resolve_page_on_policy_end(true)
56 .retries(2),
57 EscalationPolicyCreateRequestDataType::POLICIES,
58 )
59 .relationships(EscalationPolicyCreateRequestDataRelationships::new().teams(
60 DataRelationshipsTeams::new().data(vec![DataRelationshipsTeamsDataItems::new(
61 dd_team_data_id.clone(),
62 DataRelationshipsTeamsDataItemsType::TEAMS,
63 )]),
64 )),
65 );
66 let configuration = datadog::Configuration::new();
67 let api = OnCallAPI::with_config(configuration);
68 let resp = api
69 .create_on_call_escalation_policy(
70 body,
71 CreateOnCallEscalationPolicyOptionalParams::default()
72 .include("steps.targets".to_string()),
73 )
74 .await;
75 if let Ok(value) = resp {
76 println!("{:#?}", value);
77 } else {
78 println!("{:#?}", resp.unwrap_err());
79 }
80}
Sourcepub async fn create_on_call_escalation_policy_with_http_info(
&self,
body: EscalationPolicyCreateRequest,
params: CreateOnCallEscalationPolicyOptionalParams,
) -> Result<ResponseContent<EscalationPolicy>, Error<CreateOnCallEscalationPolicyError>>
pub async fn create_on_call_escalation_policy_with_http_info( &self, body: EscalationPolicyCreateRequest, params: CreateOnCallEscalationPolicyOptionalParams, ) -> Result<ResponseContent<EscalationPolicy>, Error<CreateOnCallEscalationPolicyError>>
Create a new On-Call escalation policy
Sourcepub async fn create_on_call_schedule(
&self,
body: ScheduleCreateRequest,
params: CreateOnCallScheduleOptionalParams,
) -> Result<Schedule, Error<CreateOnCallScheduleError>>
pub async fn create_on_call_schedule( &self, body: ScheduleCreateRequest, params: CreateOnCallScheduleOptionalParams, ) -> Result<Schedule, Error<CreateOnCallScheduleError>>
Create a new On-Call schedule
Examples found in repository?
22async fn main() {
23 // there is a valid "user" in the system
24 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
25
26 // there is a valid "dd_team" in the system
27 let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
28 let body = ScheduleCreateRequest::new(
29 ScheduleCreateRequestData::new(
30 ScheduleCreateRequestDataAttributes::new(
31 vec![ScheduleCreateRequestDataAttributesLayersItems::new(
32 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
33 .expect("Failed to parse datetime")
34 .with_timezone(&Utc),
35 LayerAttributesInterval::new().days(1),
36 vec![
37 ScheduleRequestDataAttributesLayersItemsMembersItems::new().user(
38 ScheduleRequestDataAttributesLayersItemsMembersItemsUser::new()
39 .id(user_data_id.clone()),
40 ),
41 ],
42 "Layer 1".to_string(),
43 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
44 .expect("Failed to parse datetime")
45 .with_timezone(&Utc),
46 )
47 .end_date(
48 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
49 .expect("Failed to parse datetime")
50 .with_timezone(&Utc),
51 )
52 .restrictions(vec![TimeRestriction::new()
53 .end_day(Weekday::FRIDAY)
54 .end_time("17:00:00".to_string())
55 .start_day(Weekday::MONDAY)
56 .start_time("09:00:00".to_string())])],
57 "Example-On-Call".to_string(),
58 "America/New_York".to_string(),
59 ),
60 ScheduleCreateRequestDataType::SCHEDULES,
61 )
62 .relationships(ScheduleCreateRequestDataRelationships::new().teams(
63 DataRelationshipsTeams::new().data(vec![DataRelationshipsTeamsDataItems::new(
64 dd_team_data_id.clone(),
65 DataRelationshipsTeamsDataItemsType::TEAMS,
66 )]),
67 )),
68 );
69 let configuration = datadog::Configuration::new();
70 let api = OnCallAPI::with_config(configuration);
71 let resp = api
72 .create_on_call_schedule(body, CreateOnCallScheduleOptionalParams::default())
73 .await;
74 if let Ok(value) = resp {
75 println!("{:#?}", value);
76 } else {
77 println!("{:#?}", resp.unwrap_err());
78 }
79}
Sourcepub async fn create_on_call_schedule_with_http_info(
&self,
body: ScheduleCreateRequest,
params: CreateOnCallScheduleOptionalParams,
) -> Result<ResponseContent<Schedule>, Error<CreateOnCallScheduleError>>
pub async fn create_on_call_schedule_with_http_info( &self, body: ScheduleCreateRequest, params: CreateOnCallScheduleOptionalParams, ) -> Result<ResponseContent<Schedule>, Error<CreateOnCallScheduleError>>
Create a new On-Call schedule
Sourcepub async fn delete_on_call_escalation_policy(
&self,
policy_id: String,
) -> Result<(), Error<DeleteOnCallEscalationPolicyError>>
pub async fn delete_on_call_escalation_policy( &self, policy_id: String, ) -> Result<(), Error<DeleteOnCallEscalationPolicyError>>
Delete an On-Call escalation policy
Examples found in repository?
6async fn main() {
7 // there is a valid "escalation_policy" in the system
8 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = OnCallAPI::with_config(configuration);
11 let resp = api
12 .delete_on_call_escalation_policy(escalation_policy_data_id.clone())
13 .await;
14 if let Ok(value) = resp {
15 println!("{:#?}", value);
16 } else {
17 println!("{:#?}", resp.unwrap_err());
18 }
19}
Sourcepub async fn delete_on_call_escalation_policy_with_http_info(
&self,
policy_id: String,
) -> Result<ResponseContent<()>, Error<DeleteOnCallEscalationPolicyError>>
pub async fn delete_on_call_escalation_policy_with_http_info( &self, policy_id: String, ) -> Result<ResponseContent<()>, Error<DeleteOnCallEscalationPolicyError>>
Delete an On-Call escalation policy
Sourcepub async fn delete_on_call_schedule(
&self,
schedule_id: String,
) -> Result<(), Error<DeleteOnCallScheduleError>>
pub async fn delete_on_call_schedule( &self, schedule_id: String, ) -> Result<(), Error<DeleteOnCallScheduleError>>
Delete an On-Call schedule
Examples found in repository?
6async fn main() {
7 // there is a valid "schedule" in the system
8 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
9 let configuration = datadog::Configuration::new();
10 let api = OnCallAPI::with_config(configuration);
11 let resp = api.delete_on_call_schedule(schedule_data_id.clone()).await;
12 if let Ok(value) = resp {
13 println!("{:#?}", value);
14 } else {
15 println!("{:#?}", resp.unwrap_err());
16 }
17}
Sourcepub async fn delete_on_call_schedule_with_http_info(
&self,
schedule_id: String,
) -> Result<ResponseContent<()>, Error<DeleteOnCallScheduleError>>
pub async fn delete_on_call_schedule_with_http_info( &self, schedule_id: String, ) -> Result<ResponseContent<()>, Error<DeleteOnCallScheduleError>>
Delete an On-Call schedule
Sourcepub async fn get_on_call_escalation_policy(
&self,
policy_id: String,
params: GetOnCallEscalationPolicyOptionalParams,
) -> Result<EscalationPolicy, Error<GetOnCallEscalationPolicyError>>
pub async fn get_on_call_escalation_policy( &self, policy_id: String, params: GetOnCallEscalationPolicyOptionalParams, ) -> Result<EscalationPolicy, Error<GetOnCallEscalationPolicyError>>
Get an On-Call escalation policy
Examples found in repository?
7async fn main() {
8 // there is a valid "escalation_policy" in the system
9 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_on_call_escalation_policy(
14 escalation_policy_data_id.clone(),
15 GetOnCallEscalationPolicyOptionalParams::default().include("steps.targets".to_string()),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn get_on_call_escalation_policy_with_http_info(
&self,
policy_id: String,
params: GetOnCallEscalationPolicyOptionalParams,
) -> Result<ResponseContent<EscalationPolicy>, Error<GetOnCallEscalationPolicyError>>
pub async fn get_on_call_escalation_policy_with_http_info( &self, policy_id: String, params: GetOnCallEscalationPolicyOptionalParams, ) -> Result<ResponseContent<EscalationPolicy>, Error<GetOnCallEscalationPolicyError>>
Get an On-Call escalation policy
Sourcepub async fn get_on_call_schedule(
&self,
schedule_id: String,
params: GetOnCallScheduleOptionalParams,
) -> Result<Schedule, Error<GetOnCallScheduleError>>
pub async fn get_on_call_schedule( &self, schedule_id: String, params: GetOnCallScheduleOptionalParams, ) -> Result<Schedule, Error<GetOnCallScheduleError>>
Get an On-Call schedule
Examples found in repository?
7async fn main() {
8 // there is a valid "schedule" in the system
9 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_on_call_schedule(
14 schedule_data_id.clone(),
15 GetOnCallScheduleOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn get_on_call_schedule_with_http_info(
&self,
schedule_id: String,
params: GetOnCallScheduleOptionalParams,
) -> Result<ResponseContent<Schedule>, Error<GetOnCallScheduleError>>
pub async fn get_on_call_schedule_with_http_info( &self, schedule_id: String, params: GetOnCallScheduleOptionalParams, ) -> Result<ResponseContent<Schedule>, Error<GetOnCallScheduleError>>
Get an On-Call schedule
Sourcepub async fn get_on_call_team_routing_rules(
&self,
team_id: String,
params: GetOnCallTeamRoutingRulesOptionalParams,
) -> Result<TeamRoutingRules, Error<GetOnCallTeamRoutingRulesError>>
pub async fn get_on_call_team_routing_rules( &self, team_id: String, params: GetOnCallTeamRoutingRulesOptionalParams, ) -> Result<TeamRoutingRules, Error<GetOnCallTeamRoutingRulesError>>
Get a team’s On-Call routing rules
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = OnCallAPI::with_config(configuration);
10 let resp = api
11 .get_on_call_team_routing_rules(
12 "27590dae-47be-4a7d-9abf-8f4e45124020".to_string(),
13 GetOnCallTeamRoutingRulesOptionalParams::default(),
14 )
15 .await;
16 if let Ok(value) = resp {
17 println!("{:#?}", value);
18 } else {
19 println!("{:#?}", resp.unwrap_err());
20 }
21}
Sourcepub async fn get_on_call_team_routing_rules_with_http_info(
&self,
team_id: String,
params: GetOnCallTeamRoutingRulesOptionalParams,
) -> Result<ResponseContent<TeamRoutingRules>, Error<GetOnCallTeamRoutingRulesError>>
pub async fn get_on_call_team_routing_rules_with_http_info( &self, team_id: String, params: GetOnCallTeamRoutingRulesOptionalParams, ) -> Result<ResponseContent<TeamRoutingRules>, Error<GetOnCallTeamRoutingRulesError>>
Get a team’s On-Call routing rules
Sourcepub async fn get_schedule_on_call_user(
&self,
schedule_id: String,
params: GetScheduleOnCallUserOptionalParams,
) -> Result<Shift, Error<GetScheduleOnCallUserError>>
pub async fn get_schedule_on_call_user( &self, schedule_id: String, params: GetScheduleOnCallUserOptionalParams, ) -> Result<Shift, Error<GetScheduleOnCallUserError>>
Retrieves the user who is on-call for the specified schedule at a given time.
Examples found in repository?
7async fn main() {
8 // there is a valid "schedule" in the system
9 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_schedule_on_call_user(
14 schedule_data_id.clone(),
15 GetScheduleOnCallUserOptionalParams::default(),
16 )
17 .await;
18 if let Ok(value) = resp {
19 println!("{:#?}", value);
20 } else {
21 println!("{:#?}", resp.unwrap_err());
22 }
23}
Sourcepub async fn get_schedule_on_call_user_with_http_info(
&self,
schedule_id: String,
params: GetScheduleOnCallUserOptionalParams,
) -> Result<ResponseContent<Shift>, Error<GetScheduleOnCallUserError>>
pub async fn get_schedule_on_call_user_with_http_info( &self, schedule_id: String, params: GetScheduleOnCallUserOptionalParams, ) -> Result<ResponseContent<Shift>, Error<GetScheduleOnCallUserError>>
Retrieves the user who is on-call for the specified schedule at a given time.
Sourcepub async fn get_team_on_call_users(
&self,
team_id: String,
params: GetTeamOnCallUsersOptionalParams,
) -> Result<TeamOnCallResponders, Error<GetTeamOnCallUsersError>>
pub async fn get_team_on_call_users( &self, team_id: String, params: GetTeamOnCallUsersOptionalParams, ) -> Result<TeamOnCallResponders, Error<GetTeamOnCallUsersError>>
Get a team’s on-call users at a given time
Examples found in repository?
7async fn main() {
8 // there are valid "routing_rules" in the system
9 let routing_rules_data_id = std::env::var("ROUTING_RULES_DATA_ID").unwrap();
10 let configuration = datadog::Configuration::new();
11 let api = OnCallAPI::with_config(configuration);
12 let resp = api
13 .get_team_on_call_users(
14 routing_rules_data_id.clone(),
15 GetTeamOnCallUsersOptionalParams::default()
16 .include("responders,escalations.responders".to_string()),
17 )
18 .await;
19 if let Ok(value) = resp {
20 println!("{:#?}", value);
21 } else {
22 println!("{:#?}", resp.unwrap_err());
23 }
24}
Sourcepub async fn get_team_on_call_users_with_http_info(
&self,
team_id: String,
params: GetTeamOnCallUsersOptionalParams,
) -> Result<ResponseContent<TeamOnCallResponders>, Error<GetTeamOnCallUsersError>>
pub async fn get_team_on_call_users_with_http_info( &self, team_id: String, params: GetTeamOnCallUsersOptionalParams, ) -> Result<ResponseContent<TeamOnCallResponders>, Error<GetTeamOnCallUsersError>>
Get a team’s on-call users at a given time
Sourcepub async fn set_on_call_team_routing_rules(
&self,
team_id: String,
body: TeamRoutingRulesRequest,
params: SetOnCallTeamRoutingRulesOptionalParams,
) -> Result<TeamRoutingRules, Error<SetOnCallTeamRoutingRulesError>>
pub async fn set_on_call_team_routing_rules( &self, team_id: String, body: TeamRoutingRulesRequest, params: SetOnCallTeamRoutingRulesOptionalParams, ) -> Result<TeamRoutingRules, Error<SetOnCallTeamRoutingRulesError>>
Set a team’s On-Call routing rules
Examples found in repository?
19async fn main() {
20 // there is a valid "dd_team" in the system
21 let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
22
23 // there is a valid "escalation_policy" in the system
24 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
25 let body = TeamRoutingRulesRequest::new().data(
26 TeamRoutingRulesRequestData::new(TeamRoutingRulesRequestDataType::TEAM_ROUTING_RULES)
27 .attributes(TeamRoutingRulesRequestDataAttributes::new().rules(vec![
28 TeamRoutingRulesRequestRule::new()
29 .actions(
30 vec![
31 RoutingRuleAction::SendSlackMessageAction(
32 Box::new(
33 SendSlackMessageAction::new(
34 "channel".to_string(),
35 SendSlackMessageActionType::SEND_SLACK_MESSAGE,
36 "workspace".to_string(),
37 ),
38 ),
39 )
40 ],
41 )
42 .query("tags.service:test".to_string())
43 .time_restriction(
44 TimeRestrictions::new(
45 vec![
46 TimeRestriction::new()
47 .end_day(Weekday::MONDAY)
48 .end_time("17:00:00".to_string())
49 .start_day(Weekday::MONDAY)
50 .start_time("09:00:00".to_string()),
51 TimeRestriction::new()
52 .end_day(Weekday::TUESDAY)
53 .end_time("17:00:00".to_string())
54 .start_day(Weekday::TUESDAY)
55 .start_time("09:00:00".to_string())
56 ],
57 "Europe/Paris".to_string(),
58 ),
59 ),
60 TeamRoutingRulesRequestRule::new()
61 .policy_id(escalation_policy_data_id.clone())
62 .query("".to_string())
63 .urgency(Urgency::LOW)
64 ]))
65 .id(dd_team_data_id.clone()),
66 );
67 let configuration = datadog::Configuration::new();
68 let api = OnCallAPI::with_config(configuration);
69 let resp = api
70 .set_on_call_team_routing_rules(
71 dd_team_data_id.clone(),
72 body,
73 SetOnCallTeamRoutingRulesOptionalParams::default().include("rules".to_string()),
74 )
75 .await;
76 if let Ok(value) = resp {
77 println!("{:#?}", value);
78 } else {
79 println!("{:#?}", resp.unwrap_err());
80 }
81}
Sourcepub async fn set_on_call_team_routing_rules_with_http_info(
&self,
team_id: String,
body: TeamRoutingRulesRequest,
params: SetOnCallTeamRoutingRulesOptionalParams,
) -> Result<ResponseContent<TeamRoutingRules>, Error<SetOnCallTeamRoutingRulesError>>
pub async fn set_on_call_team_routing_rules_with_http_info( &self, team_id: String, body: TeamRoutingRulesRequest, params: SetOnCallTeamRoutingRulesOptionalParams, ) -> Result<ResponseContent<TeamRoutingRules>, Error<SetOnCallTeamRoutingRulesError>>
Set a team’s On-Call routing rules
Sourcepub async fn update_on_call_escalation_policy(
&self,
policy_id: String,
body: EscalationPolicyUpdateRequest,
params: UpdateOnCallEscalationPolicyOptionalParams,
) -> Result<EscalationPolicy, Error<UpdateOnCallEscalationPolicyError>>
pub async fn update_on_call_escalation_policy( &self, policy_id: String, body: EscalationPolicyUpdateRequest, params: UpdateOnCallEscalationPolicyOptionalParams, ) -> Result<EscalationPolicy, Error<UpdateOnCallEscalationPolicyError>>
Update an On-Call escalation policy
Examples found in repository?
19async fn main() {
20 // there is a valid "escalation_policy" in the system
21 let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
22 let escalation_policy_data_relationships_steps_data_0_id =
23 std::env::var("ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID").unwrap();
24
25 // there is a valid "user" in the system
26 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
27
28 // there is a valid "dd_team" in the system
29 let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
30 let body = EscalationPolicyUpdateRequest::new(
31 EscalationPolicyUpdateRequestData::new(
32 EscalationPolicyUpdateRequestDataAttributes::new(
33 "Example-On-Call-updated".to_string(),
34 vec![
35 EscalationPolicyUpdateRequestDataAttributesStepsItems::new(vec![
36 EscalationPolicyStepTarget::new()
37 .id(user_data_id.clone())
38 .type_(EscalationPolicyStepTargetType::USERS),
39 ])
40 .assignment(EscalationPolicyStepAttributesAssignment::DEFAULT)
41 .escalate_after_seconds(3600)
42 .id(escalation_policy_data_relationships_steps_data_0_id.clone()),
43 ],
44 )
45 .resolve_page_on_policy_end(false)
46 .retries(0),
47 escalation_policy_data_id.clone(),
48 EscalationPolicyUpdateRequestDataType::POLICIES,
49 )
50 .relationships(EscalationPolicyUpdateRequestDataRelationships::new().teams(
51 DataRelationshipsTeams::new().data(vec![DataRelationshipsTeamsDataItems::new(
52 dd_team_data_id.clone(),
53 DataRelationshipsTeamsDataItemsType::TEAMS,
54 )]),
55 )),
56 );
57 let configuration = datadog::Configuration::new();
58 let api = OnCallAPI::with_config(configuration);
59 let resp = api
60 .update_on_call_escalation_policy(
61 escalation_policy_data_id.clone(),
62 body,
63 UpdateOnCallEscalationPolicyOptionalParams::default(),
64 )
65 .await;
66 if let Ok(value) = resp {
67 println!("{:#?}", value);
68 } else {
69 println!("{:#?}", resp.unwrap_err());
70 }
71}
Sourcepub async fn update_on_call_escalation_policy_with_http_info(
&self,
policy_id: String,
body: EscalationPolicyUpdateRequest,
params: UpdateOnCallEscalationPolicyOptionalParams,
) -> Result<ResponseContent<EscalationPolicy>, Error<UpdateOnCallEscalationPolicyError>>
pub async fn update_on_call_escalation_policy_with_http_info( &self, policy_id: String, body: EscalationPolicyUpdateRequest, params: UpdateOnCallEscalationPolicyOptionalParams, ) -> Result<ResponseContent<EscalationPolicy>, Error<UpdateOnCallEscalationPolicyError>>
Update an On-Call escalation policy
Sourcepub async fn update_on_call_schedule(
&self,
schedule_id: String,
body: ScheduleUpdateRequest,
params: UpdateOnCallScheduleOptionalParams,
) -> Result<Schedule, Error<UpdateOnCallScheduleError>>
pub async fn update_on_call_schedule( &self, schedule_id: String, body: ScheduleUpdateRequest, params: UpdateOnCallScheduleOptionalParams, ) -> Result<Schedule, Error<UpdateOnCallScheduleError>>
Update a new On-Call schedule
Examples found in repository?
22async fn main() {
23 // there is a valid "schedule" in the system
24 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
25 let schedule_data_relationships_layers_data_0_id =
26 std::env::var("SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID").unwrap();
27
28 // there is a valid "user" in the system
29 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
30
31 // there is a valid "dd_team" in the system
32 let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
33 let body = ScheduleUpdateRequest::new(
34 ScheduleUpdateRequestData::new(
35 ScheduleUpdateRequestDataAttributes::new(
36 vec![ScheduleUpdateRequestDataAttributesLayersItems::new(
37 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
38 .expect("Failed to parse datetime")
39 .with_timezone(&Utc),
40 LayerAttributesInterval::new().seconds(300),
41 vec![
42 ScheduleRequestDataAttributesLayersItemsMembersItems::new().user(
43 ScheduleRequestDataAttributesLayersItemsMembersItemsUser::new()
44 .id(user_data_id.clone()),
45 ),
46 ],
47 "Layer 1".to_string(),
48 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
49 .expect("Failed to parse datetime")
50 .with_timezone(&Utc),
51 )
52 .end_date(
53 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
54 .expect("Failed to parse datetime")
55 .with_timezone(&Utc),
56 )
57 .id(schedule_data_relationships_layers_data_0_id.clone())
58 .restrictions(vec![TimeRestriction::new()
59 .end_day(Weekday::FRIDAY)
60 .end_time("17:00:00".to_string())
61 .start_day(Weekday::MONDAY)
62 .start_time("09:00:00".to_string())])],
63 "Example-On-Call".to_string(),
64 "America/New_York".to_string(),
65 ),
66 schedule_data_id.clone(),
67 ScheduleUpdateRequestDataType::SCHEDULES,
68 )
69 .relationships(ScheduleUpdateRequestDataRelationships::new().teams(
70 DataRelationshipsTeams::new().data(vec![DataRelationshipsTeamsDataItems::new(
71 dd_team_data_id.clone(),
72 DataRelationshipsTeamsDataItemsType::TEAMS,
73 )]),
74 )),
75 );
76 let configuration = datadog::Configuration::new();
77 let api = OnCallAPI::with_config(configuration);
78 let resp = api
79 .update_on_call_schedule(
80 schedule_data_id.clone(),
81 body,
82 UpdateOnCallScheduleOptionalParams::default(),
83 )
84 .await;
85 if let Ok(value) = resp {
86 println!("{:#?}", value);
87 } else {
88 println!("{:#?}", resp.unwrap_err());
89 }
90}
Sourcepub async fn update_on_call_schedule_with_http_info(
&self,
schedule_id: String,
body: ScheduleUpdateRequest,
params: UpdateOnCallScheduleOptionalParams,
) -> Result<ResponseContent<Schedule>, Error<UpdateOnCallScheduleError>>
pub async fn update_on_call_schedule_with_http_info( &self, schedule_id: String, body: ScheduleUpdateRequest, params: UpdateOnCallScheduleOptionalParams, ) -> Result<ResponseContent<Schedule>, Error<UpdateOnCallScheduleError>>
Update a new On-Call schedule