aws_sdk_appconfig/
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::deprecated_semver)]
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![forbid(unsafe_code)]
20#![warn(missing_docs)]
21#![cfg_attr(docsrs, feature(doc_cfg))]
22//! AppConfig feature flags and dynamic configurations help software builders quickly and securely adjust application behavior in production environments without full code deployments. AppConfig speeds up software release frequency, improves application resiliency, and helps you address emergent issues more quickly. With feature flags, you can gradually release new capabilities to users and measure the impact of those changes before fully deploying the new capabilities to all users. With operational flags and dynamic configurations, you can update block lists, allow lists, throttling limits, logging verbosity, and perform other operational tuning to quickly respond to issues in production environments.
23//!
24//! Despite the fact that application configuration content can vary greatly from application to application, AppConfig supports the following use cases, which cover a broad spectrum of customer needs:
25//!   - __Feature flags and toggles__ - Safely release new capabilities to your customers in a controlled environment. Instantly roll back changes if you experience a problem.
26//!   - __Application tuning__ - Carefully introduce application changes while testing the impact of those changes with users in production environments.
27//!   - __Allow list or block list__ - Control access to premium features or instantly block specific users without deploying new code.
28//!   - __Centralized configuration storage__ - Keep your configuration data organized and consistent across all of your workloads. You can use AppConfig to deploy configuration data stored in the AppConfig hosted configuration store, Secrets Manager, Systems Manager, Parameter Store, or Amazon S3.
29//!
30//! __How AppConfig works__
31//!
32//! This section provides a high-level description of how AppConfig works and how you get started.
33//!
34//! __1. Identify configuration values in code you want to manage in the cloud__
35//!
36//! Before you start creating AppConfig artifacts, we recommend you identify configuration data in your code that you want to dynamically manage using AppConfig. Good examples include feature flags or toggles, allow and block lists, logging verbosity, service limits, and throttling rules, to name a few. If your configuration data already exists in the cloud, you can take advantage of AppConfig validation, deployment, and extension features to further streamline configuration data management.
37//!
38//! __2. Create an application namespace__
39//!
40//! To create a namespace, you create an AppConfig artifact called an application. An application is simply an organizational construct like a folder.
41//!
42//! __3. Create environments__
43//!
44//! For each AppConfig application, you define one or more environments. An environment is a logical grouping of targets, such as applications in a Beta or Production environment, Lambda functions, or containers. You can also define environments for application subcomponents, such as the Web, Mobile, and Back-end. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.
45//!
46//! __4. Create a configuration profile__
47//!
48//! A configuration profile includes, among other things, a URI that enables AppConfig to locate your configuration data in its stored location and a profile type. AppConfig supports two configuration profile types: feature flags and freeform configurations. Feature flag configuration profiles store their data in the AppConfig hosted configuration store and the URI is simply hosted. For freeform configuration profiles, you can store your data in the AppConfig hosted configuration store or any Amazon Web Services service that integrates with AppConfig, as described in [Creating a free form configuration profile](http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-free-form-configurations-creating.html) in the the _AppConfig User Guide_. A configuration profile can also include optional validators to ensure your configuration data is syntactically and semantically correct. AppConfig performs a check using the validators when you start a deployment. If any errors are detected, the deployment rolls back to the previous configuration data.
49//!
50//! __5. Deploy configuration data__
51//!
52//! When you create a new deployment, you specify the following:   - An application ID
53//!   - A configuration profile ID
54//!   - A configuration version
55//!   - An environment ID where you want to deploy the configuration data
56//!   - A deployment strategy ID that defines how fast you want the changes to take effect
57//! When you call the [StartDeployment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_StartDeployment.html) API action, AppConfig performs the following tasks:   1. Retrieves the configuration data from the underlying data store by using the location URI in the configuration profile.
58//!   1. Verifies the configuration data is syntactically and semantically correct by using the validators you specified when you created your configuration profile.
59//!   1. Caches a copy of the data so it is ready to be retrieved by your application. This cached copy is called the _deployed data_.
60//!
61//!
62//! __6. Retrieve the configuration__
63//!
64//! You can configure AppConfig Agent as a local host and have the agent poll AppConfig for configuration updates. The agent calls the [StartConfigurationSession](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_appconfigdata_StartConfigurationSession.html) and [GetLatestConfiguration](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_appconfigdata_GetLatestConfiguration.html) API actions and caches your configuration data locally. To retrieve the data, your application makes an HTTP call to the localhost server. AppConfig Agent supports several use cases, as described in [Simplified retrieval methods](http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-simplified-methods.html) in the the _AppConfig User Guide_. If AppConfig Agent isn't supported for your use case, you can configure your application to poll AppConfig for configuration updates by directly calling the [StartConfigurationSession](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_appconfigdata_StartConfigurationSession.html) and [GetLatestConfiguration](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_appconfigdata_GetLatestConfiguration.html) API actions.
65//!
66//!
67//! This reference is intended to be used with the [AppConfig User Guide](http://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html).
68//!
69//! ## Getting Started
70//!
71//! > Examples are available for many services and operations, check out the
72//! > [usage examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1).
73//!
74//! The SDK provides one crate per AWS service. You must add [Tokio](https://crates.io/crates/tokio)
75//! as a dependency within your Rust project to execute asynchronous code. To add `aws-sdk-appconfig` to
76//! your project, add the following to your **Cargo.toml** file:
77//!
78//! ```toml
79//! [dependencies]
80//! aws-config = { version = "1.1.7", features = ["behavior-version-latest"] }
81//! aws-sdk-appconfig = "1.96.0"
82//! tokio = { version = "1", features = ["full"] }
83//! ```
84//!
85//! Then in code, a client can be created with the following:
86//!
87//! ```rust,no_run
88//! use aws_sdk_appconfig as appconfig;
89//!
90//! #[::tokio::main]
91//! async fn main() -> Result<(), appconfig::Error> {
92//!     let config = aws_config::load_from_env().await;
93//!     let client = aws_sdk_appconfig::Client::new(&config);
94//!
95//!     // ... make some calls with the client
96//!
97//!     Ok(())
98//! }
99//! ```
100//!
101//! See the [client documentation](https://docs.rs/aws-sdk-appconfig/latest/aws_sdk_appconfig/client/struct.Client.html)
102//! for information on what calls can be made, and the inputs and outputs for each of those calls.
103//!
104//! ## Using the SDK
105//!
106//! Until the SDK is released, we will be adding information about using the SDK to the
107//! [Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html). Feel free to suggest
108//! additional sections for the guide by opening an issue and describing what you are trying to do.
109//!
110//! ## Getting Help
111//!
112//! * [GitHub discussions](https://github.com/awslabs/aws-sdk-rust/discussions) - For ideas, RFCs & general questions
113//! * [GitHub issues](https://github.com/awslabs/aws-sdk-rust/issues/new/choose) - For bug reports & feature requests
114//! * [Generated Docs (latest version)](https://awslabs.github.io/aws-sdk-rust/)
115//! * [Usage examples](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1)
116//!
117//!
118//! # Crate Organization
119//!
120//! The entry point for most customers will be [`Client`], which exposes one method for each API
121//! offered by Amazon AppConfig. The return value of each of these methods is a "fluent builder",
122//! where the different inputs for that API are added by builder-style function call chaining,
123//! followed by calling `send()` to get a [`Future`](std::future::Future) that will result in
124//! either a successful output or a [`SdkError`](crate::error::SdkError).
125//!
126//! Some of these API inputs may be structs or enums to provide more complex structured information.
127//! These structs and enums live in [`types`](crate::types). There are some simpler types for
128//! representing data such as date times or binary blobs that live in [`primitives`](crate::primitives).
129//!
130//! All types required to configure a client via the [`Config`](crate::Config) struct live
131//! in [`config`](crate::config).
132//!
133//! The [`operation`](crate::operation) module has a submodule for every API, and in each submodule
134//! is the input, output, and error type for that API, as well as builders to construct each of those.
135//!
136//! There is a top-level [`Error`](crate::Error) type that encompasses all the errors that the
137//! client can return. Any other error type can be converted to this `Error` type via the
138//! [`From`](std::convert::From) trait.
139//!
140//! The other modules within this crate are not required for normal usage.
141
142// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
143pub use error_meta::Error;
144
145#[doc(inline)]
146pub use config::Config;
147
148/// Client for calling Amazon AppConfig.
149/// ## Constructing a `Client`
150///
151/// A [`Config`] is required to construct a client. For most use cases, the [`aws-config`]
152/// crate should be used to automatically resolve this config using
153/// [`aws_config::load_from_env()`], since this will resolve an [`SdkConfig`] which can be shared
154/// across multiple different AWS SDK clients. This config resolution process can be customized
155/// by calling [`aws_config::from_env()`] instead, which returns a [`ConfigLoader`] that uses
156/// the [builder pattern] to customize the default config.
157///
158/// In the simplest case, creating a client looks as follows:
159/// ```rust,no_run
160/// # async fn wrapper() {
161/// let config = aws_config::load_from_env().await;
162/// let client = aws_sdk_appconfig::Client::new(&config);
163/// # }
164/// ```
165///
166/// Occasionally, SDKs may have additional service-specific values that can be set on the [`Config`] that
167/// is absent from [`SdkConfig`], or slightly different settings for a specific client may be desired.
168/// The [`Builder`](crate::config::Builder) struct implements `From<&SdkConfig>`, so setting these specific settings can be
169/// done as follows:
170///
171/// ```rust,no_run
172/// # async fn wrapper() {
173/// let sdk_config = ::aws_config::load_from_env().await;
174/// let config = aws_sdk_appconfig::config::Builder::from(&sdk_config)
175/// # /*
176///     .some_service_specific_setting("value")
177/// # */
178///     .build();
179/// # }
180/// ```
181///
182/// See the [`aws-config` docs] and [`Config`] for more information on customizing configuration.
183///
184/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should
185/// be done once at application start-up.
186///
187/// [`Config`]: crate::Config
188/// [`ConfigLoader`]: https://docs.rs/aws-config/*/aws_config/struct.ConfigLoader.html
189/// [`SdkConfig`]: https://docs.rs/aws-config/*/aws_config/struct.SdkConfig.html
190/// [`aws-config` docs]: https://docs.rs/aws-config/*
191/// [`aws-config`]: https://crates.io/crates/aws-config
192/// [`aws_config::from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.from_env.html
193/// [`aws_config::load_from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.load_from_env.html
194/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#builders-enable-construction-of-complex-values-c-builder
195/// # Using the `Client`
196///
197/// A client has a function for every operation that can be performed by the service.
198/// For example, the [`CreateApplication`](crate::operation::create_application) operation has
199/// a [`Client::create_application`], function which returns a builder for that operation.
200/// The fluent builder ultimately has a `send()` function that returns an async future that
201/// returns a result, as illustrated below:
202///
203/// ```rust,ignore
204/// let result = client.create_application()
205///     .name("example")
206///     .send()
207///     .await;
208/// ```
209///
210/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
211/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
212/// information.
213/// # Waiters
214///
215/// This client provides `wait_until` methods behind the [`Waiters`](crate::client::Waiters) trait.
216/// To use them, simply import the trait, and then call one of the `wait_until` methods. This will
217/// return a waiter fluent builder that takes various parameters, which are documented on the builder
218/// type. Once parameters have been provided, the `wait` method can be called to initiate waiting.
219///
220/// For example, if there was a `wait_until_thing` method, it could look like:
221/// ```rust,ignore
222/// let result = client.wait_until_thing()
223///     .thing_id("someId")
224///     .wait(Duration::from_secs(120))
225///     .await;
226/// ```
227pub mod client;
228
229/// Configuration for Amazon AppConfig.
230pub mod config;
231
232/// Common errors and error handling utilities.
233pub mod error;
234
235mod error_meta;
236
237/// Information about this crate.
238pub mod meta;
239
240/// All operations that this crate can perform.
241pub mod operation;
242
243/// Primitives such as `Blob` or `DateTime` used by other types.
244pub mod primitives;
245
246/// Data structures used by operation inputs/outputs.
247pub mod types;
248
249pub(crate) mod protocol_serde;
250
251mod sdk_feature_tracker;
252
253mod serialization_settings;
254
255mod endpoint_lib;
256
257mod lens;
258
259/// Supporting types for waiters.
260///
261/// Note: to use waiters, import the [`Waiters`](crate::client::Waiters) trait, which adds methods prefixed with `wait_until` to the client.
262pub mod waiters;
263
264mod json_errors;
265
266mod serde_util;
267
268#[doc(inline)]
269pub use client::Client;