Skip to content

Commit

Permalink
[autosync] Timeouts refactor (#1246)
Browse files Browse the repository at this point in the history
* rename: in aws_smithy_types, timeout::TimeoutConfig is now timeout::Config
update: timeout::Config now wraps 3 config structs (Http, Tcp, Api)
update: aws_config timeout setting to work with timeout::Config changes
update: providers to work with new timeout config structure
update: codegen to work with new timeout config structure
update: CHANGELOG.next.toml

* add: missing copyright header

* update: impl From instead of Into for timeout conf
fix: clippy lints

* fix: service config codegen for timeouts

* fix: broken doc tests

* fix: bad doc link

* update: transfer aws_types::Config changes to new aws_types::SdkConfig

* fix: two outdated doc tests

* Apply suggestions from code review

Co-authored-by: John DiSanti <[email protected]>

* undo: doc change for timeout env vars
refactor: move parse_str_as_timeout to aws_config and privatize it
update: aws_config code for parse_str_as_timeout
move
remove: comments from private struct members
update: comments for pub struct methods

Co-authored-by: John DiSanti <[email protected]>
  • Loading branch information
Velfi and jdisanti committed Mar 17, 2022
1 parent 7c26cc0 commit 4affc2a
Show file tree
Hide file tree
Showing 325 changed files with 5,017 additions and 4,502 deletions.
2 changes: 1 addition & 1 deletion .smithyrs-githash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b01f6d1b3635320c14820dd8eaedff0f2d215412
107194f106a736426caccbd158e9fb756584ceb0
27 changes: 14 additions & 13 deletions sdk/accessanalyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pub struct Config {
pub(crate) make_token: crate::idempotency_token::IdempotencyTokenProvider,
app_name: Option<aws_types::app_name::AppName>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::Config>,
pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
pub(crate) retry_config: Option<aws_smithy_types::retry::RetryConfig>,
pub(crate) endpoint_resolver: ::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>,
Expand Down Expand Up @@ -60,7 +60,7 @@ impl Config {
pub struct Builder {
make_token: Option<crate::idempotency_token::IdempotencyTokenProvider>,
app_name: Option<aws_types::app_name::AppName>,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
retry_config: Option<aws_smithy_types::retry::RetryConfig>,
endpoint_resolver: Option<::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>>,
Expand Down Expand Up @@ -104,16 +104,15 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_accessanalyzer::config::Config;
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// let config = Config::builder().timeout_config(timeout_config).build();
/// ```
pub fn timeout_config(
mut self,
timeout_config: aws_smithy_types::timeout::TimeoutConfig,
) -> Self {
pub fn timeout_config(mut self, timeout_config: aws_smithy_types::timeout::Config) -> Self {
self.set_timeout_config(Some(timeout_config));
self
}
Expand All @@ -125,11 +124,13 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_accessanalyzer::config::{Builder, Config};
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// fn set_request_timeout(builder: &mut Builder) {
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_timeout(Some(Duration::from_secs(3)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// builder.set_timeout_config(Some(timeout_config));
/// }
///
Expand All @@ -139,7 +140,7 @@ impl Builder {
/// ```
pub fn set_timeout_config(
&mut self,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
) -> &mut Self {
self.timeout_config = timeout_config;
self
Expand Down
27 changes: 14 additions & 13 deletions sdk/account/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
///
pub struct Config {
app_name: Option<aws_types::app_name::AppName>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::Config>,
pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
pub(crate) retry_config: Option<aws_smithy_types::retry::RetryConfig>,
pub(crate) endpoint_resolver: ::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>,
Expand Down Expand Up @@ -58,7 +58,7 @@ impl Config {
#[derive(Default)]
pub struct Builder {
app_name: Option<aws_types::app_name::AppName>,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
retry_config: Option<aws_smithy_types::retry::RetryConfig>,
endpoint_resolver: Option<::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>>,
Expand Down Expand Up @@ -94,16 +94,15 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_account::config::Config;
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// let config = Config::builder().timeout_config(timeout_config).build();
/// ```
pub fn timeout_config(
mut self,
timeout_config: aws_smithy_types::timeout::TimeoutConfig,
) -> Self {
pub fn timeout_config(mut self, timeout_config: aws_smithy_types::timeout::Config) -> Self {
self.set_timeout_config(Some(timeout_config));
self
}
Expand All @@ -115,11 +114,13 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_account::config::{Builder, Config};
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// fn set_request_timeout(builder: &mut Builder) {
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_timeout(Some(Duration::from_secs(3)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// builder.set_timeout_config(Some(timeout_config));
/// }
///
Expand All @@ -129,7 +130,7 @@ impl Builder {
/// ```
pub fn set_timeout_config(
&mut self,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
) -> &mut Self {
self.timeout_config = timeout_config;
self
Expand Down
27 changes: 14 additions & 13 deletions sdk/acm/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
///
pub struct Config {
app_name: Option<aws_types::app_name::AppName>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::Config>,
pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
pub(crate) retry_config: Option<aws_smithy_types::retry::RetryConfig>,
pub(crate) endpoint_resolver: ::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>,
Expand Down Expand Up @@ -58,7 +58,7 @@ impl Config {
#[derive(Default)]
pub struct Builder {
app_name: Option<aws_types::app_name::AppName>,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
retry_config: Option<aws_smithy_types::retry::RetryConfig>,
endpoint_resolver: Option<::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>>,
Expand Down Expand Up @@ -94,16 +94,15 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_acm::config::Config;
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// let config = Config::builder().timeout_config(timeout_config).build();
/// ```
pub fn timeout_config(
mut self,
timeout_config: aws_smithy_types::timeout::TimeoutConfig,
) -> Self {
pub fn timeout_config(mut self, timeout_config: aws_smithy_types::timeout::Config) -> Self {
self.set_timeout_config(Some(timeout_config));
self
}
Expand All @@ -115,11 +114,13 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_acm::config::{Builder, Config};
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// fn set_request_timeout(builder: &mut Builder) {
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_timeout(Some(Duration::from_secs(3)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// builder.set_timeout_config(Some(timeout_config));
/// }
///
Expand All @@ -129,7 +130,7 @@ impl Builder {
/// ```
pub fn set_timeout_config(
&mut self,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
) -> &mut Self {
self.timeout_config = timeout_config;
self
Expand Down
27 changes: 14 additions & 13 deletions sdk/acmpca/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
///
pub struct Config {
app_name: Option<aws_types::app_name::AppName>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::Config>,
pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
pub(crate) retry_config: Option<aws_smithy_types::retry::RetryConfig>,
pub(crate) endpoint_resolver: ::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>,
Expand Down Expand Up @@ -58,7 +58,7 @@ impl Config {
#[derive(Default)]
pub struct Builder {
app_name: Option<aws_types::app_name::AppName>,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
retry_config: Option<aws_smithy_types::retry::RetryConfig>,
endpoint_resolver: Option<::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>>,
Expand Down Expand Up @@ -94,16 +94,15 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_acmpca::config::Config;
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// let config = Config::builder().timeout_config(timeout_config).build();
/// ```
pub fn timeout_config(
mut self,
timeout_config: aws_smithy_types::timeout::TimeoutConfig,
) -> Self {
pub fn timeout_config(mut self, timeout_config: aws_smithy_types::timeout::Config) -> Self {
self.set_timeout_config(Some(timeout_config));
self
}
Expand All @@ -115,11 +114,13 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_acmpca::config::{Builder, Config};
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// fn set_request_timeout(builder: &mut Builder) {
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_timeout(Some(Duration::from_secs(3)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// builder.set_timeout_config(Some(timeout_config));
/// }
///
Expand All @@ -129,7 +130,7 @@ impl Builder {
/// ```
pub fn set_timeout_config(
&mut self,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
) -> &mut Self {
self.timeout_config = timeout_config;
self
Expand Down
27 changes: 14 additions & 13 deletions sdk/alexaforbusiness/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pub struct Config {
pub(crate) make_token: crate::idempotency_token::IdempotencyTokenProvider,
app_name: Option<aws_types::app_name::AppName>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
pub(crate) timeout_config: Option<aws_smithy_types::timeout::Config>,
pub(crate) sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
pub(crate) retry_config: Option<aws_smithy_types::retry::RetryConfig>,
pub(crate) endpoint_resolver: ::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>,
Expand Down Expand Up @@ -60,7 +60,7 @@ impl Config {
pub struct Builder {
make_token: Option<crate::idempotency_token::IdempotencyTokenProvider>,
app_name: Option<aws_types::app_name::AppName>,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
sleep_impl: Option<std::sync::Arc<dyn aws_smithy_async::rt::sleep::AsyncSleep>>,
retry_config: Option<aws_smithy_types::retry::RetryConfig>,
endpoint_resolver: Option<::std::sync::Arc<dyn aws_endpoint::ResolveAwsEndpoint>>,
Expand Down Expand Up @@ -104,16 +104,15 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_alexaforbusiness::config::Config;
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// let config = Config::builder().timeout_config(timeout_config).build();
/// ```
pub fn timeout_config(
mut self,
timeout_config: aws_smithy_types::timeout::TimeoutConfig,
) -> Self {
pub fn timeout_config(mut self, timeout_config: aws_smithy_types::timeout::Config) -> Self {
self.set_timeout_config(Some(timeout_config));
self
}
Expand All @@ -125,11 +124,13 @@ impl Builder {
/// ```no_run
/// # use std::time::Duration;
/// use aws_sdk_alexaforbusiness::config::{Builder, Config};
/// use aws_smithy_types::timeout::TimeoutConfig;
/// use aws_smithy_types::{timeout, tristate::TriState};
///
/// fn set_request_timeout(builder: &mut Builder) {
/// let timeout_config = TimeoutConfig::new()
/// .with_api_call_timeout(Some(Duration::from_secs(3)));
/// let api_timeouts = timeout::Api::new()
/// .with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
/// let timeout_config = timeout::Config::new()
/// .with_api_timeouts(api_timeouts);
/// builder.set_timeout_config(Some(timeout_config));
/// }
///
Expand All @@ -139,7 +140,7 @@ impl Builder {
/// ```
pub fn set_timeout_config(
&mut self,
timeout_config: Option<aws_smithy_types::timeout::TimeoutConfig>,
timeout_config: Option<aws_smithy_types::timeout::Config>,
) -> &mut Self {
self.timeout_config = timeout_config;
self
Expand Down
Loading

0 comments on commit 4affc2a

Please sign in to comment.