-
Notifications
You must be signed in to change notification settings - Fork 33
feat: S3 Express support #916
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
base: main
Are you sure you want to change the base?
Conversation
import class Smithy.ContextBuilder | ||
import struct Smithy.AttributeKey | ||
|
||
public extension Context { |
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.
Allow the client config object to be placed into the context. This allows the client config to be passed to the S3 Express identity resolver, so that it can use the S3 client to obtain S3 Express credentials.
} | ||
|
||
private let clientConfigKey = AttributeKey<ClientConfigurationWrapper>(name: "SmithySwiftClientConfigWrapper") | ||
|
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.
The client config is wrapped in a @unchecked Sendable
wrapper before adding it to the context, since Context requires that anything added to its storage be Sendable.
See comment on code immediately below for more details.
|
||
import struct Smithy.AttributeKey | ||
|
||
public enum IdentityPropertyKeys { |
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.
Client config is also wrapped before storing it as an identity property. The wrapper defined immediately above is used.
@@ -73,7 +73,14 @@ extension AuthSchemeMiddleware: SelectAuthScheme { | |||
context: attributes | |||
) | |||
// Resolve identity using the resolver from auth scheme | |||
let identity = try await identityResolver.getIdentity(identityProperties: option.identityProperties) |
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.
The client config is wrapped, then added to identity properties (if any client config was stored to the context when the operation was started.)
The modified identity properties are then passed into the identity resolver. This is used by the S3 Express identity resolver to call S3.
// Set signing name and signing region flags | ||
updatedSigningProperties.set(key: SigningPropertyKeys.signingName, value: context.signingName) | ||
// Set resolved signing name and signing region flags | ||
let signingName = updatedSigningProperties.get(key: SigningPropertyKeys.signingName) ?? context.signingName |
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.
If signing properties include a signing name, use it, else fall back to the default signing name defined in the model's sigv4 trait.
Description of changes
Provides support for customizations needed to utilize the S3 Express feature.
Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.