Struct OnCallAPI

Source
pub struct OnCallAPI { /* private fields */ }
Expand description

Configure your Datadog On-Call directly through the Datadog API.

Implementations§

Source§

impl OnCallAPI

Source

pub fn new() -> Self

Source

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
Hide additional 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}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

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}
Source

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

Source

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}
Source

pub async fn delete_on_call_schedule_with_http_info( &self, schedule_id: String, ) -> Result<ResponseContent<()>, Error<DeleteOnCallScheduleError>>

Delete an on-call schedule

Source

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}
Source

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

Source

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}
Source

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§

Source§

impl Clone for OnCallAPI

Source§

fn clone(&self) -> OnCallAPI

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OnCallAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OnCallAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T