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
SdkConfigandConfigvia thehttp_connector()method, which took aDynConnectorfrom theaws-smithy-clientcrate. 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, tookConnectorSettingsas 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
HttpClientwas introduced that will be configurable onSdkConfigandConfigin 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
HyperClientBuilderand 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_clientfunction inProviderConfig), but thetls_connectorwill 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_utilmodule 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->StaticReplayClientdvr::ReplayingConnection->dvr::ReplayingClientdvr::RecordingConnection->dvr::RecordingClientinfallible_connection_fn->infallible_client_fncapture_requestremains unchanged other than being moved and returning aHttpClientinstance instead of aHttpConnector.The constructor for
TestConnection/StaticReplayClienthas been changed to take a list ofReplayEventtypes now.ReplayEventimplementsFrom<(HttpRequest, HttpResponse)>, and also has anewmethod that takes a request/response.Other smaller changes
aws_smithy_runtime_api::client::connectorswas renamed toaws_smithy_runtime_api::client::httpLazyCredentialsCachehad itssleep/set_sleepmethods renamed tosleep_impl/set_sleep_implfor consistency.In general, you should not need to depend on
aws-smithy-clientanymore if you do currently.Beta Was this translation helpful? Give feedback.
All reactions