aws_sdk_workspacesweb/config/
endpoint.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use ::aws_smithy_runtime_api::client::endpoint::EndpointFuture;
3pub use ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver;
4pub use ::aws_smithy_types::endpoint::Endpoint;
5
6#[cfg(test)]
7mod test {
8
9    /// For region eu-west-1 with FIPS disabled and DualStack disabled
10    #[test]
11    fn test_1() {
12        let params = crate::config::endpoint::Params::builder()
13            .region("eu-west-1".to_string())
14            .use_fips(false)
15            .use_dual_stack(false)
16            .build()
17            .expect("invalid params");
18        let resolver = crate::config::endpoint::DefaultResolver::new();
19        let endpoint = resolver.resolve_endpoint(&params);
20        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.eu-west-1.amazonaws.com");
21        assert_eq!(
22            endpoint,
23            ::aws_smithy_types::endpoint::Endpoint::builder()
24                .url("https://workspaces-web.eu-west-1.amazonaws.com")
25                .build()
26        );
27    }
28
29    /// For region us-east-1 with FIPS disabled and DualStack disabled
30    #[test]
31    fn test_2() {
32        let params = crate::config::endpoint::Params::builder()
33            .region("us-east-1".to_string())
34            .use_fips(false)
35            .use_dual_stack(false)
36            .build()
37            .expect("invalid params");
38        let resolver = crate::config::endpoint::DefaultResolver::new();
39        let endpoint = resolver.resolve_endpoint(&params);
40        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-east-1.amazonaws.com");
41        assert_eq!(
42            endpoint,
43            ::aws_smithy_types::endpoint::Endpoint::builder()
44                .url("https://workspaces-web.us-east-1.amazonaws.com")
45                .build()
46        );
47    }
48
49    /// For region us-west-2 with FIPS disabled and DualStack disabled
50    #[test]
51    fn test_3() {
52        let params = crate::config::endpoint::Params::builder()
53            .region("us-west-2".to_string())
54            .use_fips(false)
55            .use_dual_stack(false)
56            .build()
57            .expect("invalid params");
58        let resolver = crate::config::endpoint::DefaultResolver::new();
59        let endpoint = resolver.resolve_endpoint(&params);
60        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-west-2.amazonaws.com");
61        assert_eq!(
62            endpoint,
63            ::aws_smithy_types::endpoint::Endpoint::builder()
64                .url("https://workspaces-web.us-west-2.amazonaws.com")
65                .build()
66        );
67    }
68
69    /// For region us-east-1 with FIPS enabled and DualStack enabled
70    #[test]
71    fn test_4() {
72        let params = crate::config::endpoint::Params::builder()
73            .region("us-east-1".to_string())
74            .use_fips(true)
75            .use_dual_stack(true)
76            .build()
77            .expect("invalid params");
78        let resolver = crate::config::endpoint::DefaultResolver::new();
79        let endpoint = resolver.resolve_endpoint(&params);
80        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-east-1.api.aws");
81        assert_eq!(
82            endpoint,
83            ::aws_smithy_types::endpoint::Endpoint::builder()
84                .url("https://workspaces-web-fips.us-east-1.api.aws")
85                .build()
86        );
87    }
88
89    /// For region us-east-1 with FIPS enabled and DualStack disabled
90    #[test]
91    fn test_5() {
92        let params = crate::config::endpoint::Params::builder()
93            .region("us-east-1".to_string())
94            .use_fips(true)
95            .use_dual_stack(false)
96            .build()
97            .expect("invalid params");
98        let resolver = crate::config::endpoint::DefaultResolver::new();
99        let endpoint = resolver.resolve_endpoint(&params);
100        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-east-1.amazonaws.com");
101        assert_eq!(
102            endpoint,
103            ::aws_smithy_types::endpoint::Endpoint::builder()
104                .url("https://workspaces-web-fips.us-east-1.amazonaws.com")
105                .build()
106        );
107    }
108
109    /// For region us-east-1 with FIPS disabled and DualStack enabled
110    #[test]
111    fn test_6() {
112        let params = crate::config::endpoint::Params::builder()
113            .region("us-east-1".to_string())
114            .use_fips(false)
115            .use_dual_stack(true)
116            .build()
117            .expect("invalid params");
118        let resolver = crate::config::endpoint::DefaultResolver::new();
119        let endpoint = resolver.resolve_endpoint(&params);
120        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-east-1.api.aws");
121        assert_eq!(
122            endpoint,
123            ::aws_smithy_types::endpoint::Endpoint::builder()
124                .url("https://workspaces-web.us-east-1.api.aws")
125                .build()
126        );
127    }
128
129    /// For region cn-north-1 with FIPS enabled and DualStack enabled
130    #[test]
131    fn test_7() {
132        let params = crate::config::endpoint::Params::builder()
133            .region("cn-north-1".to_string())
134            .use_fips(true)
135            .use_dual_stack(true)
136            .build()
137            .expect("invalid params");
138        let resolver = crate::config::endpoint::DefaultResolver::new();
139        let endpoint = resolver.resolve_endpoint(&params);
140        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.cn-north-1.api.amazonwebservices.com.cn");
141        assert_eq!(
142            endpoint,
143            ::aws_smithy_types::endpoint::Endpoint::builder()
144                .url("https://workspaces-web-fips.cn-north-1.api.amazonwebservices.com.cn")
145                .build()
146        );
147    }
148
149    /// For region cn-north-1 with FIPS enabled and DualStack disabled
150    #[test]
151    fn test_8() {
152        let params = crate::config::endpoint::Params::builder()
153            .region("cn-north-1".to_string())
154            .use_fips(true)
155            .use_dual_stack(false)
156            .build()
157            .expect("invalid params");
158        let resolver = crate::config::endpoint::DefaultResolver::new();
159        let endpoint = resolver.resolve_endpoint(&params);
160        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.cn-north-1.amazonaws.com.cn");
161        assert_eq!(
162            endpoint,
163            ::aws_smithy_types::endpoint::Endpoint::builder()
164                .url("https://workspaces-web-fips.cn-north-1.amazonaws.com.cn")
165                .build()
166        );
167    }
168
169    /// For region cn-north-1 with FIPS disabled and DualStack enabled
170    #[test]
171    fn test_9() {
172        let params = crate::config::endpoint::Params::builder()
173            .region("cn-north-1".to_string())
174            .use_fips(false)
175            .use_dual_stack(true)
176            .build()
177            .expect("invalid params");
178        let resolver = crate::config::endpoint::DefaultResolver::new();
179        let endpoint = resolver.resolve_endpoint(&params);
180        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.cn-north-1.api.amazonwebservices.com.cn");
181        assert_eq!(
182            endpoint,
183            ::aws_smithy_types::endpoint::Endpoint::builder()
184                .url("https://workspaces-web.cn-north-1.api.amazonwebservices.com.cn")
185                .build()
186        );
187    }
188
189    /// For region cn-north-1 with FIPS disabled and DualStack disabled
190    #[test]
191    fn test_10() {
192        let params = crate::config::endpoint::Params::builder()
193            .region("cn-north-1".to_string())
194            .use_fips(false)
195            .use_dual_stack(false)
196            .build()
197            .expect("invalid params");
198        let resolver = crate::config::endpoint::DefaultResolver::new();
199        let endpoint = resolver.resolve_endpoint(&params);
200        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.cn-north-1.amazonaws.com.cn");
201        assert_eq!(
202            endpoint,
203            ::aws_smithy_types::endpoint::Endpoint::builder()
204                .url("https://workspaces-web.cn-north-1.amazonaws.com.cn")
205                .build()
206        );
207    }
208
209    /// For region us-gov-east-1 with FIPS enabled and DualStack enabled
210    #[test]
211    fn test_11() {
212        let params = crate::config::endpoint::Params::builder()
213            .region("us-gov-east-1".to_string())
214            .use_fips(true)
215            .use_dual_stack(true)
216            .build()
217            .expect("invalid params");
218        let resolver = crate::config::endpoint::DefaultResolver::new();
219        let endpoint = resolver.resolve_endpoint(&params);
220        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-gov-east-1.api.aws");
221        assert_eq!(
222            endpoint,
223            ::aws_smithy_types::endpoint::Endpoint::builder()
224                .url("https://workspaces-web-fips.us-gov-east-1.api.aws")
225                .build()
226        );
227    }
228
229    /// For region us-gov-east-1 with FIPS enabled and DualStack disabled
230    #[test]
231    fn test_12() {
232        let params = crate::config::endpoint::Params::builder()
233            .region("us-gov-east-1".to_string())
234            .use_fips(true)
235            .use_dual_stack(false)
236            .build()
237            .expect("invalid params");
238        let resolver = crate::config::endpoint::DefaultResolver::new();
239        let endpoint = resolver.resolve_endpoint(&params);
240        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-gov-east-1.amazonaws.com");
241        assert_eq!(
242            endpoint,
243            ::aws_smithy_types::endpoint::Endpoint::builder()
244                .url("https://workspaces-web-fips.us-gov-east-1.amazonaws.com")
245                .build()
246        );
247    }
248
249    /// For region us-gov-east-1 with FIPS disabled and DualStack enabled
250    #[test]
251    fn test_13() {
252        let params = crate::config::endpoint::Params::builder()
253            .region("us-gov-east-1".to_string())
254            .use_fips(false)
255            .use_dual_stack(true)
256            .build()
257            .expect("invalid params");
258        let resolver = crate::config::endpoint::DefaultResolver::new();
259        let endpoint = resolver.resolve_endpoint(&params);
260        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-gov-east-1.api.aws");
261        assert_eq!(
262            endpoint,
263            ::aws_smithy_types::endpoint::Endpoint::builder()
264                .url("https://workspaces-web.us-gov-east-1.api.aws")
265                .build()
266        );
267    }
268
269    /// For region us-gov-east-1 with FIPS disabled and DualStack disabled
270    #[test]
271    fn test_14() {
272        let params = crate::config::endpoint::Params::builder()
273            .region("us-gov-east-1".to_string())
274            .use_fips(false)
275            .use_dual_stack(false)
276            .build()
277            .expect("invalid params");
278        let resolver = crate::config::endpoint::DefaultResolver::new();
279        let endpoint = resolver.resolve_endpoint(&params);
280        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-gov-east-1.amazonaws.com");
281        assert_eq!(
282            endpoint,
283            ::aws_smithy_types::endpoint::Endpoint::builder()
284                .url("https://workspaces-web.us-gov-east-1.amazonaws.com")
285                .build()
286        );
287    }
288
289    /// For region us-iso-east-1 with FIPS enabled and DualStack disabled
290    #[test]
291    fn test_15() {
292        let params = crate::config::endpoint::Params::builder()
293            .region("us-iso-east-1".to_string())
294            .use_fips(true)
295            .use_dual_stack(false)
296            .build()
297            .expect("invalid params");
298        let resolver = crate::config::endpoint::DefaultResolver::new();
299        let endpoint = resolver.resolve_endpoint(&params);
300        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-iso-east-1.c2s.ic.gov");
301        assert_eq!(
302            endpoint,
303            ::aws_smithy_types::endpoint::Endpoint::builder()
304                .url("https://workspaces-web-fips.us-iso-east-1.c2s.ic.gov")
305                .build()
306        );
307    }
308
309    /// For region us-iso-east-1 with FIPS disabled and DualStack disabled
310    #[test]
311    fn test_16() {
312        let params = crate::config::endpoint::Params::builder()
313            .region("us-iso-east-1".to_string())
314            .use_fips(false)
315            .use_dual_stack(false)
316            .build()
317            .expect("invalid params");
318        let resolver = crate::config::endpoint::DefaultResolver::new();
319        let endpoint = resolver.resolve_endpoint(&params);
320        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-iso-east-1.c2s.ic.gov");
321        assert_eq!(
322            endpoint,
323            ::aws_smithy_types::endpoint::Endpoint::builder()
324                .url("https://workspaces-web.us-iso-east-1.c2s.ic.gov")
325                .build()
326        );
327    }
328
329    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
330    #[test]
331    fn test_17() {
332        let params = crate::config::endpoint::Params::builder()
333            .region("us-isob-east-1".to_string())
334            .use_fips(true)
335            .use_dual_stack(false)
336            .build()
337            .expect("invalid params");
338        let resolver = crate::config::endpoint::DefaultResolver::new();
339        let endpoint = resolver.resolve_endpoint(&params);
340        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web-fips.us-isob-east-1.sc2s.sgov.gov");
341        assert_eq!(
342            endpoint,
343            ::aws_smithy_types::endpoint::Endpoint::builder()
344                .url("https://workspaces-web-fips.us-isob-east-1.sc2s.sgov.gov")
345                .build()
346        );
347    }
348
349    /// For region us-isob-east-1 with FIPS disabled and DualStack disabled
350    #[test]
351    fn test_18() {
352        let params = crate::config::endpoint::Params::builder()
353            .region("us-isob-east-1".to_string())
354            .use_fips(false)
355            .use_dual_stack(false)
356            .build()
357            .expect("invalid params");
358        let resolver = crate::config::endpoint::DefaultResolver::new();
359        let endpoint = resolver.resolve_endpoint(&params);
360        let endpoint = endpoint.expect("Expected valid endpoint: https://workspaces-web.us-isob-east-1.sc2s.sgov.gov");
361        assert_eq!(
362            endpoint,
363            ::aws_smithy_types::endpoint::Endpoint::builder()
364                .url("https://workspaces-web.us-isob-east-1.sc2s.sgov.gov")
365                .build()
366        );
367    }
368
369    /// For custom endpoint with region set and fips disabled and dualstack disabled
370    #[test]
371    fn test_19() {
372        let params = crate::config::endpoint::Params::builder()
373            .region("us-east-1".to_string())
374            .use_fips(false)
375            .use_dual_stack(false)
376            .endpoint("https://example.com".to_string())
377            .build()
378            .expect("invalid params");
379        let resolver = crate::config::endpoint::DefaultResolver::new();
380        let endpoint = resolver.resolve_endpoint(&params);
381        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
382        assert_eq!(
383            endpoint,
384            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
385        );
386    }
387
388    /// For custom endpoint with region not set and fips disabled and dualstack disabled
389    #[test]
390    fn test_20() {
391        let params = crate::config::endpoint::Params::builder()
392            .use_fips(false)
393            .use_dual_stack(false)
394            .endpoint("https://example.com".to_string())
395            .build()
396            .expect("invalid params");
397        let resolver = crate::config::endpoint::DefaultResolver::new();
398        let endpoint = resolver.resolve_endpoint(&params);
399        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
400        assert_eq!(
401            endpoint,
402            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
403        );
404    }
405
406    /// For custom endpoint with fips enabled and dualstack disabled
407    #[test]
408    fn test_21() {
409        let params = crate::config::endpoint::Params::builder()
410            .region("us-east-1".to_string())
411            .use_fips(true)
412            .use_dual_stack(false)
413            .endpoint("https://example.com".to_string())
414            .build()
415            .expect("invalid params");
416        let resolver = crate::config::endpoint::DefaultResolver::new();
417        let endpoint = resolver.resolve_endpoint(&params);
418        let error = endpoint.expect_err("expected error: Invalid Configuration: FIPS and custom endpoint are not supported [For custom endpoint with fips enabled and dualstack disabled]");
419        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
420    }
421
422    /// For custom endpoint with fips disabled and dualstack enabled
423    #[test]
424    fn test_22() {
425        let params = crate::config::endpoint::Params::builder()
426            .region("us-east-1".to_string())
427            .use_fips(false)
428            .use_dual_stack(true)
429            .endpoint("https://example.com".to_string())
430            .build()
431            .expect("invalid params");
432        let resolver = crate::config::endpoint::DefaultResolver::new();
433        let endpoint = resolver.resolve_endpoint(&params);
434        let error = endpoint.expect_err("expected error: Invalid Configuration: Dualstack and custom endpoint are not supported [For custom endpoint with fips disabled and dualstack enabled]");
435        assert_eq!(
436            format!("{}", error),
437            "Invalid Configuration: Dualstack and custom endpoint are not supported"
438        )
439    }
440
441    /// Missing region
442    #[test]
443    fn test_23() {
444        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
445        let resolver = crate::config::endpoint::DefaultResolver::new();
446        let endpoint = resolver.resolve_endpoint(&params);
447        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
448        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
449    }
450}
451
452/// Endpoint resolver trait specific to Amazon WorkSpaces Web
453pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
454    /// Resolve an endpoint with the given parameters
455    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
456
457    /// Convert this service-specific resolver into a `SharedEndpointResolver`
458    ///
459    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
460    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
461    where
462        Self: Sized + 'static,
463    {
464        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
465    }
466}
467
468#[derive(Debug)]
469struct DowncastParams<T>(T);
470impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
471where
472    T: ResolveEndpoint,
473{
474    fn resolve_endpoint<'a>(
475        &'a self,
476        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
477    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
478        let ep = match params.get::<crate::config::endpoint::Params>() {
479            Some(params) => self.0.resolve_endpoint(params),
480            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
481        };
482        ep
483    }
484}
485
486/// The default endpoint resolver
487#[derive(Debug, Default)]
488pub struct DefaultResolver {
489    partition_resolver: crate::endpoint_lib::partition::PartitionResolver,
490}
491
492impl DefaultResolver {
493    /// Create a new endpoint resolver with default settings
494    pub fn new() -> Self {
495        Self {
496            partition_resolver: crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER.clone(),
497        }
498    }
499
500    fn resolve_endpoint(
501        &self,
502        params: &crate::config::endpoint::Params,
503    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
504        let mut diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
505        Ok(
506            crate::config::endpoint::internals::resolve_endpoint(params, &mut diagnostic_collector, &self.partition_resolver)
507                .map_err(|err| err.with_source(diagnostic_collector.take_last_error()))?,
508        )
509    }
510}
511
512impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
513    fn resolve_endpoint(&self, params: &crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'_> {
514        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(self.resolve_endpoint(params))
515    }
516}
517
518#[non_exhaustive]
519#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
520/// Configuration parameters for resolving the correct endpoint
521pub struct Params {
522    /// The AWS region used to dispatch the request.
523    pub(crate) region: ::std::option::Option<::std::string::String>,
524    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
525    pub(crate) use_dual_stack: bool,
526    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
527    pub(crate) use_fips: bool,
528    /// Override the endpoint used to send this request
529    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
530}
531impl Params {
532    /// Create a builder for [`Params`]
533    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
534        crate::config::endpoint::ParamsBuilder::default()
535    }
536    /// The AWS region used to dispatch the request.
537    pub fn region(&self) -> ::std::option::Option<&str> {
538        self.region.as_deref()
539    }
540    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
541    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
542        Some(self.use_dual_stack)
543    }
544    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
545    pub fn use_fips(&self) -> ::std::option::Option<bool> {
546        Some(self.use_fips)
547    }
548    /// Override the endpoint used to send this request
549    pub fn endpoint(&self) -> ::std::option::Option<&str> {
550        self.endpoint.as_deref()
551    }
552}
553
554/// Builder for [`Params`]
555#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
556pub struct ParamsBuilder {
557    region: ::std::option::Option<::std::string::String>,
558    use_dual_stack: ::std::option::Option<bool>,
559    use_fips: ::std::option::Option<bool>,
560    endpoint: ::std::option::Option<::std::string::String>,
561}
562impl ParamsBuilder {
563    /// Consume this builder, creating [`Params`].
564    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
565        Ok(
566            #[allow(clippy::unnecessary_lazy_evaluations)]
567            crate::config::endpoint::Params {
568                region: self.region,
569                use_dual_stack: self
570                    .use_dual_stack
571                    .or_else(|| Some(false))
572                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
573                use_fips: self
574                    .use_fips
575                    .or_else(|| Some(false))
576                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
577                endpoint: self.endpoint,
578            },
579        )
580    }
581    /// Sets the value for region
582    ///
583    /// The AWS region used to dispatch the request.
584    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
585        self.region = Some(value.into());
586        self
587    }
588
589    /// Sets the value for region
590    ///
591    /// The AWS region used to dispatch the request.
592    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
593        self.region = param;
594        self
595    }
596    /// Sets the value for use_dual_stack
597    ///
598    /// When unset, this parameter has a default value of `false`.
599    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
600    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
601        self.use_dual_stack = Some(value.into());
602        self
603    }
604
605    /// Sets the value for use_dual_stack
606    ///
607    /// When unset, this parameter has a default value of `false`.
608    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
609    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
610        self.use_dual_stack = param;
611        self
612    }
613    /// Sets the value for use_fips
614    ///
615    /// When unset, this parameter has a default value of `false`.
616    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
617    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
618        self.use_fips = Some(value.into());
619        self
620    }
621
622    /// Sets the value for use_fips
623    ///
624    /// When unset, this parameter has a default value of `false`.
625    /// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
626    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
627        self.use_fips = param;
628        self
629    }
630    /// Sets the value for endpoint
631    ///
632    /// Override the endpoint used to send this request
633    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
634        self.endpoint = Some(value.into());
635        self
636    }
637
638    /// Sets the value for endpoint
639    ///
640    /// Override the endpoint used to send this request
641    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
642        self.endpoint = param;
643        self
644    }
645}
646
647/// An error that occurred during endpoint resolution
648#[derive(Debug)]
649pub struct InvalidParams {
650    field: std::borrow::Cow<'static, str>,
651}
652
653impl InvalidParams {
654    #[allow(dead_code)]
655    fn missing(field: &'static str) -> Self {
656        Self { field: field.into() }
657    }
658}
659
660impl std::fmt::Display for InvalidParams {
661    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
662        write!(f, "a required field was missing: `{}`", self.field)
663    }
664}
665
666impl std::error::Error for InvalidParams {}
667
668mod internals;