Struct datadog_api_client::datadogV2::api::api_downtimes::DowntimesAPI
source · pub struct DowntimesAPI { /* private fields */ }Expand description
Note: Downtime V2 is currently in private beta. To request access, contact Datadog support.
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?
examples/v2_downtimes_ListDowntimes.rs (line 9)
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())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}More examples
examples/v2_downtimes_ListMonitorDowntimes.rs (line 9)
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_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}examples/v2_downtimes_CancelDowntime.rs (line 10)
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime_v2" in the system
let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtime(downtime_v2_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}examples/v2_downtimes_ListDowntimes_805770330.rs (line 11)
9 10 11 12 13 14 15 16 17 18 19 20 21 22
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let response =
api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}examples/v2_downtimes_ListMonitorDowntimes_3316718253.rs (line 11)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let response = api.list_monitor_downtimes_with_pagination(
9223372036854775807,
ListMonitorDowntimesOptionalParams::default(),
);
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}examples/v2_downtimes_GetDowntime.rs (line 11)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
async fn main() {
// there is a valid "downtime_v2" in the system
let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api
.get_downtime(
downtime_v2_data_id.clone(),
GetDowntimeOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}Additional examples can be found in:
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn cancel_downtime(
&self,
downtime_id: String,
) -> Result<(), Error<CancelDowntimeError>>
pub async fn cancel_downtime( &self, downtime_id: String, ) -> Result<(), Error<CancelDowntimeError>>
Cancel a downtime.
Examples found in repository?
examples/v2_downtimes_CancelDowntime.rs (line 11)
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "downtime_v2" in the system
let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.cancel_downtime(downtime_v2_data_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: String,
) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>
pub async fn cancel_downtime_with_http_info( &self, downtime_id: String, ) -> Result<ResponseContent<()>, Error<CancelDowntimeError>>
Cancel a downtime.
sourcepub async fn create_downtime(
&self,
body: DowntimeCreateRequest,
) -> Result<DowntimeResponse, Error<CreateDowntimeError>>
pub async fn create_downtime( &self, body: DowntimeCreateRequest, ) -> Result<DowntimeResponse, Error<CreateDowntimeError>>
Schedule a downtime.
Examples found in repository?
examples/v2_downtimes_CreateDowntime.rs (line 32)
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
async fn main() {
let body = DowntimeCreateRequest::new(DowntimeCreateRequestData::new(
DowntimeCreateRequestAttributes::new(
DowntimeMonitorIdentifier::DowntimeMonitorIdentifierTags(Box::new(
DowntimeMonitorIdentifierTags::new(vec!["cat:hat".to_string()]),
)),
"test:exampledowntime".to_string(),
)
.message(Some("dark forest".to_string()))
.schedule(
DowntimeScheduleCreateRequest::DowntimeScheduleOneTimeCreateUpdateRequest(Box::new(
DowntimeScheduleOneTimeCreateUpdateRequest::new().start(None),
)),
),
DowntimeResourceType::DOWNTIME,
));
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: DowntimeCreateRequest,
) -> Result<ResponseContent<DowntimeResponse>, Error<CreateDowntimeError>>
pub async fn create_downtime_with_http_info( &self, body: DowntimeCreateRequest, ) -> Result<ResponseContent<DowntimeResponse>, Error<CreateDowntimeError>>
Schedule a downtime.
sourcepub async fn get_downtime(
&self,
downtime_id: String,
params: GetDowntimeOptionalParams,
) -> Result<DowntimeResponse, Error<GetDowntimeError>>
pub async fn get_downtime( &self, downtime_id: String, params: GetDowntimeOptionalParams, ) -> Result<DowntimeResponse, Error<GetDowntimeError>>
Get downtime detail by downtime_id.
Examples found in repository?
examples/v2_downtimes_GetDowntime.rs (lines 13-16)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
async fn main() {
// there is a valid "downtime_v2" in the system
let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api
.get_downtime(
downtime_v2_data_id.clone(),
GetDowntimeOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn get_downtime_with_http_info(
&self,
downtime_id: String,
params: GetDowntimeOptionalParams,
) -> Result<ResponseContent<DowntimeResponse>, Error<GetDowntimeError>>
pub async fn get_downtime_with_http_info( &self, downtime_id: String, params: GetDowntimeOptionalParams, ) -> Result<ResponseContent<DowntimeResponse>, Error<GetDowntimeError>>
Get downtime detail by downtime_id.
sourcepub async fn list_downtimes(
&self,
params: ListDowntimesOptionalParams,
) -> Result<ListDowntimesResponse, Error<ListDowntimesError>>
pub async fn list_downtimes( &self, params: ListDowntimesOptionalParams, ) -> Result<ListDowntimesResponse, Error<ListDowntimesError>>
Get all scheduled downtimes.
Examples found in repository?
examples/v2_downtimes_ListDowntimes.rs (line 11)
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())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn list_downtimes_with_pagination(
&self,
params: ListDowntimesOptionalParams,
) -> impl Stream<Item = Result<DowntimeResponseData, Error<ListDowntimesError>>> + '_
pub fn list_downtimes_with_pagination( &self, params: ListDowntimesOptionalParams, ) -> impl Stream<Item = Result<DowntimeResponseData, Error<ListDowntimesError>>> + '_
Examples found in repository?
examples/v2_downtimes_ListDowntimes_805770330.rs (line 13)
9 10 11 12 13 14 15 16 17 18 19 20 21 22
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let response =
api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
pin_mut!(response);
while let Some(resp) = response.next().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<ListDowntimesResponse>, Error<ListDowntimesError>>
pub async fn list_downtimes_with_http_info( &self, params: ListDowntimesOptionalParams, ) -> Result<ResponseContent<ListDowntimesResponse>, Error<ListDowntimesError>>
Get all scheduled downtimes.
sourcepub async fn list_monitor_downtimes(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> Result<MonitorDowntimeMatchResponse, Error<ListMonitorDowntimesError>>
pub async fn list_monitor_downtimes( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> Result<MonitorDowntimeMatchResponse, Error<ListMonitorDowntimesError>>
Get all active downtimes for the specified monitor.
Examples found in repository?
examples/v2_downtimes_ListMonitorDowntimes.rs (line 11)
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_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn list_monitor_downtimes_with_pagination(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> impl Stream<Item = Result<MonitorDowntimeMatchResponseData, Error<ListMonitorDowntimesError>>> + '_
pub fn list_monitor_downtimes_with_pagination( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> impl Stream<Item = Result<MonitorDowntimeMatchResponseData, Error<ListMonitorDowntimesError>>> + '_
Examples found in repository?
examples/v2_downtimes_ListMonitorDowntimes_3316718253.rs (lines 12-15)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn main() {
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let response = api.list_monitor_downtimes_with_pagination(
9223372036854775807,
ListMonitorDowntimesOptionalParams::default(),
);
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}sourcepub async fn list_monitor_downtimes_with_http_info(
&self,
monitor_id: i64,
params: ListMonitorDowntimesOptionalParams,
) -> Result<ResponseContent<MonitorDowntimeMatchResponse>, Error<ListMonitorDowntimesError>>
pub async fn list_monitor_downtimes_with_http_info( &self, monitor_id: i64, params: ListMonitorDowntimesOptionalParams, ) -> Result<ResponseContent<MonitorDowntimeMatchResponse>, Error<ListMonitorDowntimesError>>
Get all active downtimes for the specified monitor.
sourcepub async fn update_downtime(
&self,
downtime_id: String,
body: DowntimeUpdateRequest,
) -> Result<DowntimeResponse, Error<UpdateDowntimeError>>
pub async fn update_downtime( &self, downtime_id: String, body: DowntimeUpdateRequest, ) -> Result<DowntimeResponse, Error<UpdateDowntimeError>>
Update a downtime by downtime_id.
Examples found in repository?
examples/v2_downtimes_UpdateDowntime.rs (line 20)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn main() {
// there is a valid "downtime_v2" in the system
let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
let body = DowntimeUpdateRequest::new(DowntimeUpdateRequestData::new(
DowntimeUpdateRequestAttributes::new().message(Some("light speed".to_string())),
downtime_v2_data_id.clone(),
DowntimeResourceType::DOWNTIME,
));
let configuration = datadog::Configuration::new();
let api = DowntimesAPI::with_config(configuration);
let resp = api.update_downtime(downtime_v2_data_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: String,
body: DowntimeUpdateRequest,
) -> Result<ResponseContent<DowntimeResponse>, Error<UpdateDowntimeError>>
pub async fn update_downtime_with_http_info( &self, downtime_id: String, body: DowntimeUpdateRequest, ) -> Result<ResponseContent<DowntimeResponse>, Error<UpdateDowntimeError>>
Update a downtime by downtime_id.
Trait Implementations§
source§impl Clone for DowntimesAPI
impl Clone for DowntimesAPI
source§fn clone(&self) -> DowntimesAPI
fn clone(&self) -> DowntimesAPI
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit)