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