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