aws_sdk_codestarnotifications/config/
endpoint.rs

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