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
impl DowntimesAPI
pub fn new() -> Self
Sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
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}
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}
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}
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}
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}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn cancel_downtime(
&self,
downtime_id: i64,
) -> Result<(), Error<CancelDowntimeError>>
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?
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}
Sourcepub async fn cancel_downtime_with_http_info(
&self,
downtime_id: i64,
) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>
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.
Sourcepub async fn cancel_downtimes_by_scope(
&self,
body: CancelDowntimesByScopeRequest,
) -> Result<CanceledDowntimesIds, Error<CancelDowntimesByScopeError>>
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?
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}
Sourcepub async fn cancel_downtimes_by_scope_with_http_info(
&self,
body: CancelDowntimesByScopeRequest,
) -> Result<ResponseContent<CanceledDowntimesIds>, Error<CancelDowntimesByScopeError>>
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.
Sourcepub async fn create_downtime(
&self,
body: Downtime,
) -> Result<Downtime, Error<CreateDowntimeError>>
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?
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
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}
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}
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}
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}
Sourcepub async fn create_downtime_with_http_info(
&self,
body: Downtime,
) -> Result<ResponseContent<Downtime>, Error<CreateDowntimeError>>
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.
Sourcepub async fn get_downtime(
&self,
downtime_id: i64,
) -> Result<Downtime, Error<GetDowntimeError>>
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?
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}
Sourcepub async fn get_downtime_with_http_info(
&self,
downtime_id: i64,
) -> Result<ResponseContent<Downtime>, Error<GetDowntimeError>>
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.
Sourcepub async fn list_downtimes(
&self,
params: ListDowntimesOptionalParams,
) -> Result<Vec<Downtime>, Error<ListDowntimesError>>
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?
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}
Sourcepub async fn list_downtimes_with_http_info(
&self,
params: ListDowntimesOptionalParams,
) -> Result<ResponseContent<Vec<Downtime>>, Error<ListDowntimesError>>
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.
Sourcepub async fn list_monitor_downtimes(
&self,
monitor_id: i64,
) -> Result<Vec<Downtime>, Error<ListMonitorDowntimesError>>
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.
Sourcepub async fn list_monitor_downtimes_with_http_info(
&self,
monitor_id: i64,
) -> Result<ResponseContent<Vec<Downtime>>, Error<ListMonitorDowntimesError>>
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.
Sourcepub async fn update_downtime(
&self,
downtime_id: i64,
body: Downtime,
) -> Result<Downtime, Error<UpdateDowntimeError>>
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?
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}
Sourcepub async fn update_downtime_with_http_info(
&self,
downtime_id: i64,
body: Downtime,
) -> Result<ResponseContent<Downtime>, Error<UpdateDowntimeError>>
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
impl Clone for DowntimesAPI
Source§fn clone(&self) -> DowntimesAPI
fn clone(&self) -> DowntimesAPI
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more