-
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
Conversation
public var authSchemePreference: [String]? { | ||
get { getAuthSchemePreference() } | ||
set { set(key: authSchemePreferenceKey, value: newValue) } | ||
} |
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
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 comment
The 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
) { | ||
// 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 comment
The 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.
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.
One comment on codegen funtion naming
@@ -482,6 +483,13 @@ abstract class HTTPBindingProtocolGenerator( | |||
operation: OperationShape, | |||
) | |||
|
|||
protected open fun addCustomizationMiddleware( |
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.
Maybe we could rename this to something like addServiceSpecificMiddleware
to make it more descriptive & follow same pattern as pre-existing addProtocolSpecificMiddleware
function.
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.
Renamed as suggested
Description of changes
These changes support the addition of Bedrock API Key support in awslabs/aws-sdk-swift#1992
Context
.Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.