Skip to main content

aws_sdk_cloudwatch/
lib.rs

1#![allow(deprecated)]
2#![allow(unknown_lints)]
3#![allow(clippy::module_inception)]
4#![allow(clippy::upper_case_acronyms)]
5#![allow(clippy::large_enum_variant)]
6#![allow(clippy::wrong_self_convention)]
7#![allow(clippy::should_implement_trait)]
8#![allow(clippy::disallowed_names)]
9#![allow(clippy::vec_init_then_push)]
10#![allow(clippy::type_complexity)]
11#![allow(clippy::needless_return)]
12#![allow(clippy::derive_partial_eq_without_eq)]
13#![allow(clippy::result_large_err)]
14#![allow(clippy::unnecessary_map_on_constructor)]
15#![allow(clippy::useless_conversion)]
16#![allow(clippy::deprecated_semver)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::redundant_explicit_links)]
19#![allow(rustdoc::broken_intra_doc_links)]
20#![allow(rustdoc::invalid_html_tags)]
21#![forbid(unsafe_code)]
22#![warn(missing_docs)]
23#![cfg_attr(docsrs, feature(doc_cfg))]
24//! Amazon CloudWatch enables you to publish, monitor, and manage various metrics, as well as configure alarm actions based on data from metrics. This guide provides detailed information about CloudWatch actions, data types, parameters, and errors. For more information about CloudWatch features, see [Amazon CloudWatch](https://aws.amazon.com/cloudwatch) and the _Amazon CloudWatch User Guide_.
25//!
26//! For information about the metrics that other Amazon Web Services products send to CloudWatch, see the [Amazon CloudWatch Metrics and Dimensions Reference](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) in the _Amazon CloudWatch User Guide_.
27//!
28//! Use the following links to get started using the CloudWatch Query API:
29//!
30//! : An alphabetical list of all CloudWatch actions.
31//!
32//! : An alphabetical list of all CloudWatch data types.
33//!
34//! CommonParameters: Parameters that all Query actions can use.
35//!
36//! CommonErrors: Client and server errors that all actions can return.
37//!
38//! [Regions and Endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html#cw_region): Supported regions and endpoints for all Amazon Web Services products.
39//!
40//! Alternatively, you can use one of the [Amazon Web Services SDKs](https://aws.amazon.com/tools/#sdk) to access CloudWatch using an API tailored to your programming language or platform.
41//!
42//! Developers in the Amazon Web Services developer community also provide their own libraries, which you can find at the following Amazon Web Services developer centers:
43//!
44//! [Java Developer Center](http://aws.amazon.com/java/)
45//!
46//! [JavaScript Developer Center](http://aws.amazon.com/javascript/)
47//!
48//! [Amazon Web Services Mobile Services](http://aws.amazon.com/mobile/)
49//!
50//! [PHP Developer Center](http://aws.amazon.com/php/)
51//!
52//! [Python Developer Center](http://aws.amazon.com/python/)
53//!
54//! [Ruby Developer Center](http://aws.amazon.com/ruby/)
55//!
56//! [Windows and .NET Developer Center](http://aws.amazon.com/net/)
57//!
58//! ## Getting Started
59//!
60//! > Examples are available for many services and operations, check out the
61//! > [usage examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1).
62//!
63//! The SDK provides one crate per AWS service. You must add [Tokio](https://crates.io/crates/tokio)
64//! as a dependency within your Rust project to execute asynchronous code. To add `aws-sdk-cloudwatch` to
65//! your project, add the following to your **Cargo.toml** file:
66//!
67//! ```toml
68//! [dependencies]
69//! aws-config = { version = "1.1.7", features = ["behavior-version-latest"] }
70//! aws-sdk-cloudwatch = "1.128.0"
71//! tokio = { version = "1", features = ["full"] }
72//! ```
73//!
74//! Then in code, a client can be created with the following:
75//!
76//! ```rust,no_run
77//! use aws_sdk_cloudwatch as cloudwatch;
78//!
79//! #[::tokio::main]
80//! async fn main() -> Result<(), cloudwatch::Error> {
81//!     let config = aws_config::load_from_env().await;
82//!     let client = aws_sdk_cloudwatch::Client::new(&config);
83//!
84//!     // ... make some calls with the client
85//!
86//!     Ok(())
87//! }
88//! ```
89//!
90//! See the [client documentation](https://docs.rs/aws-sdk-cloudwatch/latest/aws_sdk_cloudwatch/client/struct.Client.html)
91//! for information on what calls can be made, and the inputs and outputs for each of those calls.
92//!
93//! ## Using the SDK
94//!
95//! Until the SDK is released, we will be adding information about using the SDK to the
96//! [Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html). Feel free to suggest
97//! additional sections for the guide by opening an issue and describing what you are trying to do.
98//!
99//! ## Getting Help
100//!
101//! * [GitHub discussions](https://github.com/awslabs/aws-sdk-rust/discussions) - For ideas, RFCs & general questions
102//! * [GitHub issues](https://github.com/awslabs/aws-sdk-rust/issues/new/choose) - For bug reports & feature requests
103//! * [Generated Docs (latest version)](https://awslabs.github.io/aws-sdk-rust/)
104//! * [Usage examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1)
105//!
106//!
107//! # Crate Organization
108//!
109//! The entry point for most customers will be [`Client`], which exposes one method for each API
110//! offered by Amazon CloudWatch. The return value of each of these methods is a "fluent builder",
111//! where the different inputs for that API are added by builder-style function call chaining,
112//! followed by calling `send()` to get a [`Future`](std::future::Future) that will result in
113//! either a successful output or a [`SdkError`](crate::error::SdkError).
114//!
115//! Some of these API inputs may be structs or enums to provide more complex structured information.
116//! These structs and enums live in [`types`](crate::types). There are some simpler types for
117//! representing data such as date times or binary blobs that live in [`primitives`](crate::primitives).
118//!
119//! All types required to configure a client via the [`Config`](crate::Config) struct live
120//! in [`config`](crate::config).
121//!
122//! The [`operation`](crate::operation) module has a submodule for every API, and in each submodule
123//! is the input, output, and error type for that API, as well as builders to construct each of those.
124//!
125//! There is a top-level [`Error`](crate::Error) type that encompasses all the errors that the
126//! client can return. Any other error type can be converted to this `Error` type via the
127//! [`From`](std::convert::From) trait.
128//!
129//! The other modules within this crate are not required for normal usage.
130
131// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
132pub use error_meta::Error;
133
134#[doc(inline)]
135pub use config::Config;
136
137/// Client for calling Amazon CloudWatch.
138/// ## Constructing a `Client`
139///
140/// A [`Config`] is required to construct a client. For most use cases, the [`aws-config`]
141/// crate should be used to automatically resolve this config using
142/// [`aws_config::load_from_env()`], since this will resolve an [`SdkConfig`] which can be shared
143/// across multiple different AWS SDK clients. This config resolution process can be customized
144/// by calling [`aws_config::from_env()`] instead, which returns a [`ConfigLoader`] that uses
145/// the [builder pattern] to customize the default config.
146///
147/// In the simplest case, creating a client looks as follows:
148/// ```rust,no_run
149/// # async fn wrapper() {
150/// let config = aws_config::load_from_env().await;
151/// let client = aws_sdk_cloudwatch::Client::new(&config);
152/// # }
153/// ```
154///
155/// Occasionally, SDKs may have additional service-specific values that can be set on the [`Config`] that
156/// is absent from [`SdkConfig`], or slightly different settings for a specific client may be desired.
157/// The [`Builder`](crate::config::Builder) struct implements `From<&SdkConfig>`, so setting these specific settings can be
158/// done as follows:
159///
160/// ```rust,no_run
161/// # async fn wrapper() {
162/// let sdk_config = ::aws_config::load_from_env().await;
163/// let config = aws_sdk_cloudwatch::config::Builder::from(&sdk_config)
164/// # /*
165///     .some_service_specific_setting("value")
166/// # */
167///     .build();
168/// # }
169/// ```
170///
171/// See the [`aws-config` docs] and [`Config`] for more information on customizing configuration.
172///
173/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should
174/// be done once at application start-up.
175///
176/// [`Config`]: crate::Config
177/// [`ConfigLoader`]: https://docs.rs/aws-config/*/aws_config/struct.ConfigLoader.html
178/// [`SdkConfig`]: https://docs.rs/aws-config/*/aws_config/struct.SdkConfig.html
179/// [`aws-config` docs]: https://docs.rs/aws-config/*
180/// [`aws-config`]: https://crates.io/crates/aws-config
181/// [`aws_config::from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.from_env.html
182/// [`aws_config::load_from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.load_from_env.html
183/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#builders-enable-construction-of-complex-values-c-builder
184/// # Using the `Client`
185///
186/// A client has a function for every operation that can be performed by the service.
187/// For example, the [`AssociateDatasetKmsKey`](crate::operation::associate_dataset_kms_key) operation has
188/// a [`Client::associate_dataset_kms_key`], function which returns a builder for that operation.
189/// The fluent builder ultimately has a `send()` function that returns an async future that
190/// returns a result, as illustrated below:
191///
192/// ```rust,ignore
193/// let result = client.associate_dataset_kms_key()
194///     .dataset_identifier("example")
195///     .send()
196///     .await;
197/// ```
198///
199/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
200/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
201/// information.
202/// # Waiters
203///
204/// This client provides `wait_until` methods behind the [`Waiters`](crate::client::Waiters) trait.
205/// To use them, simply import the trait, and then call one of the `wait_until` methods. This will
206/// return a waiter fluent builder that takes various parameters, which are documented on the builder
207/// type. Once parameters have been provided, the `wait` method can be called to initiate waiting.
208///
209/// For example, if there was a `wait_until_thing` method, it could look like:
210/// ```rust,ignore
211/// let result = client.wait_until_thing()
212///     .thing_id("someId")
213///     .wait(Duration::from_secs(120))
214///     .await;
215/// ```
216pub mod client;
217
218/// Configuration for Amazon CloudWatch.
219pub mod config;
220
221/// Common errors and error handling utilities.
222pub mod error;
223
224mod error_meta;
225
226/// Information about this crate.
227pub mod meta;
228
229/// All operations that this crate can perform.
230pub mod operation;
231
232/// Primitives such as `Blob` or `DateTime` used by other types.
233pub mod primitives;
234
235/// Data structures used by operation inputs/outputs.
236pub mod types;
237
238mod client_request_compression;
239
240mod observability_feature;
241
242pub(crate) mod protocol_serde;
243
244mod sdk_feature_tracker;
245
246mod serialization_settings;
247
248mod endpoint_lib;
249
250mod lens;
251
252mod serde_util;
253
254/// Supporting types for waiters.
255///
256/// Note: to use waiters, import the [`Waiters`](crate::client::Waiters) trait, which adds methods prefixed with `wait_until` to the client.
257pub mod waiters;
258
259mod aws_query_compatible_errors;
260
261mod cbor_errors;
262
263#[doc(inline)]
264pub use client::Client;