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?
examples/v2_on-call_DeleteOnCallSchedule.rs (line 10)
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
examples/v2_on-call_GetOnCallSchedule.rs (line 11)
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}
examples/v2_on-call_CreateOnCallSchedule.rs (line 91)
23async fn main() {
24 // there is a valid "user" in the system
25 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
26
27 // there is a valid "team" in the system
28 let team_data_id = std::env::var("TEAM_DATA_ID").unwrap();
29 let body =
30 ScheduleCreateRequest::new(
31 ScheduleCreateRequestData::new(
32 ScheduleCreateRequestDataAttributes::new(
33 vec![
34 ScheduleCreateRequestDataAttributesLayersItems::new(
35 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
36 .expect("Failed to parse datetime")
37 .with_timezone(&Utc),
38 ScheduleCreateRequestDataAttributesLayersItemsInterval::new().days(1),
39 vec![
40 ScheduleCreateRequestDataAttributesLayersItemsMembersItems
41 ::new().user(
42 ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser
43 ::new().id(user_data_id.clone()),
44 )
45 ],
46 "Layer 1".to_string(),
47 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
48 .expect("Failed to parse datetime")
49 .with_timezone(&Utc),
50 )
51 .end_date(
52 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
53 .expect("Failed to parse datetime")
54 .with_timezone(&Utc),
55 )
56 .restrictions(
57 vec![
58 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems::new()
59 .end_day(
60 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
61 ::FRIDAY,
62 )
63 .end_time("17:00:00".to_string())
64 .start_day(
65 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
66 ::MONDAY,
67 )
68 .start_time("09:00:00".to_string())
69 ],
70 )
71 ],
72 "Example-On-Call".to_string(),
73 "America/New_York".to_string(),
74 ).tags(vec!["tag1".to_string(), "tag2".to_string()]),
75 ScheduleCreateRequestDataType::SCHEDULES,
76 ).relationships(
77 ScheduleCreateRequestDataRelationships
78 ::new().teams(
79 ScheduleCreateRequestDataRelationshipsTeams
80 ::new().data(
81 vec![
82 ScheduleCreateRequestDataRelationshipsTeamsDataItems::new()
83 .id(team_data_id.clone())
84 .type_(ScheduleCreateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
85 ],
86 ),
87 ),
88 ),
89 );
90 let configuration = datadog::Configuration::new();
91 let api = OnCallAPI::with_config(configuration);
92 let resp = api
93 .create_on_call_schedule(body, CreateOnCallScheduleOptionalParams::default())
94 .await;
95 if let Ok(value) = resp {
96 println!("{:#?}", value);
97 } else {
98 println!("{:#?}", resp.unwrap_err());
99 }
100}
examples/v2_on-call_UpdateOnCallSchedule.rs (line 103)
23async fn main() {
24 // there is a valid "schedule" in the system
25 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
26 let schedule_data_relationships_layers_data_0_id =
27 std::env::var("SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID").unwrap();
28
29 // there is a valid "user" in the system
30 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
31
32 // there is a valid "team" in the system
33 let team_data_id = std::env::var("TEAM_DATA_ID").unwrap();
34 let body =
35 ScheduleUpdateRequest::new(
36 ScheduleUpdateRequestData::new(
37 ScheduleUpdateRequestDataAttributes::new(
38 vec![
39 ScheduleUpdateRequestDataAttributesLayersItems::new()
40 .effective_date(
41 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
42 .expect("Failed to parse datetime")
43 .with_timezone(&Utc),
44 )
45 .end_date(
46 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
47 .expect("Failed to parse datetime")
48 .with_timezone(&Utc),
49 )
50 .id(schedule_data_relationships_layers_data_0_id.clone())
51 .interval(ScheduleUpdateRequestDataAttributesLayersItemsInterval::new().seconds(300))
52 .members(
53 vec![
54 ScheduleUpdateRequestDataAttributesLayersItemsMembersItems
55 ::new().user(
56 ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser
57 ::new().id(user_data_id.clone()),
58 )
59 ],
60 )
61 .name("Layer 1".to_string())
62 .restrictions(
63 vec![
64 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems::new()
65 .end_day(
66 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
67 ::FRIDAY,
68 )
69 .end_time("17:00:00".to_string())
70 .start_day(
71 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
72 ::MONDAY,
73 )
74 .start_time("09:00:00".to_string())
75 ],
76 )
77 .rotation_start(
78 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
79 .expect("Failed to parse datetime")
80 .with_timezone(&Utc),
81 )
82 ],
83 "Example-On-Call".to_string(),
84 "America/New_York".to_string(),
85 ).tags(vec!["tag1".to_string(), "tag2".to_string(), "tag3".to_string()]),
86 schedule_data_id.clone(),
87 ScheduleUpdateRequestDataType::SCHEDULES,
88 ).relationships(
89 ScheduleUpdateRequestDataRelationships
90 ::new().teams(
91 ScheduleUpdateRequestDataRelationshipsTeams
92 ::new().data(
93 vec![
94 ScheduleUpdateRequestDataRelationshipsTeamsDataItems::new()
95 .id(team_data_id.clone())
96 .type_(ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
97 ],
98 ),
99 ),
100 ),
101 );
102 let configuration = datadog::Configuration::new();
103 let api = OnCallAPI::with_config(configuration);
104 let resp = api
105 .update_on_call_schedule(
106 schedule_data_id.clone(),
107 body,
108 UpdateOnCallScheduleOptionalParams::default(),
109 )
110 .await;
111 if let Ok(value) = resp {
112 println!("{:#?}", value);
113 } else {
114 println!("{:#?}", resp.unwrap_err());
115 }
116}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
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?
examples/v2_on-call_CreateOnCallSchedule.rs (line 93)
23async fn main() {
24 // there is a valid "user" in the system
25 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
26
27 // there is a valid "team" in the system
28 let team_data_id = std::env::var("TEAM_DATA_ID").unwrap();
29 let body =
30 ScheduleCreateRequest::new(
31 ScheduleCreateRequestData::new(
32 ScheduleCreateRequestDataAttributes::new(
33 vec![
34 ScheduleCreateRequestDataAttributesLayersItems::new(
35 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
36 .expect("Failed to parse datetime")
37 .with_timezone(&Utc),
38 ScheduleCreateRequestDataAttributesLayersItemsInterval::new().days(1),
39 vec![
40 ScheduleCreateRequestDataAttributesLayersItemsMembersItems
41 ::new().user(
42 ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser
43 ::new().id(user_data_id.clone()),
44 )
45 ],
46 "Layer 1".to_string(),
47 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
48 .expect("Failed to parse datetime")
49 .with_timezone(&Utc),
50 )
51 .end_date(
52 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
53 .expect("Failed to parse datetime")
54 .with_timezone(&Utc),
55 )
56 .restrictions(
57 vec![
58 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems::new()
59 .end_day(
60 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
61 ::FRIDAY,
62 )
63 .end_time("17:00:00".to_string())
64 .start_day(
65 ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
66 ::MONDAY,
67 )
68 .start_time("09:00:00".to_string())
69 ],
70 )
71 ],
72 "Example-On-Call".to_string(),
73 "America/New_York".to_string(),
74 ).tags(vec!["tag1".to_string(), "tag2".to_string()]),
75 ScheduleCreateRequestDataType::SCHEDULES,
76 ).relationships(
77 ScheduleCreateRequestDataRelationships
78 ::new().teams(
79 ScheduleCreateRequestDataRelationshipsTeams
80 ::new().data(
81 vec![
82 ScheduleCreateRequestDataRelationshipsTeamsDataItems::new()
83 .id(team_data_id.clone())
84 .type_(ScheduleCreateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
85 ],
86 ),
87 ),
88 ),
89 );
90 let configuration = datadog::Configuration::new();
91 let api = OnCallAPI::with_config(configuration);
92 let resp = api
93 .create_on_call_schedule(body, CreateOnCallScheduleOptionalParams::default())
94 .await;
95 if let Ok(value) = resp {
96 println!("{:#?}", value);
97 } else {
98 println!("{:#?}", resp.unwrap_err());
99 }
100}
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_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?
examples/v2_on-call_DeleteOnCallSchedule.rs (line 11)
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_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?
examples/v2_on-call_GetOnCallSchedule.rs (lines 13-16)
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 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?
examples/v2_on-call_UpdateOnCallSchedule.rs (lines 105-109)
23async fn main() {
24 // there is a valid "schedule" in the system
25 let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
26 let schedule_data_relationships_layers_data_0_id =
27 std::env::var("SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID").unwrap();
28
29 // there is a valid "user" in the system
30 let user_data_id = std::env::var("USER_DATA_ID").unwrap();
31
32 // there is a valid "team" in the system
33 let team_data_id = std::env::var("TEAM_DATA_ID").unwrap();
34 let body =
35 ScheduleUpdateRequest::new(
36 ScheduleUpdateRequestData::new(
37 ScheduleUpdateRequestDataAttributes::new(
38 vec![
39 ScheduleUpdateRequestDataAttributesLayersItems::new()
40 .effective_date(
41 DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
42 .expect("Failed to parse datetime")
43 .with_timezone(&Utc),
44 )
45 .end_date(
46 DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
47 .expect("Failed to parse datetime")
48 .with_timezone(&Utc),
49 )
50 .id(schedule_data_relationships_layers_data_0_id.clone())
51 .interval(ScheduleUpdateRequestDataAttributesLayersItemsInterval::new().seconds(300))
52 .members(
53 vec![
54 ScheduleUpdateRequestDataAttributesLayersItemsMembersItems
55 ::new().user(
56 ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser
57 ::new().id(user_data_id.clone()),
58 )
59 ],
60 )
61 .name("Layer 1".to_string())
62 .restrictions(
63 vec![
64 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems::new()
65 .end_day(
66 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
67 ::FRIDAY,
68 )
69 .end_time("17:00:00".to_string())
70 .start_day(
71 ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
72 ::MONDAY,
73 )
74 .start_time("09:00:00".to_string())
75 ],
76 )
77 .rotation_start(
78 DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
79 .expect("Failed to parse datetime")
80 .with_timezone(&Utc),
81 )
82 ],
83 "Example-On-Call".to_string(),
84 "America/New_York".to_string(),
85 ).tags(vec!["tag1".to_string(), "tag2".to_string(), "tag3".to_string()]),
86 schedule_data_id.clone(),
87 ScheduleUpdateRequestDataType::SCHEDULES,
88 ).relationships(
89 ScheduleUpdateRequestDataRelationships
90 ::new().teams(
91 ScheduleUpdateRequestDataRelationshipsTeams
92 ::new().data(
93 vec![
94 ScheduleUpdateRequestDataRelationshipsTeamsDataItems::new()
95 .id(team_data_id.clone())
96 .type_(ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
97 ],
98 ),
99 ),
100 ),
101 );
102 let configuration = datadog::Configuration::new();
103 let api = OnCallAPI::with_config(configuration);
104 let resp = api
105 .update_on_call_schedule(
106 schedule_data_id.clone(),
107 body,
108 UpdateOnCallScheduleOptionalParams::default(),
109 )
110 .await;
111 if let Ok(value) = resp {
112 println!("{:#?}", value);
113 } else {
114 println!("{:#?}", resp.unwrap_err());
115 }
116}
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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OnCallAPI
impl !RefUnwindSafe for OnCallAPI
impl Send for OnCallAPI
impl Sync for OnCallAPI
impl Unpin for OnCallAPI
impl !UnwindSafe for OnCallAPI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more