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