Skip to content

Commit

Permalink
Rename orchestrator traits to be verbs (#3065)
Browse files Browse the repository at this point in the history
This PR makes the orchestrator traits more idiomatic by making them
verbs.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
  • Loading branch information
jdisanti authored Oct 13, 2023
1 parent d6a1bef commit 63ce3f9
Show file tree
Hide file tree
Showing 55 changed files with 251 additions and 208 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ author = "Velfi"
[[aws-sdk-rust]]
message = "The future return types on traits `EndpointResolver` and `IdentityResolver` changed to new-types `EndpointFuture` and `IdentityFuture` respectively."
references = ["smithy-rs#3055"]
meta = { "breaking" = true, "tada" = true, "bug" = true }
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

[[smithy-rs]]
Expand Down Expand Up @@ -355,3 +355,26 @@ message = "Lifetimes have been added to the `EndpointResolver` trait."
references = ["smithy-rs#3061"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
author = "jdisanti"

[[aws-sdk-rust]]
message = """Several traits have been renamed from noun form to verb form to be more idiomatic:
- `EndpointResolver` -> `ResolveEndpoint`
- `Interceptor` -> `Intercept`
"""
references = ["smithy-rs#3065"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "jdisanti"

[[smithy-rs]]
message = """Several traits have been renamed from noun form to verb form to be more idiomatic:
- `AuthSchemeOptionResolver` -> `ResolveAuthSchemeOptions`
- `EndpointResolver` -> `ResolveEndpoint`
- `IdentityResolver` -> `ResolveIdentity`
- `Signer` -> `Sign`
- `RequestSerializer` -> `SerializeRequest`
- `ResponseDeserializer` -> `DeserializeResponse`
- `Interceptor` -> `Intercept`
"""
references = ["smithy-rs#3065"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
author = "jdisanti"
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-config/src/imds/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use aws_smithy_runtime::client::orchestrator::operation::Operation;
use aws_smithy_runtime::client::retries::strategy::StandardRetryStrategy;
use aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams;
use aws_smithy_runtime_api::client::endpoint::{
EndpointFuture, EndpointResolver, EndpointResolverParams,
EndpointFuture, EndpointResolverParams, ResolveEndpoint,
};
use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
use aws_smithy_runtime_api::client::orchestrator::{OrchestratorError, SensitiveOutput};
Expand Down Expand Up @@ -523,7 +523,7 @@ struct ImdsEndpointResolver {
mode_override: Option<EndpointMode>,
}

impl EndpointResolver for ImdsEndpointResolver {
impl ResolveEndpoint for ImdsEndpointResolver {
fn resolve_endpoint<'a>(&'a self, _: &'a EndpointResolverParams) -> EndpointFuture<'a> {
EndpointFuture::new(async move {
self.endpoint_source
Expand Down
10 changes: 5 additions & 5 deletions aws/rust-runtime/aws-config/src/imds/client/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use aws_smithy_runtime::client::orchestrator::operation::Operation;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolver;
use aws_smithy_runtime_api::client::auth::{
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Signer,
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Sign,
};
use aws_smithy_runtime_api::client::identity::{
Identity, IdentityFuture, IdentityResolver, SharedIdentityResolver,
Identity, IdentityFuture, ResolveIdentity, SharedIdentityResolver,
};
use aws_smithy_runtime_api::client::orchestrator::{HttpRequest, HttpResponse, OrchestratorError};
use aws_smithy_runtime_api::client::runtime_components::{
Expand Down Expand Up @@ -191,7 +191,7 @@ fn parse_token_response(response: &HttpResponse, now: SystemTime) -> Result<Toke
})
}

impl IdentityResolver for TokenResolver {
impl ResolveIdentity for TokenResolver {
fn resolve_identity<'a>(&'a self, _config_bag: &'a ConfigBag) -> IdentityFuture<'a> {
IdentityFuture::new(async {
let preloaded_token = self
Expand Down Expand Up @@ -240,15 +240,15 @@ impl AuthScheme for TokenAuthScheme {
identity_resolvers.identity_resolver(IMDS_TOKEN_AUTH_SCHEME)
}

fn signer(&self) -> &dyn Signer {
fn signer(&self) -> &dyn Sign {
&self.signer
}
}

#[derive(Debug)]
struct TokenSigner;

impl Signer for TokenSigner {
impl Sign for TokenSigner {
fn sign_http_request(
&self,
request: &mut HttpRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::ConfigBag;
use http::header::ACCEPT;
Expand All @@ -17,7 +17,7 @@ use http::HeaderValue;
#[derive(Debug, Default)]
pub(crate) struct AcceptHeaderInterceptor;

impl Interceptor for AcceptHeaderInterceptor {
impl Intercept for AcceptHeaderInterceptor {
fn name(&self) -> &'static str {
"AcceptHeaderInterceptor"
}
Expand Down
8 changes: 4 additions & 4 deletions aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::{
BeforeSerializationInterceptorContextMut, BeforeTransmitInterceptorContextMut,
};
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::orchestrator::LoadedRequestBody;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::ConfigBag;
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<I> GlacierAccountIdAutofillInterceptor<I> {
}
}

impl<I: GlacierAccountId + Send + Sync + 'static> Interceptor
impl<I: GlacierAccountId + Send + Sync + 'static> Intercept
for GlacierAccountIdAutofillInterceptor<I>
{
fn name(&self) -> &'static str {
Expand Down Expand Up @@ -100,7 +100,7 @@ impl GlacierApiVersionInterceptor {
}
}

impl Interceptor for GlacierApiVersionInterceptor {
impl Intercept for GlacierApiVersionInterceptor {
fn name(&self) -> &'static str {
"GlacierApiVersionInterceptor"
}
Expand All @@ -123,7 +123,7 @@ impl Interceptor for GlacierApiVersionInterceptor {
#[derive(Debug, Default)]
pub(crate) struct GlacierTreeHashHeaderInterceptor;

impl Interceptor for GlacierTreeHashHeaderInterceptor {
impl Intercept for GlacierTreeHashHeaderInterceptor {
fn name(&self) -> &'static str {
"GlacierTreeHashHeaderInterceptor"
}
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::{
BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, Input,
};
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace};
use http::HeaderValue;
Expand Down Expand Up @@ -75,7 +75,7 @@ impl<AP> RequestChecksumInterceptor<AP> {
}
}

impl<AP> Interceptor for RequestChecksumInterceptor<AP>
impl<AP> Intercept for RequestChecksumInterceptor<AP>
where
AP: Fn(&Input) -> Result<Option<ChecksumAlgorithm>, BoxError> + Send + Sync,
{
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-inlineable/src/http_response_checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::{
BeforeDeserializationInterceptorContextMut, BeforeSerializationInterceptorContextRef, Input,
};
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace};
use http::HeaderValue;
Expand Down Expand Up @@ -52,7 +52,7 @@ impl<VE> ResponseChecksumInterceptor<VE> {
}
}

impl<VE> Interceptor for ResponseChecksumInterceptor<VE>
impl<VE> Intercept for ResponseChecksumInterceptor<VE>
where
VE: Fn(&Input) -> bool + Send + Sync,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use aws_smithy_runtime_api::client::interceptors::context::{
BeforeSerializationInterceptorContextMut, BeforeTransmitInterceptorContextMut,
};
use aws_smithy_runtime_api::client::interceptors::{
disable_interceptor, Interceptor, SharedInterceptor,
disable_interceptor, Intercept, SharedInterceptor,
};
use aws_smithy_runtime_api::client::retries::SharedRetryStrategy;
use aws_smithy_runtime_api::client::runtime_components::{
Expand All @@ -46,7 +46,7 @@ impl SigV4PresigningInterceptor {
}
}

impl Interceptor for SigV4PresigningInterceptor {
impl Intercept for SigV4PresigningInterceptor {
fn name(&self) -> &'static str {
"SigV4PresigningInterceptor"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::ConfigBag;
use std::fmt;
Expand Down Expand Up @@ -67,7 +67,7 @@ where
}
}

impl<G, T> Interceptor for Route53ResourceIdInterceptor<G, T>
impl<G, T> Intercept for Route53ResourceIdInterceptor<G, T>
where
G: for<'a> Fn(&'a mut T) -> &'a mut Option<String> + Send + Sync,
T: fmt::Debug + Send + Sync + 'static,
Expand Down
6 changes: 3 additions & 3 deletions aws/rust-runtime/aws-runtime/src/auth/sigv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use aws_sigv4::http_request::{
use aws_sigv4::sign::v4;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::auth::{
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Signer,
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Sign,
};
use aws_smithy_runtime_api::client::identity::{Identity, SharedIdentityResolver};
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
Expand Down Expand Up @@ -56,7 +56,7 @@ impl AuthScheme for SigV4AuthScheme {
identity_resolvers.identity_resolver(self.scheme_id())
}

fn signer(&self) -> &dyn Signer {
fn signer(&self) -> &dyn Sign {
&self.signer
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ impl SigV4Signer {
}
}

impl Signer for SigV4Signer {
impl Sign for SigV4Signer {
fn sign_http_request(
&self,
request: &mut HttpRequest,
Expand Down
6 changes: 3 additions & 3 deletions aws/rust-runtime/aws-runtime/src/auth/sigv4a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use aws_sigv4::http_request::{sign, SignableBody, SignableRequest, SigningSettin
use aws_sigv4::sign::v4a;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::auth::{
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Signer,
AuthScheme, AuthSchemeEndpointConfig, AuthSchemeId, Sign,
};
use aws_smithy_runtime_api::client::identity::{Identity, SharedIdentityResolver};
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
Expand Down Expand Up @@ -53,7 +53,7 @@ impl AuthScheme for SigV4aAuthScheme {
identity_resolvers.identity_resolver(self.scheme_id())
}

fn signer(&self) -> &dyn Signer {
fn signer(&self) -> &dyn Sign {
&self.signer
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ fn extract_endpoint_auth_scheme_signing_region_set(
}
}

impl Signer for SigV4aSigner {
impl Sign for SigV4aSigner {
fn sign_http_request(
&self,
request: &mut HttpRequest,
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-runtime/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// Credentials-based identity support.
pub mod credentials {
use aws_credential_types::cache::SharedCredentialsCache;
use aws_smithy_runtime_api::client::identity::{Identity, IdentityFuture, IdentityResolver};
use aws_smithy_runtime_api::client::identity::{Identity, IdentityFuture, ResolveIdentity};
use aws_smithy_types::config_bag::ConfigBag;

/// Smithy identity resolver for AWS credentials.
Expand All @@ -22,7 +22,7 @@ pub mod credentials {
}
}

impl IdentityResolver for CredentialsIdentityResolver {
impl ResolveIdentity for CredentialsIdentityResolver {
fn resolve_identity<'a>(&'a self, _config_bag: &'a ConfigBag) -> IdentityFuture<'a> {
let cache = self.credentials_cache.clone();
IdentityFuture::new(async move {
Expand Down
6 changes: 3 additions & 3 deletions aws/rust-runtime/aws-runtime/src/invocation_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::{ConfigBag, Storable, StoreReplace};
use fastrand::Rng;
Expand Down Expand Up @@ -92,7 +92,7 @@ impl InvocationIdInterceptor {
}
}

impl Interceptor for InvocationIdInterceptor {
impl Intercept for InvocationIdInterceptor {
fn name(&self) -> &'static str {
"InvocationIdInterceptor"
}
Expand Down Expand Up @@ -217,7 +217,7 @@ mod tests {
use aws_smithy_runtime_api::client::interceptors::context::{
BeforeTransmitInterceptorContextMut, Input, InterceptorContext,
};
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
use aws_smithy_types::config_bag::ConfigBag;
use http::HeaderValue;
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-runtime/src/recursion_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::ConfigBag;
use aws_types::os_shim_internal::Env;
Expand Down Expand Up @@ -39,7 +39,7 @@ impl RecursionDetectionInterceptor {
}
}

impl Interceptor for RecursionDetectionInterceptor {
impl Intercept for RecursionDetectionInterceptor {
fn name(&self) -> &'static str {
"RecursionDetectionInterceptor"
}
Expand Down
6 changes: 3 additions & 3 deletions aws/rust-runtime/aws-runtime/src/request_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::service_clock_skew::ServiceClockSkew;
use aws_smithy_async::time::TimeSource;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::retries::RequestAttempts;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::ConfigBag;
Expand Down Expand Up @@ -91,7 +91,7 @@ impl RequestInfoInterceptor {
}
}

impl Interceptor for RequestInfoInterceptor {
impl Intercept for RequestInfoInterceptor {
fn name(&self) -> &'static str {
"RequestInfoInterceptor"
}
Expand Down Expand Up @@ -182,7 +182,7 @@ mod tests {
use aws_smithy_http::body::SdkBody;
use aws_smithy_runtime_api::client::interceptors::context::Input;
use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
use aws_smithy_types::config_bag::{ConfigBag, Layer};
use aws_smithy_types::retry::RetryConfig;
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-runtime/src/service_clock_skew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::BeforeDeserializationInterceptorContextMut;
use aws_smithy_runtime_api::client::interceptors::Interceptor;
use aws_smithy_runtime_api::client::interceptors::Intercept;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
use aws_smithy_types::config_bag::{ConfigBag, Storable, StoreReplace};
use aws_smithy_types::date_time::Format;
Expand Down Expand Up @@ -64,7 +64,7 @@ fn extract_time_sent_from_response(
DateTime::from_str(date_header, Format::HttpDate).map_err(Into::into)
}

impl Interceptor for ServiceClockSkewInterceptor {
impl Intercept for ServiceClockSkewInterceptor {
fn name(&self) -> &'static str {
"ServiceClockSkewInterceptor"
}
Expand Down
Loading

0 comments on commit 63ce3f9

Please sign in to comment.