-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endpoints 2.0 Integration pre-work #2063
Merged
+432
−187
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a15dba
Split endpoint resolution middleware into two parts & refactor endpoi…
rcoh f5ccc38
Endpoints 2.0 Integration pre-work
rcoh ebf9323
Back out previous change to insert endpoint directly into the bag
rcoh e6e4bef
backout changes to property bag
rcoh 8531e4f
Update changelog & add more docs
rcoh a75b5db
Fix AWS test
rcoh df4842c
Fix test
rcoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,30 +5,36 @@ | |
|
||
//! Base Middleware Stack | ||
|
||
use aws_endpoint::AwsEndpointStage; | ||
use aws_endpoint::AwsAuthStage; | ||
use aws_http::auth::CredentialsStage; | ||
use aws_http::recursion_detection::RecursionDetectionStage; | ||
use aws_http::user_agent::UserAgentStage; | ||
use aws_sig_auth::middleware::SigV4SigningStage; | ||
use aws_sig_auth::signer::SigV4Signer; | ||
use aws_smithy_http::endpoint::middleware::SmithyEndpointStage; | ||
use aws_smithy_http_tower::map_request::{AsyncMapRequestLayer, MapRequestLayer}; | ||
use std::fmt::Debug; | ||
use tower::layer::util::{Identity, Stack}; | ||
use tower::ServiceBuilder; | ||
|
||
type DefaultMiddlewareStack = Stack< | ||
/// Macro to generate the tower stack type. Arguments should be in reverse order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very cool |
||
macro_rules! stack_type { | ||
($first: ty, $($rest:ty),+) => { | ||
tower::layer::util::Stack<$first, stack_type!($($rest),+)> | ||
}; | ||
($only: ty) => { | ||
tower::layer::util::Stack<$only, tower::layer::util::Identity> | ||
} | ||
} | ||
|
||
// Note: the layers here appear in reverse order | ||
type DefaultMiddlewareStack = stack_type!( | ||
MapRequestLayer<RecursionDetectionStage>, | ||
Stack< | ||
MapRequestLayer<SigV4SigningStage>, | ||
Stack< | ||
AsyncMapRequestLayer<CredentialsStage>, | ||
Stack< | ||
MapRequestLayer<UserAgentStage>, | ||
Stack<MapRequestLayer<AwsEndpointStage>, Identity>, | ||
>, | ||
>, | ||
>, | ||
>; | ||
MapRequestLayer<SigV4SigningStage>, | ||
AsyncMapRequestLayer<CredentialsStage>, | ||
MapRequestLayer<UserAgentStage>, | ||
MapRequestLayer<AwsAuthStage>, | ||
MapRequestLayer<SmithyEndpointStage> | ||
); | ||
|
||
/// AWS Middleware Stack | ||
/// | ||
|
@@ -54,7 +60,8 @@ impl DefaultMiddleware { | |
fn base() -> ServiceBuilder<DefaultMiddlewareStack> { | ||
let credential_provider = AsyncMapRequestLayer::for_mapper(CredentialsStage::new()); | ||
let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new())); | ||
let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage); | ||
let endpoint_stage = MapRequestLayer::for_mapper(SmithyEndpointStage::new()); | ||
let auth_stage = MapRequestLayer::for_mapper(AwsAuthStage); | ||
let user_agent = MapRequestLayer::for_mapper(UserAgentStage::new()); | ||
let recursion_detection = MapRequestLayer::for_mapper(RecursionDetectionStage::new()); | ||
// These layers can be considered as occurring in order, that is: | ||
|
@@ -64,7 +71,8 @@ fn base() -> ServiceBuilder<DefaultMiddlewareStack> { | |
// 4. Sign with credentials | ||
// (5. Dispatch over the wire) | ||
ServiceBuilder::new() | ||
.layer(endpoint_resolver) | ||
.layer(endpoint_stage) | ||
.layer(auth_stage) | ||
.layer(user_agent) | ||
.layer(credential_provider) | ||
.layer(signer) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting to seem like everything in
aws-endpoint
should just be inaws-http
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this crate can go away soon