Skip to content

Commit 7172aa2

Browse files
committed
Update AWSClient documentation
1 parent 452d739 commit 7172aa2

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

SotoCore.docc/SotoCore/AWSClient.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Client managing communication with AWS services
1010

1111
The `AWSClient` is the core of Soto. This is the object that manages your communication with AWS. It manages credential acquisition, takes your request, encodes it, signs it, sends it to AWS and then decodes the response for you. In most situations your application should only require one `AWSClient`. Create this at startup and use it throughout.
1212

13-
When creating an `AWSClient` you need to provide how you are going to acquire AWS credentials, what your policy is on retrying failed requests, a list of middleware you would apply to requests to AWS and responses from AWS, client options, where you get your `HTTPClient` and a `Logger` to log any output not directly linked to a request. There are defaults for most of these parameters. The only one required is the `httpClientProvider`.
13+
When creating an `AWSClient` you need to provide how you are going to acquire AWS credentials, what your policy is on retrying failed requests, a list of middleware you would apply to requests to AWS and responses from AWS, client options, where you get your `HTTPClient` and a `Logger` to log any output not directly linked to a request.
1414

1515
```swift
1616
let awsClient = AWSClient(
1717
credentialProvider: .default,
1818
retryPolicy: .default,
1919
middlewares: [],
2020
options: .init(),
21-
httpClientProvider: .createNew,
21+
httpClient: HTTPClient.shared,
2222
logger: AWSClient.loggingDisabled
2323
)
2424
```
@@ -55,20 +55,11 @@ The `retryPolicy` defines how the client reacts to a failed request. There are t
5555

5656
### Middleware
5757

58-
Middleware allows you to insert your own code just as a request has been constructed or a response has been received. You can use this to edit the request/response or just to view it. SotoCore supplies one middleware — `AWSLoggingMiddleware` — which outputs your request to the console once constructed and the response is received from AWS.
58+
Middleware allows you to insert your own code just as a request has been constructed or a response has been received. You can use this to edit the request/response or just to view it. SotoCore supplies one middleware — ``AWSLoggingMiddleware`` — which outputs your request to the console once constructed and the response is received from AWS.
5959

60-
### HTTP Client provider
60+
### HTTP Client
6161

62-
The `HTTPClientProvider` defines where you get your HTTP client from. You have three options:
63-
64-
- Pass `.createNew` which indicates the `AWSClient` should create its own HTTP client. This creates an instance of `HTTPClient` using [`AsyncHTTPClient`](https://github.com/swift-server/async-http.client).
65-
- Supply your own `EventLoopGroup` with `.createNewWithEventLoopGroup(EventLoopGroup`). This creates a new `HTTPClient` but has it use the supplied `EventLoopGroup`.
66-
- Supply your own HTTP client with `.shared(HTTPClient)`.
67-
68-
There are a number of reasons you might want to provide your own client, such as:
69-
70-
- You have one HTTP client you want to use across all your systems.
71-
- You want to change the configuration for the HTTP client used, perhaps you are running behind a proxy or want to enable response decompression.
62+
This is the HTTP client that the AWS client uses to communicate with AWS services. This is defined by protocol, as Soto is agnostic about what HTTP client is used. Currently Soto only provides an implementation for [AsyncHTTPClient](https://github.com/swift-server/async-http-client). By default AWSClient uses the `shared` instance of `HTTPClient`.
7263

7364
## AWSClient Shutdown
7465

0 commit comments

Comments
 (0)