aws_sdk_machinelearning/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://machinelearning.eu-west-1.amazonaws.com");
21        assert_eq!(
22            endpoint,
23            ::aws_smithy_types::endpoint::Endpoint::builder()
24                .url("https://machinelearning.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://machinelearning.us-east-1.amazonaws.com");
41        assert_eq!(
42            endpoint,
43            ::aws_smithy_types::endpoint::Endpoint::builder()
44                .url("https://machinelearning.us-east-1.amazonaws.com")
45                .build()
46        );
47    }
48
49    /// For region us-east-1 with FIPS enabled and DualStack enabled
50    #[test]
51    fn test_3() {
52        let params = crate::config::endpoint::Params::builder()
53            .region("us-east-1".to_string())
54            .use_fips(true)
55            .use_dual_stack(true)
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://machinelearning-fips.us-east-1.api.aws");
61        assert_eq!(
62            endpoint,
63            ::aws_smithy_types::endpoint::Endpoint::builder()
64                .url("https://machinelearning-fips.us-east-1.api.aws")
65                .build()
66        );
67    }
68
69    /// For region us-east-1 with FIPS enabled and DualStack disabled
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(false)
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://machinelearning-fips.us-east-1.amazonaws.com");
81        assert_eq!(
82            endpoint,
83            ::aws_smithy_types::endpoint::Endpoint::builder()
84                .url("https://machinelearning-fips.us-east-1.amazonaws.com")
85                .build()
86        );
87    }
88
89    /// For region us-east-1 with FIPS disabled and DualStack enabled
90    #[test]
91    fn test_5() {
92        let params = crate::config::endpoint::Params::builder()
93            .region("us-east-1".to_string())
94            .use_fips(false)
95            .use_dual_stack(true)
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://machinelearning.us-east-1.api.aws");
101        assert_eq!(
102            endpoint,
103            ::aws_smithy_types::endpoint::Endpoint::builder()
104                .url("https://machinelearning.us-east-1.api.aws")
105                .build()
106        );
107    }
108
109    /// For region cn-north-1 with FIPS enabled and DualStack enabled
110    #[test]
111    fn test_6() {
112        let params = crate::config::endpoint::Params::builder()
113            .region("cn-north-1".to_string())
114            .use_fips(true)
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://machinelearning-fips.cn-north-1.api.amazonwebservices.com.cn");
121        assert_eq!(
122            endpoint,
123            ::aws_smithy_types::endpoint::Endpoint::builder()
124                .url("https://machinelearning-fips.cn-north-1.api.amazonwebservices.com.cn")
125                .build()
126        );
127    }
128
129    /// For region cn-north-1 with FIPS enabled and DualStack disabled
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(false)
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://machinelearning-fips.cn-north-1.amazonaws.com.cn");
141        assert_eq!(
142            endpoint,
143            ::aws_smithy_types::endpoint::Endpoint::builder()
144                .url("https://machinelearning-fips.cn-north-1.amazonaws.com.cn")
145                .build()
146        );
147    }
148
149    /// For region cn-north-1 with FIPS disabled and DualStack enabled
150    #[test]
151    fn test_8() {
152        let params = crate::config::endpoint::Params::builder()
153            .region("cn-north-1".to_string())
154            .use_fips(false)
155            .use_dual_stack(true)
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://machinelearning.cn-north-1.api.amazonwebservices.com.cn");
161        assert_eq!(
162            endpoint,
163            ::aws_smithy_types::endpoint::Endpoint::builder()
164                .url("https://machinelearning.cn-north-1.api.amazonwebservices.com.cn")
165                .build()
166        );
167    }
168
169    /// For region cn-north-1 with FIPS disabled and DualStack disabled
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(false)
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://machinelearning.cn-north-1.amazonaws.com.cn");
181        assert_eq!(
182            endpoint,
183            ::aws_smithy_types::endpoint::Endpoint::builder()
184                .url("https://machinelearning.cn-north-1.amazonaws.com.cn")
185                .build()
186        );
187    }
188
189    /// For region us-gov-east-1 with FIPS enabled and DualStack enabled
190    #[test]
191    fn test_10() {
192        let params = crate::config::endpoint::Params::builder()
193            .region("us-gov-east-1".to_string())
194            .use_fips(true)
195            .use_dual_stack(true)
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://machinelearning-fips.us-gov-east-1.api.aws");
201        assert_eq!(
202            endpoint,
203            ::aws_smithy_types::endpoint::Endpoint::builder()
204                .url("https://machinelearning-fips.us-gov-east-1.api.aws")
205                .build()
206        );
207    }
208
209    /// For region us-gov-east-1 with FIPS enabled and DualStack disabled
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(false)
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://machinelearning-fips.us-gov-east-1.amazonaws.com");
221        assert_eq!(
222            endpoint,
223            ::aws_smithy_types::endpoint::Endpoint::builder()
224                .url("https://machinelearning-fips.us-gov-east-1.amazonaws.com")
225                .build()
226        );
227    }
228
229    /// For region us-gov-east-1 with FIPS disabled and DualStack enabled
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(false)
235            .use_dual_stack(true)
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://machinelearning.us-gov-east-1.api.aws");
241        assert_eq!(
242            endpoint,
243            ::aws_smithy_types::endpoint::Endpoint::builder()
244                .url("https://machinelearning.us-gov-east-1.api.aws")
245                .build()
246        );
247    }
248
249    /// For region us-gov-east-1 with FIPS disabled and DualStack disabled
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(false)
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://machinelearning.us-gov-east-1.amazonaws.com");
261        assert_eq!(
262            endpoint,
263            ::aws_smithy_types::endpoint::Endpoint::builder()
264                .url("https://machinelearning.us-gov-east-1.amazonaws.com")
265                .build()
266        );
267    }
268
269    /// For region us-iso-east-1 with FIPS enabled and DualStack enabled
270    #[test]
271    fn test_14() {
272        let params = crate::config::endpoint::Params::builder()
273            .region("us-iso-east-1".to_string())
274            .use_fips(true)
275            .use_dual_stack(true)
276            .build()
277            .expect("invalid params");
278        let resolver = crate::config::endpoint::DefaultResolver::new();
279        let endpoint = resolver.resolve_endpoint(&params);
280        let error = endpoint.expect_err("expected error: FIPS and DualStack are enabled, but this partition does not support one or both [For region us-iso-east-1 with FIPS enabled and DualStack enabled]");
281        assert_eq!(
282            format!("{}", error),
283            "FIPS and DualStack are enabled, but this partition does not support one or both"
284        )
285    }
286
287    /// For region us-iso-east-1 with FIPS enabled and DualStack disabled
288    #[test]
289    fn test_15() {
290        let params = crate::config::endpoint::Params::builder()
291            .region("us-iso-east-1".to_string())
292            .use_fips(true)
293            .use_dual_stack(false)
294            .build()
295            .expect("invalid params");
296        let resolver = crate::config::endpoint::DefaultResolver::new();
297        let endpoint = resolver.resolve_endpoint(&params);
298        let endpoint = endpoint.expect("Expected valid endpoint: https://machinelearning-fips.us-iso-east-1.c2s.ic.gov");
299        assert_eq!(
300            endpoint,
301            ::aws_smithy_types::endpoint::Endpoint::builder()
302                .url("https://machinelearning-fips.us-iso-east-1.c2s.ic.gov")
303                .build()
304        );
305    }
306
307    /// For region us-iso-east-1 with FIPS disabled and DualStack enabled
308    #[test]
309    fn test_16() {
310        let params = crate::config::endpoint::Params::builder()
311            .region("us-iso-east-1".to_string())
312            .use_fips(false)
313            .use_dual_stack(true)
314            .build()
315            .expect("invalid params");
316        let resolver = crate::config::endpoint::DefaultResolver::new();
317        let endpoint = resolver.resolve_endpoint(&params);
318        let error = endpoint.expect_err("expected error: DualStack is enabled but this partition does not support DualStack [For region us-iso-east-1 with FIPS disabled and DualStack enabled]");
319        assert_eq!(format!("{}", error), "DualStack is enabled but this partition does not support DualStack")
320    }
321
322    /// For region us-iso-east-1 with FIPS disabled and DualStack disabled
323    #[test]
324    fn test_17() {
325        let params = crate::config::endpoint::Params::builder()
326            .region("us-iso-east-1".to_string())
327            .use_fips(false)
328            .use_dual_stack(false)
329            .build()
330            .expect("invalid params");
331        let resolver = crate::config::endpoint::DefaultResolver::new();
332        let endpoint = resolver.resolve_endpoint(&params);
333        let endpoint = endpoint.expect("Expected valid endpoint: https://machinelearning.us-iso-east-1.c2s.ic.gov");
334        assert_eq!(
335            endpoint,
336            ::aws_smithy_types::endpoint::Endpoint::builder()
337                .url("https://machinelearning.us-iso-east-1.c2s.ic.gov")
338                .build()
339        );
340    }
341
342    /// For region us-isob-east-1 with FIPS enabled and DualStack enabled
343    #[test]
344    fn test_18() {
345        let params = crate::config::endpoint::Params::builder()
346            .region("us-isob-east-1".to_string())
347            .use_fips(true)
348            .use_dual_stack(true)
349            .build()
350            .expect("invalid params");
351        let resolver = crate::config::endpoint::DefaultResolver::new();
352        let endpoint = resolver.resolve_endpoint(&params);
353        let error = endpoint.expect_err("expected error: FIPS and DualStack are enabled, but this partition does not support one or both [For region us-isob-east-1 with FIPS enabled and DualStack enabled]");
354        assert_eq!(
355            format!("{}", error),
356            "FIPS and DualStack are enabled, but this partition does not support one or both"
357        )
358    }
359
360    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
361    #[test]
362    fn test_19() {
363        let params = crate::config::endpoint::Params::builder()
364            .region("us-isob-east-1".to_string())
365            .use_fips(true)
366            .use_dual_stack(false)
367            .build()
368            .expect("invalid params");
369        let resolver = crate::config::endpoint::DefaultResolver::new();
370        let endpoint = resolver.resolve_endpoint(&params);
371        let endpoint = endpoint.expect("Expected valid endpoint: https://machinelearning-fips.us-isob-east-1.sc2s.sgov.gov");
372        assert_eq!(
373            endpoint,
374            ::aws_smithy_types::endpoint::Endpoint::builder()
375                .url("https://machinelearning-fips.us-isob-east-1.sc2s.sgov.gov")
376                .build()
377        );
378    }
379
380    /// For region us-isob-east-1 with FIPS disabled and DualStack enabled
381    #[test]
382    fn test_20() {
383        let params = crate::config::endpoint::Params::builder()
384            .region("us-isob-east-1".to_string())
385            .use_fips(false)
386            .use_dual_stack(true)
387            .build()
388            .expect("invalid params");
389        let resolver = crate::config::endpoint::DefaultResolver::new();
390        let endpoint = resolver.resolve_endpoint(&params);
391        let error = endpoint.expect_err("expected error: DualStack is enabled but this partition does not support DualStack [For region us-isob-east-1 with FIPS disabled and DualStack enabled]");
392        assert_eq!(format!("{}", error), "DualStack is enabled but this partition does not support DualStack")
393    }
394
395    /// For region us-isob-east-1 with FIPS disabled and DualStack disabled
396    #[test]
397    fn test_21() {
398        let params = crate::config::endpoint::Params::builder()
399            .region("us-isob-east-1".to_string())
400            .use_fips(false)
401            .use_dual_stack(false)
402            .build()
403            .expect("invalid params");
404        let resolver = crate::config::endpoint::DefaultResolver::new();
405        let endpoint = resolver.resolve_endpoint(&params);
406        let endpoint = endpoint.expect("Expected valid endpoint: https://machinelearning.us-isob-east-1.sc2s.sgov.gov");
407        assert_eq!(
408            endpoint,
409            ::aws_smithy_types::endpoint::Endpoint::builder()
410                .url("https://machinelearning.us-isob-east-1.sc2s.sgov.gov")
411                .build()
412        );
413    }
414
415    /// For custom endpoint with region set and fips disabled and dualstack disabled
416    #[test]
417    fn test_22() {
418        let params = crate::config::endpoint::Params::builder()
419            .region("us-east-1".to_string())
420            .use_fips(false)
421            .use_dual_stack(false)
422            .endpoint("https://example.com".to_string())
423            .build()
424            .expect("invalid params");
425        let resolver = crate::config::endpoint::DefaultResolver::new();
426        let endpoint = resolver.resolve_endpoint(&params);
427        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
428        assert_eq!(
429            endpoint,
430            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
431        );
432    }
433
434    /// For custom endpoint with region not set and fips disabled and dualstack disabled
435    #[test]
436    fn test_23() {
437        let params = crate::config::endpoint::Params::builder()
438            .use_fips(false)
439            .use_dual_stack(false)
440            .endpoint("https://example.com".to_string())
441            .build()
442            .expect("invalid params");
443        let resolver = crate::config::endpoint::DefaultResolver::new();
444        let endpoint = resolver.resolve_endpoint(&params);
445        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
446        assert_eq!(
447            endpoint,
448            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
449        );
450    }
451
452    /// For custom endpoint with fips enabled and dualstack disabled
453    #[test]
454    fn test_24() {
455        let params = crate::config::endpoint::Params::builder()
456            .region("us-east-1".to_string())
457            .use_fips(true)
458            .use_dual_stack(false)
459            .endpoint("https://example.com".to_string())
460            .build()
461            .expect("invalid params");
462        let resolver = crate::config::endpoint::DefaultResolver::new();
463        let endpoint = resolver.resolve_endpoint(&params);
464        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]");
465        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
466    }
467
468    /// For custom endpoint with fips disabled and dualstack enabled
469    #[test]
470    fn test_25() {
471        let params = crate::config::endpoint::Params::builder()
472            .region("us-east-1".to_string())
473            .use_fips(false)
474            .use_dual_stack(true)
475            .endpoint("https://example.com".to_string())
476            .build()
477            .expect("invalid params");
478        let resolver = crate::config::endpoint::DefaultResolver::new();
479        let endpoint = resolver.resolve_endpoint(&params);
480        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]");
481        assert_eq!(
482            format!("{}", error),
483            "Invalid Configuration: Dualstack and custom endpoint are not supported"
484        )
485    }
486
487    /// Missing region
488    #[test]
489    fn test_26() {
490        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
491        let resolver = crate::config::endpoint::DefaultResolver::new();
492        let endpoint = resolver.resolve_endpoint(&params);
493        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
494        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
495    }
496}
497
498/// Endpoint resolver trait specific to Amazon Machine Learning
499pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
500    /// Resolve an endpoint with the given parameters
501    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
502
503    /// Convert this service-specific resolver into a `SharedEndpointResolver`
504    ///
505    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
506    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
507    where
508        Self: Sized + 'static,
509    {
510        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
511    }
512}
513
514#[derive(Debug)]
515struct DowncastParams<T>(T);
516impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
517where
518    T: ResolveEndpoint,
519{
520    fn resolve_endpoint<'a>(
521        &'a self,
522        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
523    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
524        let ep = match params.get::<crate::config::endpoint::Params>() {
525            Some(params) => self.0.resolve_endpoint(params),
526            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
527        };
528        ep
529    }
530}
531
532/// The default endpoint resolver
533#[derive(Debug, Default)]
534pub struct DefaultResolver {
535    partition_resolver: crate::endpoint_lib::partition::PartitionResolver,
536}
537
538impl DefaultResolver {
539    /// Create a new endpoint resolver with default settings
540    pub fn new() -> Self {
541        Self {
542            partition_resolver: crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER.clone(),
543        }
544    }
545
546    fn resolve_endpoint(
547        &self,
548        params: &crate::config::endpoint::Params,
549    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
550        let mut diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
551        Ok(
552            crate::config::endpoint::internals::resolve_endpoint(params, &mut diagnostic_collector, &self.partition_resolver)
553                .map_err(|err| err.with_source(diagnostic_collector.take_last_error()))?,
554        )
555    }
556}
557
558impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
559    fn resolve_endpoint(&self, params: &crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture {
560        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(self.resolve_endpoint(params))
561    }
562}
563
564#[non_exhaustive]
565#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
566/// Configuration parameters for resolving the correct endpoint
567pub struct Params {
568    /// The AWS region used to dispatch the request.
569    pub(crate) region: ::std::option::Option<::std::string::String>,
570    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
571    pub(crate) use_dual_stack: bool,
572    /// 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.
573    pub(crate) use_fips: bool,
574    /// Override the endpoint used to send this request
575    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
576}
577impl Params {
578    /// Create a builder for [`Params`]
579    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
580        crate::config::endpoint::ParamsBuilder::default()
581    }
582    /// The AWS region used to dispatch the request.
583    pub fn region(&self) -> ::std::option::Option<&str> {
584        self.region.as_deref()
585    }
586    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
587    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
588        Some(self.use_dual_stack)
589    }
590    /// 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.
591    pub fn use_fips(&self) -> ::std::option::Option<bool> {
592        Some(self.use_fips)
593    }
594    /// Override the endpoint used to send this request
595    pub fn endpoint(&self) -> ::std::option::Option<&str> {
596        self.endpoint.as_deref()
597    }
598}
599
600/// Builder for [`Params`]
601#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
602pub struct ParamsBuilder {
603    region: ::std::option::Option<::std::string::String>,
604    use_dual_stack: ::std::option::Option<bool>,
605    use_fips: ::std::option::Option<bool>,
606    endpoint: ::std::option::Option<::std::string::String>,
607}
608impl ParamsBuilder {
609    /// Consume this builder, creating [`Params`].
610    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
611        Ok(
612            #[allow(clippy::unnecessary_lazy_evaluations)]
613            crate::config::endpoint::Params {
614                region: self.region,
615                use_dual_stack: self
616                    .use_dual_stack
617                    .or_else(|| Some(false))
618                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
619                use_fips: self
620                    .use_fips
621                    .or_else(|| Some(false))
622                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
623                endpoint: self.endpoint,
624            },
625        )
626    }
627    /// Sets the value for region
628    ///
629    /// The AWS region used to dispatch the request.
630    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
631        self.region = Some(value.into());
632        self
633    }
634
635    /// Sets the value for region
636    ///
637    /// The AWS region used to dispatch the request.
638    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
639        self.region = param;
640        self
641    }
642    /// Sets the value for use_dual_stack
643    ///
644    /// When unset, this parameter has a default value of `false`.
645    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
646    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
647        self.use_dual_stack = Some(value.into());
648        self
649    }
650
651    /// Sets the value for use_dual_stack
652    ///
653    /// When unset, this parameter has a default value of `false`.
654    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
655    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
656        self.use_dual_stack = param;
657        self
658    }
659    /// Sets the value for use_fips
660    ///
661    /// When unset, this parameter has a default value of `false`.
662    /// 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.
663    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
664        self.use_fips = Some(value.into());
665        self
666    }
667
668    /// Sets the value for use_fips
669    ///
670    /// When unset, this parameter has a default value of `false`.
671    /// 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.
672    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
673        self.use_fips = param;
674        self
675    }
676    /// Sets the value for endpoint
677    ///
678    /// Override the endpoint used to send this request
679    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
680        self.endpoint = Some(value.into());
681        self
682    }
683
684    /// Sets the value for endpoint
685    ///
686    /// Override the endpoint used to send this request
687    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
688        self.endpoint = param;
689        self
690    }
691}
692
693/// An error that occurred during endpoint resolution
694#[derive(Debug)]
695pub struct InvalidParams {
696    field: std::borrow::Cow<'static, str>,
697}
698
699impl InvalidParams {
700    #[allow(dead_code)]
701    fn missing(field: &'static str) -> Self {
702        Self { field: field.into() }
703    }
704}
705
706impl std::fmt::Display for InvalidParams {
707    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
708        write!(f, "a required field was missing: `{}`", self.field)
709    }
710}
711
712impl std::error::Error for InvalidParams {}
713
714mod internals;