Unverified Commit 2e472d06 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

Make service config just contain a `FrozenLayer` in the orchestrator mode (#2762)

## Motivation and Context
Service config structs now only contain a
`aws_smithy_types::config_bag::FrozenLayer` in the orchestrator mode (no
changes for the middleware mode).

## Description
This PR reduces the individual fields of service configs to contain just
`FrozenLayer`. This makes service configs work more seamlessly with
runtime plugins in the orchestrator mode.

Note that service config _builder_ s still contain individual fields.
We're planning to make them just contain
`aws_smithy_types::config_bag::Layer`. To do that, though, we need to
make `Layer` cloneable and that will be handled in a separate PR. For
builders, the only change you will in the PR is that their `build`
method will put fields into a `Layer`, freeze it, and pass it to service
configs.

This PR is marked as a breaking change because it's based on [another
PR](https://github.com/awslabs/smithy-rs/pull/2728

) that's also breaking
change.

## Testing
- [x] Passed tests in CI

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: default avatarYuki Saito <awsaito@amazon.com>
Co-authored-by: default avatarZelda Hessler <zhessler@amazon.com>
parent b2bdcba5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
allowed_external_types = [
    "aws_smithy_async::rt::sleep::SharedAsyncSleep",
    "aws_smithy_types::config_bag::storable::Storable",
    "aws_smithy_types::config_bag::storable::StoreReplace",
    "aws_smithy_types::config_bag::storable::Storer",
]
+9 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ pub use lazy_caching::Builder as LazyBuilder;
use no_caching::NoCredentialsCache;

use crate::provider::{future, SharedCredentialsProvider};
use aws_smithy_types::config_bag::{Storable, StoreReplace};
use std::sync::Arc;

/// Asynchronous Cached Credentials Provider
@@ -62,6 +63,10 @@ impl ProvideCachedCredentials for SharedCredentialsCache {
    }
}

impl Storable for SharedCredentialsCache {
    type Storer = StoreReplace<SharedCredentialsCache>;
}

#[derive(Clone, Debug)]
pub(crate) enum Inner {
    Lazy(lazy_caching::Builder),
@@ -122,3 +127,7 @@ impl CredentialsCache {
        }
    }
}

impl Storable for CredentialsCache {
    type Storer = StoreReplace<CredentialsCache>;
}
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ construct credentials from hardcoded values.
//! ```

use crate::Credentials;
use aws_smithy_types::config_bag::{Storable, StoreReplace};
use std::sync::Arc;

/// Credentials provider errors
@@ -350,3 +351,7 @@ impl ProvideCredentials for SharedCredentialsProvider {
        self.0.provide_credentials()
    }
}

impl Storable for SharedCredentialsProvider {
    type Storer = StoreReplace<SharedCredentialsProvider>;
}
+4 −1
Original line number Diff line number Diff line
@@ -2,13 +2,16 @@ allowed_external_types = [
    "aws_credential_types::cache::CredentialsCache",
    "aws_credential_types::provider::SharedCredentialsProvider",
    "aws_smithy_async::rt::sleep::SharedAsyncSleep",
    "aws_smithy_async::time::TimeSource",
    "aws_smithy_async::time::SharedTimeSource",
    "aws_smithy_async::time::TimeSource",
    "aws_smithy_client::http_connector",
    "aws_smithy_client::http_connector::HttpConnector",
    "aws_smithy_http::endpoint::Endpoint",
    "aws_smithy_http::endpoint::EndpointPrefix",
    "aws_smithy_http::endpoint::error::InvalidEndpointError",
    "aws_smithy_types::config_bag::storable::Storable",
    "aws_smithy_types::config_bag::storable::StoreReplace",
    "aws_smithy_types::config_bag::storable::Storer",
    "aws_smithy_types::retry::RetryConfig",
    "aws_smithy_types::timeout::TimeoutConfig",
    "http::uri::Uri",
+5 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

//! New-type for a configurable app name.

use aws_smithy_types::config_bag::{Storable, StoreReplace};
use std::borrow::Cow;
use std::error::Error;
use std::fmt;
@@ -38,6 +39,10 @@ impl fmt::Display for AppName {
    }
}

impl Storable for AppName {
    type Storer = StoreReplace<AppName>;
}

impl AppName {
    /// Creates a new app name.
    ///
Loading