@@ -132,53 +132,9 @@ pub fn default_client() -> Option<SharedHttpClient> {
132
132
///
133
133
/// This connector also implements socket connect and read timeouts.
134
134
///
135
- /// # Examples
136
- ///
137
- /// Construct a `HyperConnector` with the default TLS implementation (rustls).
138
- /// This can be useful when you want to share a Hyper connector between multiple
139
- /// generated Smithy clients.
140
- ///
141
- /// ```no_run,ignore
142
- /// use aws_smithy_runtime::client::connectors::hyper_connector::{DefaultHttpsTcpConnector, HyperConnector};
143
- ///
144
- /// let hyper_connector = HyperConnector::builder().build(DefaultHttpsTcpConnector::new());
145
- ///
146
- /// // This connector can then be given to a generated service Config
147
- /// let config = my_service_client::Config::builder()
148
- /// .endpoint_url("http://localhost:1234")
149
- /// .http_connector(hyper_connector)
150
- /// .build();
151
- /// let client = my_service_client::Client::from_conf(config);
152
- /// ```
153
- ///
154
- /// ## Use a Hyper client with WebPKI roots
155
- ///
156
- /// A use case for where you may want to use the [`HyperConnector`] is when setting Hyper client settings
157
- /// that aren't otherwise exposed by the `Config` builder interface. Some examples include changing:
158
- ///
159
- /// - Hyper client settings
160
- /// - Allowed TLS cipher suites
161
- /// - Using an alternative TLS connector library (not the default, rustls)
162
- /// - CA trust root certificates (illustrated using WebPKI below)
163
- ///
164
- /// ```no_run,ignore
165
- /// use aws_smithy_runtime::client::connectors::hyper_connector::HyperConnector;
166
- ///
167
- /// let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
168
- /// .with_webpki_roots()
169
- /// .https_only()
170
- /// .enable_http1()
171
- /// .enable_http2()
172
- /// .build();
173
- /// let hyper_connector = HyperConnector::builder().build(https_connector);
174
- ///
175
- /// // This connector can then be given to a generated service Config
176
- /// let config = my_service_client::Config::builder()
177
- /// .endpoint_url("https://example.com")
178
- /// .http_connector(hyper_connector)
179
- /// .build();
180
- /// let client = my_service_client::Client::from_conf(config);
181
- /// ```
135
+ /// This shouldn't be used directly in most cases.
136
+ /// See the docs on [`HyperClientBuilder`] for examples of how
137
+ /// to customize the Hyper client.
182
138
#[ derive( Debug ) ]
183
139
pub struct HyperConnector {
184
140
adapter : Box < dyn HttpConnector > ,
@@ -533,6 +489,55 @@ where
533
489
///
534
490
/// This builder can be used to customize the underlying TCP connector used, as well as
535
491
/// hyper client configuration.
492
+ ///
493
+ /// # Examples
494
+ ///
495
+ /// Construct a Hyper client with the default TLS implementation (rustls).
496
+ /// This can be useful when you want to share a Hyper connector between multiple
497
+ /// generated Smithy clients.
498
+ ///
499
+ /// ```no_run,ignore
500
+ /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
501
+ ///
502
+ /// let http_client = HyperClientBuilder::new().build_https();
503
+ ///
504
+ /// // This connector can then be given to a generated service Config
505
+ /// let config = my_service_client::Config::builder()
506
+ /// .endpoint_url("http://localhost:1234")
507
+ /// .http_client(http_client)
508
+ /// .build();
509
+ /// let client = my_service_client::Client::from_conf(config);
510
+ /// ```
511
+ ///
512
+ /// ## Use a Hyper client with WebPKI roots
513
+ ///
514
+ /// A use case for where you may want to use the [`HyperClientBuilder`] is when
515
+ /// setting Hyper client settings that aren't otherwise exposed by the `Config`
516
+ /// builder interface. Some examples include changing:
517
+ ///
518
+ /// - Hyper client settings
519
+ /// - Allowed TLS cipher suites
520
+ /// - Using an alternative TLS connector library (not the default, rustls)
521
+ /// - CA trust root certificates (illustrated using WebPKI below)
522
+ ///
523
+ /// ```no_run,ignore
524
+ /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
525
+ ///
526
+ /// let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
527
+ /// .with_webpki_roots()
528
+ /// .https_only()
529
+ /// .enable_http1()
530
+ /// .enable_http2()
531
+ /// .build();
532
+ /// let http_client = HyperClientBuilder::new().build(https_connector);
533
+ ///
534
+ /// // This connector can then be given to a generated service Config
535
+ /// let config = my_service_client::Config::builder()
536
+ /// .endpoint_url("https://example.com")
537
+ /// .http_client(http_client)
538
+ /// .build();
539
+ /// let client = my_service_client::Client::from_conf(config);
540
+ /// ```
536
541
#[ derive( Clone , Default , Debug ) ]
537
542
pub struct HyperClientBuilder {
538
543
client_builder : Option < hyper_0_14:: client:: Builder > ,
0 commit comments