Struct 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

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_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())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
More examples
Hide additional examples
examples/v2_downtimes_ListMonitorDowntimes.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_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
examples/v2_downtimes_CancelDowntime.rs (line 10)
6async fn main() {
7    // there is a valid "downtime_v2" in the system
8    let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = DowntimesAPI::with_config(configuration);
11    let resp = api.cancel_downtime(downtime_v2_data_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v2_downtimes_ListDowntimes_805770330.rs (line 11)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let response =
13        api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
14    pin_mut!(response);
15    while let Some(resp) = response.next().await {
16        if let Ok(value) = resp {
17            println!("{:#?}", value);
18        } else {
19            println!("{:#?}", resp.unwrap_err());
20        }
21    }
22}
examples/v2_downtimes_ListMonitorDowntimes_3316718253.rs (line 11)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let response = api.list_monitor_downtimes_with_pagination(
13        9223372036854775807,
14        ListMonitorDowntimesOptionalParams::default(),
15    );
16    pin_mut!(response);
17    while let Some(resp) = response.next().await {
18        if let Ok(value) = resp {
19            println!("{:#?}", value);
20        } else {
21            println!("{:#?}", resp.unwrap_err());
22        }
23    }
24}
examples/v2_downtimes_GetDowntime.rs (line 11)
7async fn main() {
8    // there is a valid "downtime_v2" in the system
9    let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let resp = api
13        .get_downtime(
14            downtime_v2_data_id.clone(),
15            GetDowntimeOptionalParams::default(),
16        )
17        .await;
18    if let Ok(value) = resp {
19        println!("{:#?}", value);
20    } else {
21        println!("{:#?}", resp.unwrap_err());
22    }
23}
Source

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

Source

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

Cancel a downtime.

Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.

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

Cancel a downtime.

Note: Downtimes canceled through the API are no longer active, but are retained for approximately two days before being permanently removed. The downtime may still appear in search results until it is permanently removed.

Source

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)
14async fn main() {
15    let body = DowntimeCreateRequest::new(DowntimeCreateRequestData::new(
16        DowntimeCreateRequestAttributes::new(
17            DowntimeMonitorIdentifier::DowntimeMonitorIdentifierTags(Box::new(
18                DowntimeMonitorIdentifierTags::new(vec!["cat:hat".to_string()]),
19            )),
20            "test:exampledowntime".to_string(),
21        )
22        .message(Some("dark forest".to_string()))
23        .schedule(
24            DowntimeScheduleCreateRequest::DowntimeScheduleOneTimeCreateUpdateRequest(Box::new(
25                DowntimeScheduleOneTimeCreateUpdateRequest::new().start(None),
26            )),
27        ),
28        DowntimeResourceType::DOWNTIME,
29    ));
30    let configuration = datadog::Configuration::new();
31    let api = DowntimesAPI::with_config(configuration);
32    let resp = api.create_downtime(body).await;
33    if let Ok(value) = resp {
34        println!("{:#?}", value);
35    } else {
36        println!("{:#?}", resp.unwrap_err());
37    }
38}
Source

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

Schedule a downtime.

Source

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)
7async fn main() {
8    // there is a valid "downtime_v2" in the system
9    let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let resp = api
13        .get_downtime(
14            downtime_v2_data_id.clone(),
15            GetDowntimeOptionalParams::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_downtime_with_http_info( &self, downtime_id: String, params: GetDowntimeOptionalParams, ) -> Result<ResponseContent<DowntimeResponse>, Error<GetDowntimeError>>

Get downtime detail by downtime_id.

Source

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)
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())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

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)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let response =
13        api.list_downtimes_with_pagination(ListDowntimesOptionalParams::default().page_limit(2));
14    pin_mut!(response);
15    while let Some(resp) = response.next().await {
16        if let Ok(value) = resp {
17            println!("{:#?}", value);
18        } else {
19            println!("{:#?}", resp.unwrap_err());
20        }
21    }
22}
Source

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

Get all scheduled downtimes.

Source

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)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = DowntimesAPI::with_config(configuration);
10    let resp = api
11        .list_monitor_downtimes(35534610, ListMonitorDowntimesOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

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)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = DowntimesAPI::with_config(configuration);
12    let response = api.list_monitor_downtimes_with_pagination(
13        9223372036854775807,
14        ListMonitorDowntimesOptionalParams::default(),
15    );
16    pin_mut!(response);
17    while let Some(resp) = response.next().await {
18        if let Ok(value) = resp {
19            println!("{:#?}", value);
20        } else {
21            println!("{:#?}", resp.unwrap_err());
22        }
23    }
24}
Source

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.

Source

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)
10async fn main() {
11    // there is a valid "downtime_v2" in the system
12    let downtime_v2_data_id = std::env::var("DOWNTIME_V2_DATA_ID").unwrap();
13    let body = DowntimeUpdateRequest::new(DowntimeUpdateRequestData::new(
14        DowntimeUpdateRequestAttributes::new().message(Some("light speed".to_string())),
15        downtime_v2_data_id.clone(),
16        DowntimeResourceType::DOWNTIME,
17    ));
18    let configuration = datadog::Configuration::new();
19    let api = DowntimesAPI::with_config(configuration);
20    let resp = api.update_downtime(downtime_v2_data_id.clone(), body).await;
21    if let Ok(value) = resp {
22        println!("{:#?}", value);
23    } else {
24        println!("{:#?}", resp.unwrap_err());
25    }
26}
Source

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

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,