Skip to content

Commit 988f392

Browse files
authored
refactor(rt): remove client option (#1028)
1 parent 7e01857 commit 988f392

File tree

7 files changed

+17
-23
lines changed

7 files changed

+17
-23
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "bee7fe5b-8719-4405-9dbb-88be16774861",
3+
"type": "misc",
4+
"description": "Refactor ClientOption to AttributeKey directly and track upstream HttpContext changes"
5+
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ public class EcsCredentialsProvider internal constructor(
8383
val op = SdkHttpOperation.build<Unit, Credentials> {
8484
serializer = EcsCredentialsSerializer(authToken)
8585
deserializer = EcsCredentialsDeserializer()
86-
context {
87-
operationName = "EcsCredentialsProvider"
88-
serviceName = "EcsContainerMetadata"
89-
}
86+
operationName = "EcsCredentialsProvider"
87+
serviceName = "EcsContainerMetadata"
9088
execution.endpointResolver = EndpointResolver { Endpoint(url) }
9189
}
9290

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/ImdsClient.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ public class ImdsClient private constructor(builder: Builder) : InstanceMetadata
117117
}
118118
}
119119
}
120+
operationName = path
121+
serviceName = "IMDS"
120122
context {
121-
operationName = path
122-
serviceName = "IMDS"
123-
124123
// artifact of re-using ServiceEndpointResolver middleware
125124
set(SdkClientOption.LogMode, logMode)
126125
}

aws-runtime/aws-core/common/src/aws/sdk/kotlin/runtime/client/AwsClientOption.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*/
55

66
package aws.sdk.kotlin.runtime.client
7-
8-
import aws.smithy.kotlin.runtime.client.ClientOption
7+
import aws.smithy.kotlin.runtime.util.AttributeKey
98

109
/**
1110
* A collection of AWS service client options. NOTE: most options are configured by default through the service
@@ -16,5 +15,5 @@ public object AwsClientOption {
1615
* The AWS region the client should use. Note this is not always the same as [AwsSigningAttributes.SigningRegion] in
1716
* the case of global services like IAM
1817
*/
19-
public val Region: ClientOption<String> = ClientOption("AwsRegion")
18+
public val Region: AttributeKey<String> = AttributeKey("AwsRegion")
2019
}

aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/AwsRetryHeaderMiddlewareTest.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ class AwsRetryHeaderMiddlewareTest {
2525
val op = SdkHttpOperation.build<Unit, Unit> {
2626
serializer = UnitSerializer
2727
deserializer = UnitDeserializer
28-
context {
29-
// required operation context
30-
operationName = "TestOperation"
31-
serviceName = "TestService"
32-
}
28+
operationName = "TestOperation"
29+
serviceName = "TestService"
3330
}
3431

3532
val strategy = StandardRetryStrategy()

aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/RecursionDetectionTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ class RecursionDetectionTest {
4141
val op = SdkHttpOperation.build<Unit, HttpResponse> {
4242
serializer = if (existingTraceHeader != null) TraceHeaderSerializer(existingTraceHeader) else UnitSerializer
4343
deserializer = IdentityDeserializer
44-
context {
45-
operationName = "testOperation"
46-
serviceName = "TestService"
47-
}
44+
operationName = "testOperation"
45+
serviceName = "TestService"
4846
}
4947

5048
val provider = TestPlatformProvider(env)

aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ class UserAgentTest {
3131
SdkHttpOperation.build<Unit, HttpResponse> {
3232
serializer = UnitSerializer
3333
deserializer = IdentityDeserializer
34-
context {
35-
operationName = "testOperation"
36-
serviceName = "TestService"
37-
}
34+
operationName = "testOperation"
35+
serviceName = "TestService"
3836
}.apply {
3937
val apiMd = ApiMetadata("Test Service", "1.2.3")
4038
val metadata = loadAwsUserAgentMetadataFromEnvironment(platformProvider, apiMd)

0 commit comments

Comments
 (0)