HTTP connector upgrade guidance #3022
jdisanti
announced in
Change Log
Replies: 1 comment
-
Examples update in awsdocs/aws-doc-sdk-examples#5483 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you don't currently call
http_connector()
/with_tcp_connector()
onConfig
,SdkConfig
,ConfigLoader
, orProviderConfig
, then you can stop reading this guide now since you won't be impacted by these changes.Previously, a HTTP connector was configurable on
SdkConfig
andConfig
via thehttp_connector()
method, which took aDynConnector
from theaws-smithy-client
crate. However, a connector is tied to other configuration values, such as connect/read timeouts, and HTTP protocol version. The previous API didn't reflect these ties very well, and many connector creation methods, such asdefault_connector
, tookConnectorSettings
as an argument. This API made it impossible to change the read/connect timeouts or HTTP protocol version in operation-specific config overrides.To remedy this problems, a new trait named
HttpClient
was introduced that will be configurable onSdkConfig
andConfig
in place ofDynConnector
. This trait looks as follows:There is a built-in hyper client available in the aws-smithy-runtime crate, which can be constructed with
HyperClientBuilder
and given to config. For example, if you want to customize your TLS configuration, you can do the following:If you used
with_tcp_connector
, then replacing that will be similar to the code above (there is ahttp_client
function inProviderConfig
), but thetls_connector
will be replaced with the connector you were passing towith_tcp_connector
.Test/mock connectors
If you were using any of the test/mock/fake connectors from
aws_smithy_client
, then they have all been renamed and moved intoaws_smithy_runtime::client::http::test_util
module behind the["client", "test-util"]
features. See the module overviewin the docs for more information. Below is a mapping of old to new names:
TestConnection
->StaticReplayClient
dvr::ReplayingConnection
->dvr::ReplayingClient
dvr::RecordingConnection
->dvr::RecordingClient
infallible_connection_fn
->infallible_client_fn
capture_request
remains unchanged other than being moved and returning aHttpClient
instance instead of aHttpConnector
.The constructor for
TestConnection
/StaticReplayClient
has been changed to take a list ofReplayEvent
types now.ReplayEvent
implementsFrom<(HttpRequest, HttpResponse)>
, and also has anew
method that takes a request/response.Other smaller changes
aws_smithy_runtime_api::client::connectors
was renamed toaws_smithy_runtime_api::client::http
LazyCredentialsCache
had itssleep
/set_sleep
methods renamed tosleep_impl
/set_sleep_impl
for consistency.In general, you should not need to depend on
aws-smithy-client
anymore if you do currently.Beta Was this translation helpful? Give feedback.
All reactions