Struct DowntimesAPI

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

Downtiming gives you greater control over monitor notifications by allowing you to globally exclude scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags.

Note: curl commands require url encoding.

Implementations§

Source§

impl DowntimesAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v1_downtimes_ListMonitorDowntimes.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = DowntimesAPI::with_config(configuration);
9    let resp = api.list_monitor_downtimes(9223372036854775807).await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
More examples
Hide additional examples
examples/v1_downtimes_ListDowntimes.rs (line 9)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = DowntimesAPI::with_config(configuration);
10    let resp = api
11        .list_downtimes(ListDowntimesOptionalParams::default().with_creator(true))
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
examples/v1_downtimes_GetDowntime.rs (line 10)
6async fn main() {
7    // there is a valid "downtime" in the system
8    let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = DowntimesAPI::with_config(configuration);
11    let resp = api.get_downtime(downtime_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v1_downtimes_CancelDowntime.rs (line 10)
6async fn main() {
7    // there is a valid "downtime" in the system
8    let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = DowntimesAPI::with_config(configuration);
11    let resp = api.cancel_downtime(downtime_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v1_downtimes_CancelDowntimesByScope.rs (line 12)
7async fn main() {
8    // there is a valid "downtime" in the system
9    let downtime_scope_0 = std::env::var("DOWNTIME_SCOPE_0").unwrap();
10    let body = CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());
11    let configuration = datadog::Configuration::new();
12    let api = DowntimesAPI::with_config(configuration);
13    let resp = api.cancel_downtimes_by_scope(body).await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
examples/v1_downtimes_CreateDowntime_3355644446.rs (line 17)
7async fn main() {
8    // there is a valid "monitor" in the system
9    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
10    let body = Downtime::new()
11        .message(Some("Example-Downtime".to_string()))
12        .monitor_id(Some(monitor_id.clone()))
13        .scope(vec!["test:exampledowntime".to_string()])
14        .start(1636629071)
15        .timezone("Etc/UTC".to_string());
16    let configuration = datadog::Configuration::new();
17    let api = DowntimesAPI::with_config(configuration);
18    let resp = api.create_downtime(body).await;
19    if let Ok(value) = resp {
20        println!("{:#?}", value);
21    } else {
22        println!("{:#?}", resp.unwrap_err());
23    }
24}
Source

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

Source

pub async fn cancel_downtime( &self, downtime_id: i64, ) -> Result<(), Error<CancelDowntimeError>>

Cancel a downtime. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_CancelDowntime.rs (line 11)
6async fn main() {
7    // there is a valid "downtime" in the system
8    let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = DowntimesAPI::with_config(configuration);
11    let resp = api.cancel_downtime(downtime_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 cancel_downtime_with_http_info( &self, downtime_id: i64, ) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>

Cancel a downtime. Note: This endpoint has been deprecated. Please use v2 endpoints.

Source

pub async fn cancel_downtimes_by_scope( &self, body: CancelDowntimesByScopeRequest, ) -> Result<CanceledDowntimesIds, Error<CancelDowntimesByScopeError>>

Delete all downtimes that match the scope of X. Note: This only interacts with Downtimes created using v1 endpoints. This endpoint has been deprecated and will not be replaced. Please use v2 endpoints to find and cancel downtimes.

Examples found in repository?
examples/v1_downtimes_CancelDowntimesByScope.rs (line 13)
7async fn main() {
8    // there is a valid "downtime" in the system
9    let downtime_scope_0 = std::env::var("DOWNTIME_SCOPE_0").unwrap();
10    let body = CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());
11    let configuration = datadog::Configuration::new();
12    let api = DowntimesAPI::with_config(configuration);
13    let resp = api.cancel_downtimes_by_scope(body).await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn cancel_downtimes_by_scope_with_http_info( &self, body: CancelDowntimesByScopeRequest, ) -> Result<ResponseContent<CanceledDowntimesIds>, Error<CancelDowntimesByScopeError>>

Delete all downtimes that match the scope of X. Note: This only interacts with Downtimes created using v1 endpoints. This endpoint has been deprecated and will not be replaced. Please use v2 endpoints to find and cancel downtimes.

Source

pub async fn create_downtime( &self, body: Downtime, ) -> Result<Downtime, Error<CreateDowntimeError>>

Schedule a downtime. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_CreateDowntime_3355644446.rs (line 18)
7async fn main() {
8    // there is a valid "monitor" in the system
9    let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
10    let body = Downtime::new()
11        .message(Some("Example-Downtime".to_string()))
12        .monitor_id(Some(monitor_id.clone()))
13        .scope(vec!["test:exampledowntime".to_string()])
14        .start(1636629071)
15        .timezone("Etc/UTC".to_string());
16    let configuration = datadog::Configuration::new();
17    let api = DowntimesAPI::with_config(configuration);
18    let resp = api.create_downtime(body).await;
19    if let Ok(value) = resp {
20        println!("{:#?}", value);
21    } else {
22        println!("{:#?}", resp.unwrap_err());
23    }
24}
More examples
Hide additional examples
examples/v1_downtimes_CreateDowntime_3059354445.rs (line 28)
10async fn main() {
11    let body = Downtime::new()
12        .end(Some(1636632671))
13        .message(Some("Example-Downtime".to_string()))
14        .monitor_tags(vec!["tag0".to_string()])
15        .mute_first_recovery_notification(true)
16        .notify_end_states(vec![NotifyEndState::ALERT, NotifyEndState::WARN])
17        .notify_end_types(vec![NotifyEndType::EXPIRED])
18        .recurrence(Some(
19            DowntimeRecurrence::new()
20                .period(1)
21                .type_("years".to_string()),
22        ))
23        .scope(vec!["*".to_string()])
24        .start(1636629071)
25        .timezone("Etc/UTC".to_string());
26    let configuration = datadog::Configuration::new();
27    let api = DowntimesAPI::with_config(configuration);
28    let resp = api.create_downtime(body).await;
29    if let Ok(value) = resp {
30        println!("{:#?}", value);
31    } else {
32        println!("{:#?}", resp.unwrap_err());
33    }
34}
examples/v1_downtimes_CreateDowntime_1393233946.rs (line 31)
8async fn main() {
9    let body = Downtime::new()
10        .end(Some(1636632671))
11        .message(Some("Example-Downtime".to_string()))
12        .monitor_tags(vec!["tag0".to_string()])
13        .recurrence(Some(
14            DowntimeRecurrence::new()
15                .period(1)
16                .type_("weeks".to_string())
17                .until_occurrences(Some(3))
18                .week_days(Some(vec![
19                    "Mon".to_string(),
20                    "Tue".to_string(),
21                    "Wed".to_string(),
22                    "Thu".to_string(),
23                    "Fri".to_string(),
24                ])),
25        ))
26        .scope(vec!["*".to_string()])
27        .start(1636629071)
28        .timezone("Etc/UTC".to_string());
29    let configuration = datadog::Configuration::new();
30    let api = DowntimesAPI::with_config(configuration);
31    let resp = api.create_downtime(body).await;
32    if let Ok(value) = resp {
33        println!("{:#?}", value);
34    } else {
35        println!("{:#?}", resp.unwrap_err());
36    }
37}
examples/v1_downtimes_CreateDowntime_2908359488.rs (line 36)
10async fn main() {
11    let body = Downtime::new()
12        .end(Some(1636632671))
13        .message(Some("Example-Downtime".to_string()))
14        .monitor_tags(vec!["tag0".to_string()])
15        .mute_first_recovery_notification(true)
16        .notify_end_states(vec![NotifyEndState::ALERT])
17        .notify_end_types(vec![NotifyEndType::CANCELED])
18        .recurrence(Some(
19            DowntimeRecurrence::new()
20                .period(1)
21                .type_("weeks".to_string())
22                .until_date(Some(1638443471))
23                .week_days(Some(vec![
24                    "Mon".to_string(),
25                    "Tue".to_string(),
26                    "Wed".to_string(),
27                    "Thu".to_string(),
28                    "Fri".to_string(),
29                ])),
30        ))
31        .scope(vec!["*".to_string()])
32        .start(1636629071)
33        .timezone("Etc/UTC".to_string());
34    let configuration = datadog::Configuration::new();
35    let api = DowntimesAPI::with_config(configuration);
36    let resp = api.create_downtime(body).await;
37    if let Ok(value) = resp {
38        println!("{:#?}", value);
39    } else {
40        println!("{:#?}", resp.unwrap_err());
41    }
42}
examples/v1_downtimes_CreateDowntime.rs (line 38)
10async fn main() {
11    let body = Downtime::new()
12        .end(Some(1636632671))
13        .message(Some("Example-Downtime".to_string()))
14        .notify_end_states(vec![
15            NotifyEndState::ALERT,
16            NotifyEndState::NO_DATA,
17            NotifyEndState::WARN,
18        ])
19        .notify_end_types(vec![NotifyEndType::CANCELED, NotifyEndType::EXPIRED])
20        .recurrence(Some(
21            DowntimeRecurrence::new()
22                .period(1)
23                .type_("weeks".to_string())
24                .until_date(Some(1638443471))
25                .week_days(Some(vec![
26                    "Mon".to_string(),
27                    "Tue".to_string(),
28                    "Wed".to_string(),
29                    "Thu".to_string(),
30                    "Fri".to_string(),
31                ])),
32        ))
33        .scope(vec!["test:exampledowntime".to_string()])
34        .start(1636629071)
35        .timezone("Etc/UTC".to_string());
36    let configuration = datadog::Configuration::new();
37    let api = DowntimesAPI::with_config(configuration);
38    let resp = api.create_downtime(body).await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}
Source

pub async fn create_downtime_with_http_info( &self, body: Downtime, ) -> Result<ResponseContent<Downtime>, Error<CreateDowntimeError>>

Schedule a downtime. Note: This endpoint has been deprecated. Please use v2 endpoints.

Source

pub async fn get_downtime( &self, downtime_id: i64, ) -> Result<Downtime, Error<GetDowntimeError>>

Get downtime detail by downtime_id. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_GetDowntime.rs (line 11)
6async fn main() {
7    // there is a valid "downtime" in the system
8    let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = DowntimesAPI::with_config(configuration);
11    let resp = api.get_downtime(downtime_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 get_downtime_with_http_info( &self, downtime_id: i64, ) -> Result<ResponseContent<Downtime>, Error<GetDowntimeError>>

Get downtime detail by downtime_id. Note: This endpoint has been deprecated. Please use v2 endpoints.

Source

pub async fn list_downtimes( &self, params: ListDowntimesOptionalParams, ) -> Result<Vec<Downtime>, Error<ListDowntimesError>>

Get all scheduled downtimes. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_ListDowntimes.rs (line 11)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = DowntimesAPI::with_config(configuration);
10    let resp = api
11        .list_downtimes(ListDowntimesOptionalParams::default().with_creator(true))
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

pub async fn list_downtimes_with_http_info( &self, params: ListDowntimesOptionalParams, ) -> Result<ResponseContent<Vec<Downtime>>, Error<ListDowntimesError>>

Get all scheduled downtimes. Note: This endpoint has been deprecated. Please use v2 endpoints.

Source

pub async fn list_monitor_downtimes( &self, monitor_id: i64, ) -> Result<Vec<Downtime>, Error<ListMonitorDowntimesError>>

Get all active v1 downtimes for the specified monitor. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_ListMonitorDowntimes.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = DowntimesAPI::with_config(configuration);
9    let resp = api.list_monitor_downtimes(9223372036854775807).await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn list_monitor_downtimes_with_http_info( &self, monitor_id: i64, ) -> Result<ResponseContent<Vec<Downtime>>, Error<ListMonitorDowntimesError>>

Get all active v1 downtimes for the specified monitor. Note: This endpoint has been deprecated. Please use v2 endpoints.

Source

pub async fn update_downtime( &self, downtime_id: i64, body: Downtime, ) -> Result<Downtime, Error<UpdateDowntimeError>>

Update a single downtime by downtime_id. Note: This endpoint has been deprecated. Please use v2 endpoints.

Examples found in repository?
examples/v1_downtimes_UpdateDowntime.rs (line 23)
9async fn main() {
10    // there is a valid "downtime" in the system
11    let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
12    let body = Downtime::new()
13        .message(Some("Example-Downtime-updated".to_string()))
14        .mute_first_recovery_notification(true)
15        .notify_end_states(vec![
16            NotifyEndState::ALERT,
17            NotifyEndState::NO_DATA,
18            NotifyEndState::WARN,
19        ])
20        .notify_end_types(vec![NotifyEndType::CANCELED, NotifyEndType::EXPIRED]);
21    let configuration = datadog::Configuration::new();
22    let api = DowntimesAPI::with_config(configuration);
23    let resp = api.update_downtime(downtime_id.clone(), body).await;
24    if let Ok(value) = resp {
25        println!("{:#?}", value);
26    } else {
27        println!("{:#?}", resp.unwrap_err());
28    }
29}
Source

pub async fn update_downtime_with_http_info( &self, downtime_id: i64, body: Downtime, ) -> Result<ResponseContent<Downtime>, Error<UpdateDowntimeError>>

Update a single downtime by downtime_id. Note: This endpoint has been deprecated. Please use v2 endpoints.

Trait Implementations§

Source§

impl Clone for DowntimesAPI

Source§

fn clone(&self) -> DowntimesAPI

Returns a duplicate 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 DowntimesAPI

Source§

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

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

impl Default for DowntimesAPI

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,