-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Add Bedrock API key support #951
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
Changes from all commits
612bb65
4c04dd5
45a1c73
bff68ae
c271a1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,12 @@ extension Context { | |
public func getIdentityResolvers() -> Attributes? { | ||
get(key: identityResolversKey) | ||
} | ||
|
||
public func addIdentityResolver<T: IdentityResolver>(value: T, schemeID: String) { | ||
var identityResolvers: Attributes = get(key: identityResolversKey) ?? Attributes() | ||
identityResolvers.set(key: AttributeKey<any IdentityResolver>(name: schemeID), value: value) | ||
set(key: identityResolversKey, value: identityResolvers) | ||
} | ||
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. The Bedrock API Key customization needs to add an identity resolver after they have been set, hence this method is provided |
||
} | ||
|
||
extension ContextBuilder { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,6 +440,7 @@ abstract class HTTPBindingProtocolGenerator( | |
operationMiddleware.appendMiddleware(operation, RetryMiddleware(ctx.model, ctx.symbolProvider, retryErrorInfoProviderSymbol)) | ||
operationMiddleware.appendMiddleware(operation, SignerMiddleware(ctx.model, ctx.symbolProvider)) | ||
addProtocolSpecificMiddleware(ctx, operation) | ||
addServiceSpecificMiddleware(ctx, operation) | ||
operationMiddleware.appendMiddleware(operation, AuthSchemeMiddleware(ctx.model, ctx.symbolProvider)) | ||
for (integration in ctx.integrations) { | ||
integration.customizeMiddleware(ctx, operation, operationMiddleware) | ||
|
@@ -482,6 +483,13 @@ abstract class HTTPBindingProtocolGenerator( | |
operation: OperationShape, | ||
) | ||
|
||
protected open fun addServiceSpecificMiddleware( | ||
ctx: ProtocolGenerator.GenerationContext, | ||
operation: OperationShape, | ||
) { | ||
// No operation. Override in subclasses to install per-service custom middleware/interceptors. | ||
} | ||
|
||
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. This provides a customization point for aws-sdk-swift to add in custom middleware based on the service that is being generated. |
||
protected abstract fun addUserAgentMiddleware( | ||
ctx: ProtocolGenerator.GenerationContext, | ||
operation: OperationShape, | ||
|
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 Bedrock API Key customization needs to alter the configured auth scheme preference order, hence a setter is provided