-
Notifications
You must be signed in to change notification settings - Fork 82
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
fix!: Make config object immutable after client creation #1886
base: main
Are you sure you want to change the base?
Conversation
@@ -19,7 +20,7 @@ class EndpointPlugin(private val serviceConfig: ServiceConfig) : Plugin { | |||
} | |||
|
|||
override fun render(ctx: ProtocolGenerator.GenerationContext, writer: SwiftWriter) { | |||
writer.openBlock("public class $pluginName: Plugin {", "}") { | |||
writer.openBlock("public class \$L: \$N {", "}", pluginName, ClientRuntimeTypes.Core.Plugin) { |
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.
Cleanup, and used the symbol for Plugin
to ensure correct imports.
"}", | ||
serviceConfig.typeName, | ||
) { | ||
writer.write("clientConfiguration.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.
Safe unwrap is unneeded & removed.
"clientConfiguration.bearerTokenIdentityResolver = \$N(token: \$N(token: \"\"))", | ||
SmithyIdentityTypes.StaticBearerTokenIdentityResolver, | ||
SmithyIdentityTypes.BearerTokenIdentity | ||
) |
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.
Safe unwrap is unneeded & removed. Also a little code cleanup.
writer.write("clientConfiguration.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!") | ||
} | ||
writer.openBlock("if self.bearerTokenIdentityResolver != nil {", "}") { | ||
writer.write("clientConfiguration.bearerTokenIdentityResolver = self.bearerTokenIdentityResolver!") |
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.
Safe unwrap is unneeded & removed. Also cleanup.
@@ -129,7 +129,7 @@ class AWSHttpProtocolServiceClient( | |||
*/ | |||
private fun renderRegionConfigInitializer(properties: List<ConfigProperty>) { | |||
writer.openBlock( | |||
"public convenience init(region: \$N) throws {", | |||
"public init(region: \$N) throws {", |
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.
Removed convenience
since config is no longer a class.
} | ||
public func configureClient(clientConfiguration: inout Config) { | ||
clientConfiguration.region = self.region | ||
clientConfiguration.signingRegion = self.region |
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.
Safe unwrap is unneeded & removed.
clientConfiguration.awsRetryMode, | ||
clientConfiguration.maxAttempts | ||
) | ||
clientConfiguration.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver() |
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.
Safe unwrap is unneeded & removed.
public protocol AWSRegionClientConfiguration { | ||
import protocol ClientRuntime.ClientConfiguration | ||
|
||
public protocol AWSRegionClientConfiguration: ClientConfiguration { |
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.
Adding this conformance here since it is already always true, and it removes the need to specify it in the region config plugin below.
…into jbe/plugin_revamp
Issue #
Description of changes
New/existing dependencies impact assessment, if applicable
Conventional Commits
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.