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 disabled
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(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://machinelearning-fips.us-iso-east-1.c2s.ic.gov");
281        assert_eq!(
282            endpoint,
283            ::aws_smithy_types::endpoint::Endpoint::builder()
284                .url("https://machinelearning-fips.us-iso-east-1.c2s.ic.gov")
285                .build()
286        );
287    }
288
289    /// For region us-iso-east-1 with FIPS disabled 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(false)
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://machinelearning.us-iso-east-1.c2s.ic.gov");
301        assert_eq!(
302            endpoint,
303            ::aws_smithy_types::endpoint::Endpoint::builder()
304                .url("https://machinelearning.us-iso-east-1.c2s.ic.gov")
305                .build()
306        );
307    }
308
309    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
310    #[test]
311    fn test_16() {
312        let params = crate::config::endpoint::Params::builder()
313            .region("us-isob-east-1".to_string())
314            .use_fips(true)
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://machinelearning-fips.us-isob-east-1.sc2s.sgov.gov");
321        assert_eq!(
322            endpoint,
323            ::aws_smithy_types::endpoint::Endpoint::builder()
324                .url("https://machinelearning-fips.us-isob-east-1.sc2s.sgov.gov")
325                .build()
326        );
327    }
328
329    /// For region us-isob-east-1 with FIPS disabled 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(false)
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://machinelearning.us-isob-east-1.sc2s.sgov.gov");
341        assert_eq!(
342            endpoint,
343            ::aws_smithy_types::endpoint::Endpoint::builder()
344                .url("https://machinelearning.us-isob-east-1.sc2s.sgov.gov")
345                .build()
346        );
347    }
348
349    /// For custom endpoint with region set and fips disabled and dualstack disabled
350    #[test]
351    fn test_18() {
352        let params = crate::config::endpoint::Params::builder()
353            .region("us-east-1".to_string())
354            .use_fips(false)
355            .use_dual_stack(false)
356            .endpoint("https://example.com".to_string())
357            .build()
358            .expect("invalid params");
359        let resolver = crate::config::endpoint::DefaultResolver::new();
360        let endpoint = resolver.resolve_endpoint(&params);
361        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
362        assert_eq!(
363            endpoint,
364            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
365        );
366    }
367
368    /// For custom endpoint with region not set and fips disabled and dualstack disabled
369    #[test]
370    fn test_19() {
371        let params = crate::config::endpoint::Params::builder()
372            .use_fips(false)
373            .use_dual_stack(false)
374            .endpoint("https://example.com".to_string())
375            .build()
376            .expect("invalid params");
377        let resolver = crate::config::endpoint::DefaultResolver::new();
378        let endpoint = resolver.resolve_endpoint(&params);
379        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
380        assert_eq!(
381            endpoint,
382            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
383        );
384    }
385
386    /// For custom endpoint with fips enabled and dualstack disabled
387    #[test]
388    fn test_20() {
389        let params = crate::config::endpoint::Params::builder()
390            .region("us-east-1".to_string())
391            .use_fips(true)
392            .use_dual_stack(false)
393            .endpoint("https://example.com".to_string())
394            .build()
395            .expect("invalid params");
396        let resolver = crate::config::endpoint::DefaultResolver::new();
397        let endpoint = resolver.resolve_endpoint(&params);
398        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]");
399        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
400    }
401
402    /// For custom endpoint with fips disabled and dualstack enabled
403    #[test]
404    fn test_21() {
405        let params = crate::config::endpoint::Params::builder()
406            .region("us-east-1".to_string())
407            .use_fips(false)
408            .use_dual_stack(true)
409            .endpoint("https://example.com".to_string())
410            .build()
411            .expect("invalid params");
412        let resolver = crate::config::endpoint::DefaultResolver::new();
413        let endpoint = resolver.resolve_endpoint(&params);
414        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]");
415        assert_eq!(
416            format!("{}", error),
417            "Invalid Configuration: Dualstack and custom endpoint are not supported"
418        )
419    }
420
421    /// Missing region
422    #[test]
423    fn test_22() {
424        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
425        let resolver = crate::config::endpoint::DefaultResolver::new();
426        let endpoint = resolver.resolve_endpoint(&params);
427        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
428        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
429    }
430}
431
432/// Endpoint resolver trait specific to Amazon Machine Learning
433pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
434    /// Resolve an endpoint with the given parameters
435    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
436
437    /// Convert this service-specific resolver into a `SharedEndpointResolver`
438    ///
439    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
440    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
441    where
442        Self: Sized + 'static,
443    {
444        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
445    }
446}
447
448#[derive(Debug)]
449struct DowncastParams<T>(T);
450impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
451where
452    T: ResolveEndpoint,
453{
454    fn resolve_endpoint<'a>(
455        &'a self,
456        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
457    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
458        let ep = match params.get::<crate::config::endpoint::Params>() {
459            Some(params) => self.0.resolve_endpoint(params),
460            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
461        };
462        ep
463    }
464}
465
466/// The default endpoint resolver
467#[derive(Debug, Default)]
468pub struct DefaultResolver {
469    partition_resolver: crate::endpoint_lib::partition::PartitionResolver,
470}
471
472impl DefaultResolver {
473    /// Create a new endpoint resolver with default settings
474    pub fn new() -> Self {
475        Self {
476            partition_resolver: crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER.clone(),
477        }
478    }
479
480    fn resolve_endpoint(
481        &self,
482        params: &crate::config::endpoint::Params,
483    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
484        let mut diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
485        Ok(
486            crate::config::endpoint::internals::resolve_endpoint(params, &mut diagnostic_collector, &self.partition_resolver)
487                .map_err(|err| err.with_source(diagnostic_collector.take_last_error()))?,
488        )
489    }
490}
491
492impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
493    fn resolve_endpoint(&self, params: &crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture {
494        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(self.resolve_endpoint(params))
495    }
496}
497
498#[non_exhaustive]
499#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
500/// Configuration parameters for resolving the correct endpoint
501pub struct Params {
502    /// The AWS region used to dispatch the request.
503    pub(crate) region: ::std::option::Option<::std::string::String>,
504    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
505    pub(crate) use_dual_stack: bool,
506    /// 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.
507    pub(crate) use_fips: bool,
508    /// Override the endpoint used to send this request
509    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
510}
511impl Params {
512    /// Create a builder for [`Params`]
513    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
514        crate::config::endpoint::ParamsBuilder::default()
515    }
516    /// The AWS region used to dispatch the request.
517    pub fn region(&self) -> ::std::option::Option<&str> {
518        self.region.as_deref()
519    }
520    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
521    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
522        Some(self.use_dual_stack)
523    }
524    /// 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.
525    pub fn use_fips(&self) -> ::std::option::Option<bool> {
526        Some(self.use_fips)
527    }
528    /// Override the endpoint used to send this request
529    pub fn endpoint(&self) -> ::std::option::Option<&str> {
530        self.endpoint.as_deref()
531    }
532}
533
534/// Builder for [`Params`]
535#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
536pub struct ParamsBuilder {
537    region: ::std::option::Option<::std::string::String>,
538    use_dual_stack: ::std::option::Option<bool>,
539    use_fips: ::std::option::Option<bool>,
540    endpoint: ::std::option::Option<::std::string::String>,
541}
542impl ParamsBuilder {
543    /// Consume this builder, creating [`Params`].
544    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
545        Ok(
546            #[allow(clippy::unnecessary_lazy_evaluations)]
547            crate::config::endpoint::Params {
548                region: self.region,
549                use_dual_stack: self
550                    .use_dual_stack
551                    .or_else(|| Some(false))
552                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
553                use_fips: self
554                    .use_fips
555                    .or_else(|| Some(false))
556                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
557                endpoint: self.endpoint,
558            },
559        )
560    }
561    /// Sets the value for region
562    ///
563    /// The AWS region used to dispatch the request.
564    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
565        self.region = Some(value.into());
566        self
567    }
568
569    /// Sets the value for region
570    ///
571    /// The AWS region used to dispatch the request.
572    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
573        self.region = param;
574        self
575    }
576    /// Sets the value for use_dual_stack
577    ///
578    /// When unset, this parameter has a default value of `false`.
579    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
580    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
581        self.use_dual_stack = Some(value.into());
582        self
583    }
584
585    /// Sets the value for use_dual_stack
586    ///
587    /// When unset, this parameter has a default value of `false`.
588    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
589    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
590        self.use_dual_stack = param;
591        self
592    }
593    /// Sets the value for use_fips
594    ///
595    /// When unset, this parameter has a default value of `false`.
596    /// 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.
597    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
598        self.use_fips = Some(value.into());
599        self
600    }
601
602    /// Sets the value for use_fips
603    ///
604    /// When unset, this parameter has a default value of `false`.
605    /// 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.
606    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
607        self.use_fips = param;
608        self
609    }
610    /// Sets the value for endpoint
611    ///
612    /// Override the endpoint used to send this request
613    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
614        self.endpoint = Some(value.into());
615        self
616    }
617
618    /// Sets the value for endpoint
619    ///
620    /// Override the endpoint used to send this request
621    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
622        self.endpoint = param;
623        self
624    }
625}
626
627/// An error that occurred during endpoint resolution
628#[derive(Debug)]
629pub struct InvalidParams {
630    field: std::borrow::Cow<'static, str>,
631}
632
633impl InvalidParams {
634    #[allow(dead_code)]
635    fn missing(field: &'static str) -> Self {
636        Self { field: field.into() }
637    }
638}
639
640impl std::fmt::Display for InvalidParams {
641    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
642        write!(f, "a required field was missing: `{}`", self.field)
643    }
644}
645
646impl std::error::Error for InvalidParams {}
647
648mod internals;