Struct datadog_api_client::datadogV1::api::api_downtimes::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.
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
7 8 9 10 11 12 13 14 15 16 17 18
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api
.list_downtimes(ListDowntimesOptionalParams::default().with_creator(true))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime" in the system
let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.get_downtime(downtime_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime" in the system
let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtime(downtime_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "downtime" in the system
let downtime_scope_0 = std::env::var("DOWNTIME_SCOPE_0").unwrap();
let body = CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtimes_by_scope(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn main() {
// there is a valid "monitor" in the system
let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
let body = Downtime::new()
.message(Some("Example-Downtime".to_string()))
.monitor_id(Some(monitor_id.clone()))
.scope(vec!["test:exampledowntime".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime" in the system
let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtime(downtime_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
7 8 9 10 11 12 13 14 15 16 17 18 19
async fn main() {
// there is a valid "downtime" in the system
let downtime_scope_0 = std::env::var("DOWNTIME_SCOPE_0").unwrap();
let body = CancelDowntimesByScopeRequest::new(downtime_scope_0.clone());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtimes_by_scope(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn main() {
// there is a valid "monitor" in the system
let monitor_id: i64 = std::env::var("MONITOR_ID").unwrap().parse().unwrap();
let body = Downtime::new()
.message(Some("Example-Downtime".to_string()))
.monitor_id(Some(monitor_id.clone()))
.scope(vec!["test:exampledowntime".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}More examples
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
async fn main() {
let body = Downtime::new()
.end(Some(1636632671))
.message(Some("Example-Downtime".to_string()))
.monitor_tags(vec!["tag0".to_string()])
.mute_first_recovery_notification(true)
.notify_end_states(vec![NotifyEndState::ALERT, NotifyEndState::WARN])
.notify_end_types(vec![NotifyEndType::EXPIRED])
.recurrence(Some(
DowntimeRecurrence::new()
.period(1)
.type_("years".to_string()),
))
.scope(vec!["*".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
async fn main() {
let body = Downtime::new()
.end(Some(1636632671))
.message(Some("Example-Downtime".to_string()))
.monitor_tags(vec!["tag0".to_string()])
.recurrence(Some(
DowntimeRecurrence::new()
.period(1)
.type_("weeks".to_string())
.until_occurrences(Some(3))
.week_days(Some(vec![
"Mon".to_string(),
"Tue".to_string(),
"Wed".to_string(),
"Thu".to_string(),
"Fri".to_string(),
])),
))
.scope(vec!["*".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
async fn main() {
let body = Downtime::new()
.end(Some(1636632671))
.message(Some("Example-Downtime".to_string()))
.monitor_tags(vec!["tag0".to_string()])
.mute_first_recovery_notification(true)
.notify_end_states(vec![NotifyEndState::ALERT])
.notify_end_types(vec![NotifyEndType::CANCELED])
.recurrence(Some(
DowntimeRecurrence::new()
.period(1)
.type_("weeks".to_string())
.until_date(Some(1638443471))
.week_days(Some(vec![
"Mon".to_string(),
"Tue".to_string(),
"Wed".to_string(),
"Thu".to_string(),
"Fri".to_string(),
])),
))
.scope(vec!["*".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
async fn main() {
let body = Downtime::new()
.end(Some(1636632671))
.message(Some("Example-Downtime".to_string()))
.notify_end_states(vec![
NotifyEndState::ALERT,
NotifyEndState::NO_DATA,
NotifyEndState::WARN,
])
.notify_end_types(vec![NotifyEndType::CANCELED, NotifyEndType::EXPIRED])
.recurrence(Some(
DowntimeRecurrence::new()
.period(1)
.type_("weeks".to_string())
.until_date(Some(1638443471))
.week_days(Some(vec![
"Mon".to_string(),
"Tue".to_string(),
"Wed".to_string(),
"Thu".to_string(),
"Fri".to_string(),
])),
))
.scope(vec!["test:exampledowntime".to_string()])
.start(1636629071)
.timezone("Etc/UTC".to_string());
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.create_downtime(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime" in the system
let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.get_downtime(downtime_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
7 8 9 10 11 12 13 14 15 16 17 18
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api
.list_downtimes(ListDowntimesOptionalParams::default().with_creator(true))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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?
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
async fn main() {
// there is a valid "downtime" in the system
let downtime_id: i64 = std::env::var("DOWNTIME_ID").unwrap().parse().unwrap();
let body = Downtime::new()
.message(Some("Example-Downtime-updated".to_string()))
.mute_first_recovery_notification(true)
.notify_end_states(vec![
NotifyEndState::ALERT,
NotifyEndState::NO_DATA,
NotifyEndState::WARN,
])
.notify_end_types(vec![NotifyEndType::CANCELED, NotifyEndType::EXPIRED]);
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.update_downtime(downtime_id.clone(), body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}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 moresource§impl Debug for DowntimesAPI
impl Debug for DowntimesAPI
Auto Trait Implementations§
impl Freeze for DowntimesAPI
impl !RefUnwindSafe for DowntimesAPI
impl Send for DowntimesAPI
impl Sync for DowntimesAPI
impl Unpin for DowntimesAPI
impl !UnwindSafe for DowntimesAPI
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)