You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SotoCore.docc/SotoCore/AWSClient.md
+5-14Lines changed: 5 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@ Client managing communication with AWS services
10
10
11
11
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.
12
12
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.
14
14
15
15
```swift
16
16
let awsClient =AWSClient(
17
17
credentialProvider: .default,
18
18
retryPolicy: .default,
19
19
middlewares: [],
20
20
options: .init(),
21
-
httpClientProvider: .createNew,
21
+
httpClient: HTTPClient.shared,
22
22
logger: AWSClient.loggingDisabled
23
23
)
24
24
```
@@ -55,20 +55,11 @@ The `retryPolicy` defines how the client reacts to a failed request. There are t
55
55
56
56
### Middleware
57
57
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.
59
59
60
-
### HTTP Client provider
60
+
### HTTP Client
61
61
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`.
0 commit comments