pub struct HostsAPI { /* private fields */ }
Expand description
Get information about your infrastructure hosts in Datadog, and mute or unmute any notifications from your hosts. See the Infrastructure page for more information.
Implementations§
Source§impl HostsAPI
impl HostsAPI
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 = HostsAPI::with_config(configuration);
10 let resp = api
11 .get_host_totals(GetHostTotalsOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().filter("env:ci".to_string()))
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().include_hosts_metadata(true))
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().include_hosts_metadata(true))
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let body = HostMuteSettings::new()
9 .end(1579098130)
10 .message("Muting this host for a test!".to_string())
11 .override_(false);
12 let configuration = datadog::Configuration::new();
13 let api = HostsAPI::with_config(configuration);
14 let resp = api.mute_host("host_name".to_string(), body).await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
Sourcepub async fn get_host_totals(
&self,
params: GetHostTotalsOptionalParams,
) -> Result<HostTotals, Error<GetHostTotalsError>>
pub async fn get_host_totals( &self, params: GetHostTotalsOptionalParams, ) -> Result<HostTotals, Error<GetHostTotalsError>>
This endpoint returns the total number of active and up hosts in your Datadog account. Active means the host has reported in the past hour, and up means it has reported in the past two hours.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .get_host_totals(GetHostTotalsOptionalParams::default())
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
Sourcepub async fn get_host_totals_with_http_info(
&self,
params: GetHostTotalsOptionalParams,
) -> Result<ResponseContent<HostTotals>, Error<GetHostTotalsError>>
pub async fn get_host_totals_with_http_info( &self, params: GetHostTotalsOptionalParams, ) -> Result<ResponseContent<HostTotals>, Error<GetHostTotalsError>>
This endpoint returns the total number of active and up hosts in your Datadog account. Active means the host has reported in the past hour, and up means it has reported in the past two hours.
Sourcepub async fn list_hosts(
&self,
params: ListHostsOptionalParams,
) -> Result<HostListResponse, Error<ListHostsError>>
pub async fn list_hosts( &self, params: ListHostsOptionalParams, ) -> Result<HostListResponse, Error<ListHostsError>>
This endpoint allows searching for hosts by name, alias, or tag.
Hosts live within the past 3 hours are included by default.
Retention is 7 days.
Results are paginated with a max of 1000 results at a time.
Note: If the host is an Amazon EC2 instance, id
is replaced with aws_id
in the response.
Examples found in repository?
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().filter("env:ci".to_string()))
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
More examples
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().include_hosts_metadata(true))
12 .await;
13 if let Ok(value) = resp {
14 println!("{:#?}", value);
15 } else {
16 println!("{:#?}", resp.unwrap_err());
17 }
18}
7async fn main() {
8 let configuration = datadog::Configuration::new();
9 let api = HostsAPI::with_config(configuration);
10 let resp = api
11 .list_hosts(ListHostsOptionalParams::default().include_hosts_metadata(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_hosts_with_http_info(
&self,
params: ListHostsOptionalParams,
) -> Result<ResponseContent<HostListResponse>, Error<ListHostsError>>
pub async fn list_hosts_with_http_info( &self, params: ListHostsOptionalParams, ) -> Result<ResponseContent<HostListResponse>, Error<ListHostsError>>
This endpoint allows searching for hosts by name, alias, or tag.
Hosts live within the past 3 hours are included by default.
Retention is 7 days.
Results are paginated with a max of 1000 results at a time.
Note: If the host is an Amazon EC2 instance, id
is replaced with aws_id
in the response.
Sourcepub async fn mute_host(
&self,
host_name: String,
body: HostMuteSettings,
) -> Result<HostMuteResponse, Error<MuteHostError>>
pub async fn mute_host( &self, host_name: String, body: HostMuteSettings, ) -> Result<HostMuteResponse, Error<MuteHostError>>
Mute a host. Note: This creates a Downtime V2 for the host.
Examples found in repository?
7async fn main() {
8 let body = HostMuteSettings::new()
9 .end(1579098130)
10 .message("Muting this host for a test!".to_string())
11 .override_(false);
12 let configuration = datadog::Configuration::new();
13 let api = HostsAPI::with_config(configuration);
14 let resp = api.mute_host("host_name".to_string(), body).await;
15 if let Ok(value) = resp {
16 println!("{:#?}", value);
17 } else {
18 println!("{:#?}", resp.unwrap_err());
19 }
20}
Sourcepub async fn mute_host_with_http_info(
&self,
host_name: String,
body: HostMuteSettings,
) -> Result<ResponseContent<HostMuteResponse>, Error<MuteHostError>>
pub async fn mute_host_with_http_info( &self, host_name: String, body: HostMuteSettings, ) -> Result<ResponseContent<HostMuteResponse>, Error<MuteHostError>>
Mute a host. Note: This creates a Downtime V2 for the host.
Sourcepub async fn unmute_host(
&self,
host_name: String,
) -> Result<HostMuteResponse, Error<UnmuteHostError>>
pub async fn unmute_host( &self, host_name: String, ) -> Result<HostMuteResponse, Error<UnmuteHostError>>
Unmutes a host. This endpoint takes no JSON arguments.
Sourcepub async fn unmute_host_with_http_info(
&self,
host_name: String,
) -> Result<ResponseContent<HostMuteResponse>, Error<UnmuteHostError>>
pub async fn unmute_host_with_http_info( &self, host_name: String, ) -> Result<ResponseContent<HostMuteResponse>, Error<UnmuteHostError>>
Unmutes a host. This endpoint takes no JSON arguments.