Skip to content

Commit de7697c

Browse files
authored
Fix outdated howtos (#628)
1 parent 1b87a00 commit de7697c

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "bd94e49c-61f2-4cf2-814c-77df7f651500",
3+
"type": "documentation",
4+
"description": "Update outdated howto docs to correctly describe client instantiation and client engine configuration",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#620"
7+
]
8+
}

docs/howto/configuring/endpoints.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ you can just use the default `EndpointResolver` provided with each service clien
55
a custom endpoint though such as working with a pre-release version of a service or access to specific service
66
features not yet modeled in the SDK (e.g. S3 has dual-stack and FIPS endpoints).
77

8-
9-
An [Endpoint Resolver](https://github.com/awslabs/aws-sdk-kotlin/blob/main/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/AwsEndpointResolver.kt#L11)
8+
An [Endpoint Resolver](https://github.com/awslabs/aws-sdk-kotlin/blob/main/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/AwsEndpointResolver.kt)
109
can be configured to provide custom endpoint resolution logic for service clients. Every
1110
service client config is generated with an endpoint resolver that can be overridden. The endpoint resolver is given the
1211
service and region as a string, allowing for the resolver to dynamically drive its behavior. Each service client
@@ -18,10 +17,9 @@ resolver.
1817
The following code snippet shows how a service endpoint resolver can be overridden for S3:
1918

2019
```kotlin
21-
val sharedConfig = AwsClientConfig.fromEnvironment()
22-
val client = S3Client(sharedConfig) {
20+
val client = S3Client.fromEnvironment {
2321
endpointResolver = AwsEndpointResolver { service, region ->
24-
AwsEndpoint("https://mybucket.s3.us-west-2.amazonaws.com", CredentialScope(region = "us-west-2"))
22+
AwsEndpoint("https://mybucket.s3.us-west-2.amazonaws.com", CredentialScope(region = "us-west-2"))
2523
}
2624
}
27-
```
25+
```
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# Configuring HTTP Clients
22

3-
By default the AWS SDK for Kotlin uses an HTTP client known as the AWS Common Runtime (CRT) HTTP client. This
4-
client was written by AWS to ensure the best experience with AWS services. However customers may choose to override
5-
the default HTTP client by specifying an existing [HttpClientEngine](https://github.com/awslabs/smithy-kotlin/blob/main/runtime/protocol/http/common/src/aws/smithy/kotlin/runtime/http/engine/HttpClientEngine.kt)
6-
implementation or implementing their own, and referencing that implementation in the service client configuration at
7-
the time of client construction.
3+
By default, the AWS SDK for Kotlin uses an HTTP client from OkHttp. Customers may choose to override the default HTTP
4+
client by specifying an existing
5+
[HttpClientEngine](https://github.com/awslabs/smithy-kotlin/blob/main/runtime/protocol/http/common/src/aws/smithy/kotlin/runtime/http/engine/HttpClientEngine.kt)
6+
implementation or implementing their own and referencing that implementation in the service client configuration at the
7+
time of client construction.
88

9-
The SDK provides an additional client, `KtorEngine` via the `aws.smithy.kotlin:http-client-engine-ktor` dependency.
9+
The SDK provides an additional client called `CrtHttpEngine` via the `aws.smithy.kotlin:http-client-engine-crt`
10+
dependency. This implementation wraps the [AWS CRT](https://docs.aws.amazon.com/sdkref/latest/guide/common-runtime.html)
11+
which provides high-performance, cross-platform implementations of common SDK features.
1012

1113
[![Maven][maven-badge]][maven-url]
1214

13-
[maven-badge]: https://img.shields.io/maven-central/v/aws.smithy.kotlin/http-client-engine-ktor.svg?label=Maven
14-
[maven-url]: https://search.maven.org/search?q=g:aws.smithy.kotlin+a:http-client-engine-ktor
15+
[maven-badge]: https://img.shields.io/maven-central/v/aws.smithy.kotlin/http-client-engine-crt.svg?label=Maven
16+
[maven-url]: https://search.maven.org/search?q=g:aws.smithy.kotlin+a:http-client-engine-crt
1517

1618
## Example
1719

18-
The following code snippet demonstrates constructing an S3 client using the [Ktor OkHttp HTTP client](https://ktor.io/docs/http-client-engines.html#okhttp):
20+
The following code snippet demonstrates constructing an S3 client using the CRT HTTP client:
1921

2022
`build.gradle.kts`:
2123
```kotlin
2224
dependencies {
23-
implementation("aws.smithy.kotlin:http-client-engine-ktor:<version>")
25+
implementation("aws.smithy.kotlin:http-client-engine-crt:<version>")
2426
}
2527
```
2628

2729
Application code:
2830
```kotlin
29-
val sharedConfig = AwsClientConfig.fromEnvironment()
30-
val client = S3Client(sharedConfig) {
31-
httpClientEngine = KtorEngine()
31+
val client = S3Client.fromEnvironment {
32+
httpClientEngine = CrtHttpEngine()
3233
}
33-
```
34+
```

0 commit comments

Comments
 (0)