Skip to content

Commit d0c03cc

Browse files
committed
Merge remote-tracking branch 'origin/main' into release
2 parents cd08174 + 8b78801 commit d0c03cc

File tree

20 files changed

+1180
-228
lines changed

20 files changed

+1180
-228
lines changed

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider.kt

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine
1717
import aws.smithy.kotlin.runtime.io.Closeable
1818
import aws.smithy.kotlin.runtime.logging.Logger
1919
import aws.smithy.kotlin.runtime.time.TimestampFormat
20+
import aws.smithy.kotlin.runtime.util.LazyAsyncValue
2021
import aws.smithy.kotlin.runtime.util.Platform
2122
import aws.smithy.kotlin.runtime.util.PlatformProvider
23+
import aws.smithy.kotlin.runtime.util.asyncLazy
2224

2325
/**
2426
* A [CredentialsProvider] that gets credentials from a profile in `~/.aws/config` or the shared credentials
@@ -74,7 +76,6 @@ public class ProfileCredentialsProvider(
7476
private val platformProvider: PlatformProvider = Platform,
7577
private val httpClientEngine: HttpClientEngine? = null,
7678
) : CredentialsProvider, Closeable {
77-
7879
private val namedProviders = mapOf(
7980
"Environment" to EnvironmentCredentialsProvider(platformProvider::getenv),
8081
"Ec2InstanceMetadata" to ImdsCredentialsProvider(
@@ -99,7 +100,7 @@ public class ProfileCredentialsProvider(
99100

100101
// if profile is overridden for this provider, attempt to resolve it from there first
101102
val profileOverride = profileName?.let { profiles[it] }
102-
val region = region ?: profileOverride?.get("region") ?: resolveRegion(platformProvider)
103+
val region = asyncLazy { region ?: profileOverride?.get("region") ?: resolveRegion(platformProvider) }
103104

104105
val leaf = chain.leaf.toCredentialsProvider(region)
105106
logger.debug { "Resolving credentials from ${chain.leaf.description()}" }
@@ -121,34 +122,39 @@ public class ProfileCredentialsProvider(
121122
}
122123
}
123124

124-
private fun LeafProvider.toCredentialsProvider(region: String): CredentialsProvider = when (this) {
125-
is LeafProvider.NamedSource -> namedProviders[name] ?: throw ProviderConfigurationException("unknown credentials source: $name")
126-
is LeafProvider.AccessKey -> StaticCredentialsProvider(credentials)
127-
is LeafProvider.WebIdentityTokenRole -> StsWebIdentityCredentialsProvider(
128-
roleArn,
129-
webIdentityTokenFile,
130-
region = region,
131-
roleSessionName = sessionName,
132-
platformProvider = platformProvider,
133-
httpClientEngine = httpClientEngine
134-
)
135-
is LeafProvider.Sso -> SsoCredentialsProvider(
136-
accountId = ssoAccountId,
137-
roleName = ssoRoleName,
138-
startUrl = ssoStartUrl,
139-
ssoRegion = ssoRegion,
140-
httpClientEngine = httpClientEngine,
141-
platformProvider = platformProvider
142-
)
143-
}
125+
private suspend fun LeafProvider.toCredentialsProvider(region: LazyAsyncValue<String>): CredentialsProvider =
126+
when (this) {
127+
is LeafProvider.NamedSource -> namedProviders[name]
128+
?: throw ProviderConfigurationException("unknown credentials source: $name")
129+
130+
is LeafProvider.AccessKey -> StaticCredentialsProvider(credentials)
131+
132+
is LeafProvider.WebIdentityTokenRole -> StsWebIdentityCredentialsProvider(
133+
roleArn,
134+
webIdentityTokenFile,
135+
region = region.get(),
136+
roleSessionName = sessionName,
137+
platformProvider = platformProvider,
138+
httpClientEngine = httpClientEngine
139+
)
140+
141+
is LeafProvider.Sso -> SsoCredentialsProvider(
142+
accountId = ssoAccountId,
143+
roleName = ssoRoleName,
144+
startUrl = ssoStartUrl,
145+
ssoRegion = ssoRegion,
146+
httpClientEngine = httpClientEngine,
147+
platformProvider = platformProvider
148+
)
149+
}
144150

145-
private fun RoleArn.toCredentialsProvider(
151+
private suspend fun RoleArn.toCredentialsProvider(
146152
creds: Credentials,
147-
region: String
153+
region: LazyAsyncValue<String>,
148154
): CredentialsProvider = StsAssumeRoleCredentialsProvider(
149155
credentialsProvider = StaticCredentialsProvider(creds),
150156
roleArn = roleArn,
151-
region = region,
157+
region = region.get(),
152158
roleSessionName = sessionName,
153159
externalId = externalId,
154160
httpClientEngine = httpClientEngine

aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProviderTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ProfileCredentialsProviderTest {
2222
fs = mapOf(
2323
"config" to """
2424
[default]
25-
region = us-east-2
2625
aws_access_key_id = AKID-Default
2726
aws_secret_access_key = Default-Secret
2827
""".trimIndent()
@@ -50,7 +49,6 @@ class ProfileCredentialsProviderTest {
5049
aws_secret_access_key = Default-Secret
5150
5251
[profile my-profile]
53-
region = us-east-2
5452
aws_access_key_id = AKID-Profile
5553
aws_secret_access_key = Profile-Secret
5654
""".trimIndent()
@@ -74,7 +72,6 @@ class ProfileCredentialsProviderTest {
7472
env = mapOf(
7573
"AWS_CONFIG_FILE" to "config",
7674
"AWS_PROFILE" to "my-profile",
77-
"AWS_REGION" to "us-west-1"
7875
),
7976
fs = mapOf(
8077
"config" to """

codegen/sdk/aws-models/amplifyuibuilder.json

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": {
88
"target": "com.amazonaws.amplifyuibuilder#ComponentProperty",
99
"traits": {
10-
"smithy.api#documentation": "<p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>. This value is required for a navigation action.</p>"
10+
"smithy.api#documentation": "<p>The type of navigation action. Valid values are <code>url</code> and <code>anchor</code>.\n This value is required for a navigation action.</p>"
1111
}
1212
},
1313
"url": {
@@ -19,7 +19,7 @@
1919
"anchor": {
2020
"target": "com.amazonaws.amplifyuibuilder#ComponentProperty",
2121
"traits": {
22-
"smithy.api#documentation": "<p>The HTML anchor link to the location to open. Specify this value for a navigation action.</p>"
22+
"smithy.api#documentation": "<p>The HTML anchor link to the location to open. Specify this value for a navigation\n action.</p>"
2323
}
2424
},
2525
"target": {
@@ -31,13 +31,13 @@
3131
"global": {
3232
"target": "com.amazonaws.amplifyuibuilder#ComponentProperty",
3333
"traits": {
34-
"smithy.api#documentation": "<p>Specifies whether the user should be signed out globally. Specify this value for an auth sign out action.</p>"
34+
"smithy.api#documentation": "<p>Specifies whether the user should be signed out globally. Specify this value for an auth\n sign out action.</p>"
3535
}
3636
},
3737
"model": {
3838
"target": "smithy.api#String",
3939
"traits": {
40-
"smithy.api#documentation": "<p>The name of the data model. Use when the action performs an operation on an Amplify DataStore\n model.</p>"
40+
"smithy.api#documentation": "<p>The name of the data model. Use when the action performs an operation on an Amplify DataStore model.</p>"
4141
}
4242
},
4343
"id": {
@@ -49,7 +49,7 @@
4949
"fields": {
5050
"target": "com.amazonaws.amplifyuibuilder#ComponentProperties",
5151
"traits": {
52-
"smithy.api#documentation": "<p>A dictionary of key-value pairs mapping Amplify Studio properties to fields in a data model. Use when the action\n performs an operation on an Amplify DataStore model.</p>"
52+
"smithy.api#documentation": "<p>A dictionary of key-value pairs mapping Amplify Studio properties to fields\n in a data model. Use when the action performs an operation on an Amplify\n DataStore model.</p>"
5353
}
5454
},
5555
"state": {
@@ -60,7 +60,7 @@
6060
}
6161
},
6262
"traits": {
63-
"smithy.api#documentation": "<p>Represents the event action configuration for an element of a <code>Component</code>\n or <code>ComponentChild</code>. Use for the workflow feature in Amplify Studio\n that allows you to bind events and actions to components. <code>ActionParameters</code>\n defines the action that is performed when an event occurs on the component.</p>"
63+
"smithy.api#documentation": "<p>Represents the event action configuration for an element of a <code>Component</code> or\n <code>ComponentChild</code>. Use for the workflow feature in Amplify Studio\n that allows you to bind events and actions to components. <code>ActionParameters</code>\n defines the action that is performed when an event occurs on the component.</p>"
6464
}
6565
},
6666
"com.amazonaws.amplifyuibuilder#AmplifyUIBuilder": {
@@ -75,6 +75,29 @@
7575
"aws.auth#sigv4": {
7676
"name": "amplifyuibuilder"
7777
},
78+
"aws.iam#defineConditionKeys": {
79+
"aws:ResourceTag/${TagKey}": {
80+
"type": "String",
81+
"documentation": "Filters access based on the tags associated with the resource",
82+
"externalDocumentation": "${DocHomeURL}IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourcetag"
83+
},
84+
"aws:RequestTag/${TagKey}": {
85+
"type": "String",
86+
"documentation": "Filters access based on the tags that are passed in the request",
87+
"externalDocumentation": "${DocHomeURL}IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requesttag"
88+
},
89+
"aws:TagKeys": {
90+
"type": "ArrayOfString",
91+
"documentation": "Filters access based on the tag keys that are passed in the request",
92+
"externalDocumentation": "${DocHomeURL}IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-tagkeys"
93+
}
94+
},
95+
"aws.iam#supportedPrincipalTypes": [
96+
"Root",
97+
"IAMUser",
98+
"IAMRole",
99+
"FederatedUser"
100+
],
78101
"aws.protocols#restJson1": {},
79102
"smithy.api#cors": {},
80103
"smithy.api#documentation": "<p>The Amplify UI Builder API provides a programmatic interface for creating\n and configuring user interface (UI) component libraries and themes for use in your Amplify applications. You can then connect these UI components to an application's\n backend Amazon Web Services resources.</p>\n <p>You can also use the Amplify Studio visual designer to create UI components\n and model data for an app. For more information, see <a href=\"https://docs.amplify.aws/console/adminui/intro\">Introduction</a> in the\n <i>Amplify Docs</i>.</p>\n <p>The Amplify Framework is a comprehensive set of SDKs, libraries, tools, and\n documentation for client app development. For more information, see the <a href=\"https://docs.amplify.aws/\">Amplify Framework</a>. For more information about\n deploying an Amplify application to Amazon Web Services, see the <a href=\"https://docs.aws.amazon.com/amplify/latest/userguide/welcome.html\">Amplify User Guide</a>.</p>",
@@ -209,7 +232,7 @@
209232
"events": {
210233
"target": "com.amazonaws.amplifyuibuilder#ComponentEvents",
211234
"traits": {
212-
"smithy.api#documentation": "<p>Describes the events that can be raised on the component. Use for the workflow feature in Amplify Studio that allows you to\n bind events and actions to components.</p>"
235+
"smithy.api#documentation": "<p>Describes the events that can be raised on the component. Use for the workflow feature in\n Amplify Studio that allows you to bind events and actions to\n components.</p>"
213236
}
214237
},
215238
"schemaVersion": {
@@ -346,7 +369,13 @@
346369
"events": {
347370
"target": "com.amazonaws.amplifyuibuilder#ComponentEvents",
348371
"traits": {
349-
"smithy.api#documentation": "<p>Describes the events that can be raised on the child component. Use for the workflow feature in Amplify Studio that allows you to\n bind events and actions to components.</p>"
372+
"smithy.api#documentation": "<p>Describes the events that can be raised on the child component. Use for the workflow\n feature in Amplify Studio that allows you to bind events and actions to\n components.</p>"
373+
}
374+
},
375+
"sourceId": {
376+
"target": "smithy.api#String",
377+
"traits": {
378+
"smithy.api#documentation": "<p>The unique ID of the child component in its original source system, such as Figma.</p>"
350379
}
351380
}
352381
},
@@ -466,10 +495,16 @@
466495
"traits": {
467496
"smithy.api#documentation": "<p>Describes information about the action.</p>"
468497
}
498+
},
499+
"bindingEvent": {
500+
"target": "smithy.api#String",
501+
"traits": {
502+
"smithy.api#documentation": "<p>Binds an event to an action on a component. When you specify a <code>bindingEvent</code>, the event is called when the action is performed.</p>"
503+
}
469504
}
470505
},
471506
"traits": {
472-
"smithy.api#documentation": "<p>Describes the configuration of an event. You can bind an event and a corresponding\n action to a <code>Component</code> or a <code>ComponentChild</code>. A button click\n is an example of an event. </p>"
507+
"smithy.api#documentation": "<p>Describes the configuration of an event. You can bind an event and a corresponding action\n to a <code>Component</code> or a <code>ComponentChild</code>. A button click is an example of\n an event. </p>"
473508
}
474509
},
475510
"com.amazonaws.amplifyuibuilder#ComponentEvents": {
@@ -690,7 +725,10 @@
690725
"additionalSchemas": [
691726
"com.amazonaws.amplifyuibuilder#Component"
692727
]
693-
}
728+
},
729+
"aws.iam#conditionKeys": [
730+
"aws:ResourceTag/${TagKey}"
731+
]
694732
}
695733
},
696734
"com.amazonaws.amplifyuibuilder#ComponentSummary": {
@@ -809,6 +847,10 @@
809847
}
810848
],
811849
"traits": {
850+
"aws.iam#conditionKeys": [
851+
"aws:TagKeys",
852+
"aws:RequestTag/${TagKey}"
853+
],
812854
"aws.iam#requiredActions": [
813855
"amplify:GetApp"
814856
],
@@ -980,6 +1022,10 @@
9801022
}
9811023
],
9821024
"traits": {
1025+
"aws.iam#conditionKeys": [
1026+
"aws:TagKeys",
1027+
"aws:RequestTag/${TagKey}"
1028+
],
9831029
"aws.iam#requiredActions": [
9841030
"amplify:GetApp"
9851031
],
@@ -1242,11 +1288,10 @@
12421288
"type": "structure",
12431289
"members": {
12441290
"code": {
1245-
"target": "smithy.api#String",
1291+
"target": "com.amazonaws.amplifyuibuilder#SensitiveString",
12461292
"traits": {
12471293
"smithy.api#documentation": "<p>The access code to send in the request.</p>",
1248-
"smithy.api#required": {},
1249-
"smithy.api#sensitive": {}
1294+
"smithy.api#required": {}
12501295
}
12511296
},
12521297
"redirectUri": {
@@ -1265,11 +1310,10 @@
12651310
"type": "structure",
12661311
"members": {
12671312
"accessToken": {
1268-
"target": "smithy.api#String",
1313+
"target": "com.amazonaws.amplifyuibuilder#SensitiveString",
12691314
"traits": {
12701315
"smithy.api#documentation": "<p>The access token.</p>",
1271-
"smithy.api#required": {},
1272-
"smithy.api#sensitive": {}
1316+
"smithy.api#required": {}
12731317
}
12741318
},
12751319
"expiresIn": {
@@ -1280,11 +1324,10 @@
12801324
}
12811325
},
12821326
"refreshToken": {
1283-
"target": "smithy.api#String",
1327+
"target": "com.amazonaws.amplifyuibuilder#SensitiveString",
12841328
"traits": {
12851329
"smithy.api#documentation": "<p>The token to use to refresh a previously issued access token that might have\n expired.</p>",
1286-
"smithy.api#required": {},
1287-
"smithy.api#sensitive": {}
1330+
"smithy.api#required": {}
12881331
}
12891332
}
12901333
}
@@ -1868,7 +1911,7 @@
18681911
}
18691912
},
18701913
"traits": {
1871-
"smithy.api#documentation": "<p>Represents the state configuration when an action modifies a property of another\n element within the same component.</p>"
1914+
"smithy.api#documentation": "<p>Represents the state configuration when an action modifies a property of another element\n within the same component.</p>"
18721915
}
18731916
},
18741917
"com.amazonaws.amplifyuibuilder#Predicate": {
@@ -1961,11 +2004,10 @@
19612004
"type": "structure",
19622005
"members": {
19632006
"token": {
1964-
"target": "smithy.api#String",
2007+
"target": "com.amazonaws.amplifyuibuilder#SensitiveString",
19652008
"traits": {
19662009
"smithy.api#documentation": "<p>The token to use to refresh a previously issued access token that might have\n expired.</p>",
1967-
"smithy.api#required": {},
1968-
"smithy.api#sensitive": {}
2010+
"smithy.api#required": {}
19692011
}
19702012
}
19712013
},
@@ -1977,11 +2019,10 @@
19772019
"type": "structure",
19782020
"members": {
19792021
"accessToken": {
1980-
"target": "smithy.api#String",
2022+
"target": "com.amazonaws.amplifyuibuilder#SensitiveString",
19812023
"traits": {
19822024
"smithy.api#documentation": "<p>The access token.</p>",
1983-
"smithy.api#required": {},
1984-
"smithy.api#sensitive": {}
2025+
"smithy.api#required": {}
19852026
}
19862027
},
19872028
"expiresIn": {
@@ -2019,6 +2060,12 @@
20192060
"smithy.api#httpError": 404
20202061
}
20212062
},
2063+
"com.amazonaws.amplifyuibuilder#SensitiveString": {
2064+
"type": "string",
2065+
"traits": {
2066+
"smithy.api#sensitive": {}
2067+
}
2068+
},
20222069
"com.amazonaws.amplifyuibuilder#ServiceQuotaExceededException": {
20232070
"type": "structure",
20242071
"members": {
@@ -2236,7 +2283,10 @@
22362283
"additionalSchemas": [
22372284
"com.amazonaws.amplifyuibuilder#Theme"
22382285
]
2239-
}
2286+
},
2287+
"aws.iam#conditionKeys": [
2288+
"aws:ResourceTag/${TagKey}"
2289+
]
22402290
}
22412291
},
22422292
"com.amazonaws.amplifyuibuilder#ThemeSummary": {

0 commit comments

Comments
 (0)