-
Notifications
You must be signed in to change notification settings - Fork 50
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: provide client config property for region provider #1488
Open
xinsong-cui
wants to merge
13
commits into
main
Choose a base branch
from
feat-region-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+128
−61
Open
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0d31702
feat: provide client config property for region provider
xinsong-cui acec62e
lint
xinsong-cui 01507ac
change log
xinsong-cui ca01936
remove commented code
xinsong-cui a720506
Trigger CI
0marperez 21487eb
address PR reviews
xinsong-cui 0e79d54
Merge branch 'feat-region-provider' of https://github.com/awslabs/aws…
xinsong-cui 91f08b4
address PR reviews
xinsong-cui 82dfc9d
address PR reviews
xinsong-cui c2eebae
address pr reviews
xinsong-cui a8a044a
add missing import
xinsong-cui 761573c
remove extra space
xinsong-cui 01896b6
update smithy version
xinsong-cui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "05ac561b-963f-4953-bb4f-1fc19fc1207c", | ||
"type": "feature", | ||
"description": "Add `regionProvider` property to client config", | ||
"issues": [ | ||
"awslabs/aws-sdk-kotlin#1478" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/RegionProviderIntegration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package aws.sdk.kotlin.codegen | ||
|
||
import software.amazon.smithy.kotlin.codegen.core.CodegenContext | ||
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration | ||
import software.amazon.smithy.kotlin.codegen.model.asNullable | ||
import software.amazon.smithy.kotlin.codegen.rendering.util.ConfigProperty | ||
|
||
/** | ||
* Adds region provider integration to the client config | ||
*/ | ||
class RegionProviderIntegration : KotlinIntegration { | ||
companion object { | ||
val RegionProviderProp: ConfigProperty = ConfigProperty { | ||
name = "regionProvider" | ||
symbol = AwsRuntimeTypes.Config.Region.RegionProvider.asNullable() | ||
baseClass = AwsRuntimeTypes.Config.AwsSdkClientConfig | ||
useNestedBuilderBaseClass() | ||
documentation = """ | ||
An optional region provider that determines the AWS region for client operations. When specified, this provider | ||
takes precedence over the default region provider chain, unless a static region is explicitly configured. | ||
|
||
The region resolution order is: | ||
1. Static region (if specified) | ||
2. Custom region provider (if configured) | ||
3. Default region provider chain | ||
""".trimIndent() | ||
} | ||
} | ||
|
||
override fun additionalServiceConfigProps(ctx: CodegenContext): List<ConfigProperty> = buildList { | ||
add(RegionProviderProp) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Question: Why is this separate from the
RegionSupport
integration that exists in smithy-kotlin? They serve the exact same purpose, just via slightly different mechanisms. Moreover, any non-AWS service which is regionalized and supports a staticregion
config prop should also support aregionProvider
prop shouldn't it?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 is kind of my fault, I told @xinsong-cui to start coding in a new integration to make it less confusing and to work around some of the issues that were fixed by the refactor. I agree that it should go in the
regionSupport
integration.