-
Notifications
You must be signed in to change notification settings - Fork 81
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
feat: add endpoint plugins #1362
Conversation
01e9cad
to
bb8178e
Compare
bb8178e
to
de976f8
Compare
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.
Left a couple questions.
public class EndpointPlugin: Plugin { | ||
private var endpointResolver: EndpointResolver | ||
public init(endpointResolver: EndpointResolver) { | ||
self.endpointResolver = endpointResolver | ||
} | ||
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws { | ||
if var config = clientConfiguration as? XRayClient.XRayClientConfiguration { | ||
config.endpointResolver = self.endpointResolver | ||
} | ||
} | ||
} | ||
|
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.
Q: So if end-users wanted to customize endpoint resolver for XRayClient service via plugins, would they override this class and assign their custom endpoint resolver to config.endpointResolver? I.e., is this the extension point for end-user customization?
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.
End users can pass in their own customized endpoint resolver via the EndpointPlugin constructor, or they can just implement their own plugin similar to this.
...t-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/plugins/EndpointPlugin.kt
Outdated
Show resolved
Hide resolved
de976f8
to
4b57f35
Compare
override val isDefault: Boolean | ||
get() = false |
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.
nit: I noticed isDefault
defaults to true
, but maybe we should default it to false
in Plugin
so customers implementing their own plugins won't have to override this?
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 Plugin
interface requires the implementations to specify whether it's default or not.
writer.openBlock("public init(endpointResolver: \$L) {", "}", AWSServiceTypes.EndpointResolver) { | ||
writer.write("self.endpointResolver = endpointResolver") | ||
} |
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.
Should endpoint
also be configurable in EndpointPlugin
? e.g.
public var endpoint: Swift.String? |
If it is, maybe a second initializer can be added, and the configureClient()
call would only set the values on the config
if it's not nil
.
I'm ok with excluding it though.
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.
LGTM, should be good to go after merging changes from main & having CI pass.
e8da6aa
to
3ce6864
Compare
3ce6864
to
f84605c
Compare
f84605c
to
b3ebbae
Compare
Description of changes
New/existing dependencies impact assessment, if applicable
No new dependencies were added to this change.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.