aws_sdk_route53/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 aws-global with FIPS disabled and DualStack disabled
10    #[test]
11    fn test_1() {
12        let params = crate::config::endpoint::Params::builder()
13            .region("aws-global".to_string())
14            .use_fips(false)
15            .use_dual_stack(false)
16            .build()
17            .expect("invalid params");
18        let resolver = crate::config::endpoint::DefaultResolver::new();
19        let endpoint = resolver.resolve_endpoint(&params);
20        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.amazonaws.com");
21        assert_eq!(
22            endpoint,
23            ::aws_smithy_types::endpoint::Endpoint::builder()
24                .url("https://route53.amazonaws.com")
25                .property(
26                    "authSchemes",
27                    vec![{
28                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
29                        out.insert("name".to_string(), "sigv4".to_string().into());
30                        out.insert("signingName".to_string(), "route53".to_string().into());
31                        out.insert("signingRegion".to_string(), "us-east-1".to_string().into());
32                        out
33                    }
34                    .into()]
35                )
36                .build()
37        );
38    }
39
40    /// For region aws-global with FIPS enabled and DualStack disabled
41    #[test]
42    fn test_2() {
43        let params = crate::config::endpoint::Params::builder()
44            .region("aws-global".to_string())
45            .use_fips(true)
46            .use_dual_stack(false)
47            .build()
48            .expect("invalid params");
49        let resolver = crate::config::endpoint::DefaultResolver::new();
50        let endpoint = resolver.resolve_endpoint(&params);
51        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.amazonaws.com");
52        assert_eq!(
53            endpoint,
54            ::aws_smithy_types::endpoint::Endpoint::builder()
55                .url("https://route53-fips.amazonaws.com")
56                .property(
57                    "authSchemes",
58                    vec![{
59                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
60                        out.insert("name".to_string(), "sigv4".to_string().into());
61                        out.insert("signingName".to_string(), "route53".to_string().into());
62                        out.insert("signingRegion".to_string(), "us-east-1".to_string().into());
63                        out
64                    }
65                    .into()]
66                )
67                .build()
68        );
69    }
70
71    /// For region us-east-1 with FIPS enabled and DualStack enabled
72    #[test]
73    fn test_3() {
74        let params = crate::config::endpoint::Params::builder()
75            .region("us-east-1".to_string())
76            .use_fips(true)
77            .use_dual_stack(true)
78            .build()
79            .expect("invalid params");
80        let resolver = crate::config::endpoint::DefaultResolver::new();
81        let endpoint = resolver.resolve_endpoint(&params);
82        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.us-east-1.api.aws");
83        assert_eq!(
84            endpoint,
85            ::aws_smithy_types::endpoint::Endpoint::builder()
86                .url("https://route53-fips.us-east-1.api.aws")
87                .build()
88        );
89    }
90
91    /// For region us-east-1 with FIPS enabled and DualStack disabled
92    #[test]
93    fn test_4() {
94        let params = crate::config::endpoint::Params::builder()
95            .region("us-east-1".to_string())
96            .use_fips(true)
97            .use_dual_stack(false)
98            .build()
99            .expect("invalid params");
100        let resolver = crate::config::endpoint::DefaultResolver::new();
101        let endpoint = resolver.resolve_endpoint(&params);
102        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.amazonaws.com");
103        assert_eq!(
104            endpoint,
105            ::aws_smithy_types::endpoint::Endpoint::builder()
106                .url("https://route53-fips.amazonaws.com")
107                .property(
108                    "authSchemes",
109                    vec![{
110                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
111                        out.insert("name".to_string(), "sigv4".to_string().into());
112                        out.insert("signingName".to_string(), "route53".to_string().into());
113                        out.insert("signingRegion".to_string(), "us-east-1".to_string().into());
114                        out
115                    }
116                    .into()]
117                )
118                .build()
119        );
120    }
121
122    /// For region us-east-1 with FIPS disabled and DualStack enabled
123    #[test]
124    fn test_5() {
125        let params = crate::config::endpoint::Params::builder()
126            .region("us-east-1".to_string())
127            .use_fips(false)
128            .use_dual_stack(true)
129            .build()
130            .expect("invalid params");
131        let resolver = crate::config::endpoint::DefaultResolver::new();
132        let endpoint = resolver.resolve_endpoint(&params);
133        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-east-1.api.aws");
134        assert_eq!(
135            endpoint,
136            ::aws_smithy_types::endpoint::Endpoint::builder()
137                .url("https://route53.us-east-1.api.aws")
138                .build()
139        );
140    }
141
142    /// For region us-east-1 with FIPS disabled and DualStack disabled
143    #[test]
144    fn test_6() {
145        let params = crate::config::endpoint::Params::builder()
146            .region("us-east-1".to_string())
147            .use_fips(false)
148            .use_dual_stack(false)
149            .build()
150            .expect("invalid params");
151        let resolver = crate::config::endpoint::DefaultResolver::new();
152        let endpoint = resolver.resolve_endpoint(&params);
153        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.amazonaws.com");
154        assert_eq!(
155            endpoint,
156            ::aws_smithy_types::endpoint::Endpoint::builder()
157                .url("https://route53.amazonaws.com")
158                .property(
159                    "authSchemes",
160                    vec![{
161                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
162                        out.insert("name".to_string(), "sigv4".to_string().into());
163                        out.insert("signingName".to_string(), "route53".to_string().into());
164                        out.insert("signingRegion".to_string(), "us-east-1".to_string().into());
165                        out
166                    }
167                    .into()]
168                )
169                .build()
170        );
171    }
172
173    /// For region aws-cn-global with FIPS disabled and DualStack disabled
174    #[test]
175    fn test_7() {
176        let params = crate::config::endpoint::Params::builder()
177            .region("aws-cn-global".to_string())
178            .use_fips(false)
179            .use_dual_stack(false)
180            .build()
181            .expect("invalid params");
182        let resolver = crate::config::endpoint::DefaultResolver::new();
183        let endpoint = resolver.resolve_endpoint(&params);
184        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.amazonaws.com.cn");
185        assert_eq!(
186            endpoint,
187            ::aws_smithy_types::endpoint::Endpoint::builder()
188                .url("https://route53.amazonaws.com.cn")
189                .property(
190                    "authSchemes",
191                    vec![{
192                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
193                        out.insert("name".to_string(), "sigv4".to_string().into());
194                        out.insert("signingName".to_string(), "route53".to_string().into());
195                        out.insert("signingRegion".to_string(), "cn-northwest-1".to_string().into());
196                        out
197                    }
198                    .into()]
199                )
200                .build()
201        );
202    }
203
204    /// For region cn-north-1 with FIPS enabled and DualStack enabled
205    #[test]
206    fn test_8() {
207        let params = crate::config::endpoint::Params::builder()
208            .region("cn-north-1".to_string())
209            .use_fips(true)
210            .use_dual_stack(true)
211            .build()
212            .expect("invalid params");
213        let resolver = crate::config::endpoint::DefaultResolver::new();
214        let endpoint = resolver.resolve_endpoint(&params);
215        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.cn-north-1.api.amazonwebservices.com.cn");
216        assert_eq!(
217            endpoint,
218            ::aws_smithy_types::endpoint::Endpoint::builder()
219                .url("https://route53-fips.cn-north-1.api.amazonwebservices.com.cn")
220                .build()
221        );
222    }
223
224    /// For region cn-north-1 with FIPS enabled and DualStack disabled
225    #[test]
226    fn test_9() {
227        let params = crate::config::endpoint::Params::builder()
228            .region("cn-north-1".to_string())
229            .use_fips(true)
230            .use_dual_stack(false)
231            .build()
232            .expect("invalid params");
233        let resolver = crate::config::endpoint::DefaultResolver::new();
234        let endpoint = resolver.resolve_endpoint(&params);
235        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.cn-north-1.amazonaws.com.cn");
236        assert_eq!(
237            endpoint,
238            ::aws_smithy_types::endpoint::Endpoint::builder()
239                .url("https://route53-fips.cn-north-1.amazonaws.com.cn")
240                .build()
241        );
242    }
243
244    /// For region cn-north-1 with FIPS disabled and DualStack enabled
245    #[test]
246    fn test_10() {
247        let params = crate::config::endpoint::Params::builder()
248            .region("cn-north-1".to_string())
249            .use_fips(false)
250            .use_dual_stack(true)
251            .build()
252            .expect("invalid params");
253        let resolver = crate::config::endpoint::DefaultResolver::new();
254        let endpoint = resolver.resolve_endpoint(&params);
255        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.cn-north-1.api.amazonwebservices.com.cn");
256        assert_eq!(
257            endpoint,
258            ::aws_smithy_types::endpoint::Endpoint::builder()
259                .url("https://route53.cn-north-1.api.amazonwebservices.com.cn")
260                .build()
261        );
262    }
263
264    /// For region cn-north-1 with FIPS disabled and DualStack disabled
265    #[test]
266    fn test_11() {
267        let params = crate::config::endpoint::Params::builder()
268            .region("cn-north-1".to_string())
269            .use_fips(false)
270            .use_dual_stack(false)
271            .build()
272            .expect("invalid params");
273        let resolver = crate::config::endpoint::DefaultResolver::new();
274        let endpoint = resolver.resolve_endpoint(&params);
275        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.amazonaws.com.cn");
276        assert_eq!(
277            endpoint,
278            ::aws_smithy_types::endpoint::Endpoint::builder()
279                .url("https://route53.amazonaws.com.cn")
280                .property(
281                    "authSchemes",
282                    vec![{
283                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
284                        out.insert("name".to_string(), "sigv4".to_string().into());
285                        out.insert("signingName".to_string(), "route53".to_string().into());
286                        out.insert("signingRegion".to_string(), "cn-northwest-1".to_string().into());
287                        out
288                    }
289                    .into()]
290                )
291                .build()
292        );
293    }
294
295    /// For region aws-us-gov-global with FIPS disabled and DualStack disabled
296    #[test]
297    fn test_12() {
298        let params = crate::config::endpoint::Params::builder()
299            .region("aws-us-gov-global".to_string())
300            .use_fips(false)
301            .use_dual_stack(false)
302            .build()
303            .expect("invalid params");
304        let resolver = crate::config::endpoint::DefaultResolver::new();
305        let endpoint = resolver.resolve_endpoint(&params);
306        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-gov.amazonaws.com");
307        assert_eq!(
308            endpoint,
309            ::aws_smithy_types::endpoint::Endpoint::builder()
310                .url("https://route53.us-gov.amazonaws.com")
311                .property(
312                    "authSchemes",
313                    vec![{
314                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
315                        out.insert("name".to_string(), "sigv4".to_string().into());
316                        out.insert("signingName".to_string(), "route53".to_string().into());
317                        out.insert("signingRegion".to_string(), "us-gov-west-1".to_string().into());
318                        out
319                    }
320                    .into()]
321                )
322                .build()
323        );
324    }
325
326    /// For region aws-us-gov-global with FIPS enabled and DualStack disabled
327    #[test]
328    fn test_13() {
329        let params = crate::config::endpoint::Params::builder()
330            .region("aws-us-gov-global".to_string())
331            .use_fips(true)
332            .use_dual_stack(false)
333            .build()
334            .expect("invalid params");
335        let resolver = crate::config::endpoint::DefaultResolver::new();
336        let endpoint = resolver.resolve_endpoint(&params);
337        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-gov.amazonaws.com");
338        assert_eq!(
339            endpoint,
340            ::aws_smithy_types::endpoint::Endpoint::builder()
341                .url("https://route53.us-gov.amazonaws.com")
342                .property(
343                    "authSchemes",
344                    vec![{
345                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
346                        out.insert("name".to_string(), "sigv4".to_string().into());
347                        out.insert("signingName".to_string(), "route53".to_string().into());
348                        out.insert("signingRegion".to_string(), "us-gov-west-1".to_string().into());
349                        out
350                    }
351                    .into()]
352                )
353                .build()
354        );
355    }
356
357    /// For region us-gov-east-1 with FIPS enabled and DualStack enabled
358    #[test]
359    fn test_14() {
360        let params = crate::config::endpoint::Params::builder()
361            .region("us-gov-east-1".to_string())
362            .use_fips(true)
363            .use_dual_stack(true)
364            .build()
365            .expect("invalid params");
366        let resolver = crate::config::endpoint::DefaultResolver::new();
367        let endpoint = resolver.resolve_endpoint(&params);
368        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.us-gov-east-1.api.aws");
369        assert_eq!(
370            endpoint,
371            ::aws_smithy_types::endpoint::Endpoint::builder()
372                .url("https://route53-fips.us-gov-east-1.api.aws")
373                .build()
374        );
375    }
376
377    /// For region us-gov-east-1 with FIPS enabled and DualStack disabled
378    #[test]
379    fn test_15() {
380        let params = crate::config::endpoint::Params::builder()
381            .region("us-gov-east-1".to_string())
382            .use_fips(true)
383            .use_dual_stack(false)
384            .build()
385            .expect("invalid params");
386        let resolver = crate::config::endpoint::DefaultResolver::new();
387        let endpoint = resolver.resolve_endpoint(&params);
388        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-gov.amazonaws.com");
389        assert_eq!(
390            endpoint,
391            ::aws_smithy_types::endpoint::Endpoint::builder()
392                .url("https://route53.us-gov.amazonaws.com")
393                .property(
394                    "authSchemes",
395                    vec![{
396                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
397                        out.insert("name".to_string(), "sigv4".to_string().into());
398                        out.insert("signingName".to_string(), "route53".to_string().into());
399                        out.insert("signingRegion".to_string(), "us-gov-west-1".to_string().into());
400                        out
401                    }
402                    .into()]
403                )
404                .build()
405        );
406    }
407
408    /// For region us-gov-east-1 with FIPS disabled and DualStack enabled
409    #[test]
410    fn test_16() {
411        let params = crate::config::endpoint::Params::builder()
412            .region("us-gov-east-1".to_string())
413            .use_fips(false)
414            .use_dual_stack(true)
415            .build()
416            .expect("invalid params");
417        let resolver = crate::config::endpoint::DefaultResolver::new();
418        let endpoint = resolver.resolve_endpoint(&params);
419        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-gov-east-1.api.aws");
420        assert_eq!(
421            endpoint,
422            ::aws_smithy_types::endpoint::Endpoint::builder()
423                .url("https://route53.us-gov-east-1.api.aws")
424                .build()
425        );
426    }
427
428    /// For region us-gov-east-1 with FIPS disabled and DualStack disabled
429    #[test]
430    fn test_17() {
431        let params = crate::config::endpoint::Params::builder()
432            .region("us-gov-east-1".to_string())
433            .use_fips(false)
434            .use_dual_stack(false)
435            .build()
436            .expect("invalid params");
437        let resolver = crate::config::endpoint::DefaultResolver::new();
438        let endpoint = resolver.resolve_endpoint(&params);
439        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.us-gov.amazonaws.com");
440        assert_eq!(
441            endpoint,
442            ::aws_smithy_types::endpoint::Endpoint::builder()
443                .url("https://route53.us-gov.amazonaws.com")
444                .property(
445                    "authSchemes",
446                    vec![{
447                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
448                        out.insert("name".to_string(), "sigv4".to_string().into());
449                        out.insert("signingName".to_string(), "route53".to_string().into());
450                        out.insert("signingRegion".to_string(), "us-gov-west-1".to_string().into());
451                        out
452                    }
453                    .into()]
454                )
455                .build()
456        );
457    }
458
459    /// For region aws-iso-global with FIPS disabled and DualStack disabled
460    #[test]
461    fn test_18() {
462        let params = crate::config::endpoint::Params::builder()
463            .region("aws-iso-global".to_string())
464            .use_fips(false)
465            .use_dual_stack(false)
466            .build()
467            .expect("invalid params");
468        let resolver = crate::config::endpoint::DefaultResolver::new();
469        let endpoint = resolver.resolve_endpoint(&params);
470        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.c2s.ic.gov");
471        assert_eq!(
472            endpoint,
473            ::aws_smithy_types::endpoint::Endpoint::builder()
474                .url("https://route53.c2s.ic.gov")
475                .property(
476                    "authSchemes",
477                    vec![{
478                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
479                        out.insert("name".to_string(), "sigv4".to_string().into());
480                        out.insert("signingName".to_string(), "route53".to_string().into());
481                        out.insert("signingRegion".to_string(), "us-iso-east-1".to_string().into());
482                        out
483                    }
484                    .into()]
485                )
486                .build()
487        );
488    }
489
490    /// For region us-iso-east-1 with FIPS enabled and DualStack disabled
491    #[test]
492    fn test_19() {
493        let params = crate::config::endpoint::Params::builder()
494            .region("us-iso-east-1".to_string())
495            .use_fips(true)
496            .use_dual_stack(false)
497            .build()
498            .expect("invalid params");
499        let resolver = crate::config::endpoint::DefaultResolver::new();
500        let endpoint = resolver.resolve_endpoint(&params);
501        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.us-iso-east-1.c2s.ic.gov");
502        assert_eq!(
503            endpoint,
504            ::aws_smithy_types::endpoint::Endpoint::builder()
505                .url("https://route53-fips.us-iso-east-1.c2s.ic.gov")
506                .build()
507        );
508    }
509
510    /// For region us-iso-east-1 with FIPS disabled and DualStack disabled
511    #[test]
512    fn test_20() {
513        let params = crate::config::endpoint::Params::builder()
514            .region("us-iso-east-1".to_string())
515            .use_fips(false)
516            .use_dual_stack(false)
517            .build()
518            .expect("invalid params");
519        let resolver = crate::config::endpoint::DefaultResolver::new();
520        let endpoint = resolver.resolve_endpoint(&params);
521        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.c2s.ic.gov");
522        assert_eq!(
523            endpoint,
524            ::aws_smithy_types::endpoint::Endpoint::builder()
525                .url("https://route53.c2s.ic.gov")
526                .property(
527                    "authSchemes",
528                    vec![{
529                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
530                        out.insert("name".to_string(), "sigv4".to_string().into());
531                        out.insert("signingName".to_string(), "route53".to_string().into());
532                        out.insert("signingRegion".to_string(), "us-iso-east-1".to_string().into());
533                        out
534                    }
535                    .into()]
536                )
537                .build()
538        );
539    }
540
541    /// For region aws-iso-b-global with FIPS disabled and DualStack disabled
542    #[test]
543    fn test_21() {
544        let params = crate::config::endpoint::Params::builder()
545            .region("aws-iso-b-global".to_string())
546            .use_fips(false)
547            .use_dual_stack(false)
548            .build()
549            .expect("invalid params");
550        let resolver = crate::config::endpoint::DefaultResolver::new();
551        let endpoint = resolver.resolve_endpoint(&params);
552        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.sc2s.sgov.gov");
553        assert_eq!(
554            endpoint,
555            ::aws_smithy_types::endpoint::Endpoint::builder()
556                .url("https://route53.sc2s.sgov.gov")
557                .property(
558                    "authSchemes",
559                    vec![{
560                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
561                        out.insert("name".to_string(), "sigv4".to_string().into());
562                        out.insert("signingName".to_string(), "route53".to_string().into());
563                        out.insert("signingRegion".to_string(), "us-isob-east-1".to_string().into());
564                        out
565                    }
566                    .into()]
567                )
568                .build()
569        );
570    }
571
572    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
573    #[test]
574    fn test_22() {
575        let params = crate::config::endpoint::Params::builder()
576            .region("us-isob-east-1".to_string())
577            .use_fips(true)
578            .use_dual_stack(false)
579            .build()
580            .expect("invalid params");
581        let resolver = crate::config::endpoint::DefaultResolver::new();
582        let endpoint = resolver.resolve_endpoint(&params);
583        let endpoint = endpoint.expect("Expected valid endpoint: https://route53-fips.us-isob-east-1.sc2s.sgov.gov");
584        assert_eq!(
585            endpoint,
586            ::aws_smithy_types::endpoint::Endpoint::builder()
587                .url("https://route53-fips.us-isob-east-1.sc2s.sgov.gov")
588                .build()
589        );
590    }
591
592    /// For region us-isob-east-1 with FIPS disabled and DualStack disabled
593    #[test]
594    fn test_23() {
595        let params = crate::config::endpoint::Params::builder()
596            .region("us-isob-east-1".to_string())
597            .use_fips(false)
598            .use_dual_stack(false)
599            .build()
600            .expect("invalid params");
601        let resolver = crate::config::endpoint::DefaultResolver::new();
602        let endpoint = resolver.resolve_endpoint(&params);
603        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.sc2s.sgov.gov");
604        assert_eq!(
605            endpoint,
606            ::aws_smithy_types::endpoint::Endpoint::builder()
607                .url("https://route53.sc2s.sgov.gov")
608                .property(
609                    "authSchemes",
610                    vec![{
611                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
612                        out.insert("name".to_string(), "sigv4".to_string().into());
613                        out.insert("signingName".to_string(), "route53".to_string().into());
614                        out.insert("signingRegion".to_string(), "us-isob-east-1".to_string().into());
615                        out
616                    }
617                    .into()]
618                )
619                .build()
620        );
621    }
622
623    /// For region eu-isoe-west-1 with FIPS disabled and DualStack disabled
624    #[test]
625    fn test_24() {
626        let params = crate::config::endpoint::Params::builder()
627            .region("eu-isoe-west-1".to_string())
628            .use_fips(false)
629            .use_dual_stack(false)
630            .build()
631            .expect("invalid params");
632        let resolver = crate::config::endpoint::DefaultResolver::new();
633        let endpoint = resolver.resolve_endpoint(&params);
634        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.cloud.adc-e.uk");
635        assert_eq!(
636            endpoint,
637            ::aws_smithy_types::endpoint::Endpoint::builder()
638                .url("https://route53.cloud.adc-e.uk")
639                .property(
640                    "authSchemes",
641                    vec![{
642                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
643                        out.insert("name".to_string(), "sigv4".to_string().into());
644                        out.insert("signingName".to_string(), "route53".to_string().into());
645                        out.insert("signingRegion".to_string(), "eu-isoe-west-1".to_string().into());
646                        out
647                    }
648                    .into()]
649                )
650                .build()
651        );
652    }
653
654    /// For region us-isof-south-1 with FIPS disabled and DualStack disabled
655    #[test]
656    fn test_25() {
657        let params = crate::config::endpoint::Params::builder()
658            .region("us-isof-south-1".to_string())
659            .use_fips(false)
660            .use_dual_stack(false)
661            .build()
662            .expect("invalid params");
663        let resolver = crate::config::endpoint::DefaultResolver::new();
664        let endpoint = resolver.resolve_endpoint(&params);
665        let endpoint = endpoint.expect("Expected valid endpoint: https://route53.csp.hci.ic.gov");
666        assert_eq!(
667            endpoint,
668            ::aws_smithy_types::endpoint::Endpoint::builder()
669                .url("https://route53.csp.hci.ic.gov")
670                .property(
671                    "authSchemes",
672                    vec![{
673                        let mut out = ::std::collections::HashMap::<String, ::aws_smithy_types::Document>::new();
674                        out.insert("name".to_string(), "sigv4".to_string().into());
675                        out.insert("signingName".to_string(), "route53".to_string().into());
676                        out.insert("signingRegion".to_string(), "us-isof-south-1".to_string().into());
677                        out
678                    }
679                    .into()]
680                )
681                .build()
682        );
683    }
684
685    /// For custom endpoint with region set and fips disabled and dualstack disabled
686    #[test]
687    fn test_26() {
688        let params = crate::config::endpoint::Params::builder()
689            .region("us-east-1".to_string())
690            .use_fips(false)
691            .use_dual_stack(false)
692            .endpoint("https://example.com".to_string())
693            .build()
694            .expect("invalid params");
695        let resolver = crate::config::endpoint::DefaultResolver::new();
696        let endpoint = resolver.resolve_endpoint(&params);
697        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
698        assert_eq!(
699            endpoint,
700            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
701        );
702    }
703
704    /// For custom endpoint with region not set and fips disabled and dualstack disabled
705    #[test]
706    fn test_27() {
707        let params = crate::config::endpoint::Params::builder()
708            .use_fips(false)
709            .use_dual_stack(false)
710            .endpoint("https://example.com".to_string())
711            .build()
712            .expect("invalid params");
713        let resolver = crate::config::endpoint::DefaultResolver::new();
714        let endpoint = resolver.resolve_endpoint(&params);
715        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
716        assert_eq!(
717            endpoint,
718            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
719        );
720    }
721
722    /// For custom endpoint with fips enabled and dualstack disabled
723    #[test]
724    fn test_28() {
725        let params = crate::config::endpoint::Params::builder()
726            .region("us-east-1".to_string())
727            .use_fips(true)
728            .use_dual_stack(false)
729            .endpoint("https://example.com".to_string())
730            .build()
731            .expect("invalid params");
732        let resolver = crate::config::endpoint::DefaultResolver::new();
733        let endpoint = resolver.resolve_endpoint(&params);
734        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]");
735        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
736    }
737
738    /// For custom endpoint with fips disabled and dualstack enabled
739    #[test]
740    fn test_29() {
741        let params = crate::config::endpoint::Params::builder()
742            .region("us-east-1".to_string())
743            .use_fips(false)
744            .use_dual_stack(true)
745            .endpoint("https://example.com".to_string())
746            .build()
747            .expect("invalid params");
748        let resolver = crate::config::endpoint::DefaultResolver::new();
749        let endpoint = resolver.resolve_endpoint(&params);
750        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]");
751        assert_eq!(
752            format!("{}", error),
753            "Invalid Configuration: Dualstack and custom endpoint are not supported"
754        )
755    }
756
757    /// Missing region
758    #[test]
759    fn test_30() {
760        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
761        let resolver = crate::config::endpoint::DefaultResolver::new();
762        let endpoint = resolver.resolve_endpoint(&params);
763        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
764        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
765    }
766}
767
768/// Endpoint resolver trait specific to Amazon Route 53
769pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
770    /// Resolve an endpoint with the given parameters
771    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
772
773    /// Convert this service-specific resolver into a `SharedEndpointResolver`
774    ///
775    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
776    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
777    where
778        Self: Sized + 'static,
779    {
780        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
781    }
782}
783
784#[derive(Debug)]
785struct DowncastParams<T>(T);
786impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
787where
788    T: ResolveEndpoint,
789{
790    fn resolve_endpoint<'a>(
791        &'a self,
792        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
793    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
794        let ep = match params.get::<crate::config::endpoint::Params>() {
795            Some(params) => self.0.resolve_endpoint(params),
796            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
797        };
798        ep
799    }
800}
801
802/// The default endpoint resolver
803#[derive(Debug, Default)]
804pub struct DefaultResolver {
805    partition_resolver: crate::endpoint_lib::partition::PartitionResolver,
806}
807
808impl DefaultResolver {
809    /// Create a new endpoint resolver with default settings
810    pub fn new() -> Self {
811        Self {
812            partition_resolver: crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER.clone(),
813        }
814    }
815
816    fn resolve_endpoint(
817        &self,
818        params: &crate::config::endpoint::Params,
819    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
820        let mut diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
821        Ok(
822            crate::config::endpoint::internals::resolve_endpoint(params, &mut diagnostic_collector, &self.partition_resolver)
823                .map_err(|err| err.with_source(diagnostic_collector.take_last_error()))?,
824        )
825    }
826}
827
828impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
829    fn resolve_endpoint(&self, params: &crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'_> {
830        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(self.resolve_endpoint(params))
831    }
832}
833
834#[non_exhaustive]
835#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
836/// Configuration parameters for resolving the correct endpoint
837pub struct Params {
838    /// The AWS region used to dispatch the request.
839    pub(crate) region: ::std::option::Option<::std::string::String>,
840    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
841    pub(crate) use_dual_stack: bool,
842    /// 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.
843    pub(crate) use_fips: bool,
844    /// Override the endpoint used to send this request
845    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
846}
847impl Params {
848    /// Create a builder for [`Params`]
849    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
850        crate::config::endpoint::ParamsBuilder::default()
851    }
852    /// The AWS region used to dispatch the request.
853    pub fn region(&self) -> ::std::option::Option<&str> {
854        self.region.as_deref()
855    }
856    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
857    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
858        Some(self.use_dual_stack)
859    }
860    /// 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.
861    pub fn use_fips(&self) -> ::std::option::Option<bool> {
862        Some(self.use_fips)
863    }
864    /// Override the endpoint used to send this request
865    pub fn endpoint(&self) -> ::std::option::Option<&str> {
866        self.endpoint.as_deref()
867    }
868}
869
870/// Builder for [`Params`]
871#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
872pub struct ParamsBuilder {
873    region: ::std::option::Option<::std::string::String>,
874    use_dual_stack: ::std::option::Option<bool>,
875    use_fips: ::std::option::Option<bool>,
876    endpoint: ::std::option::Option<::std::string::String>,
877}
878impl ParamsBuilder {
879    /// Consume this builder, creating [`Params`].
880    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
881        Ok(
882            #[allow(clippy::unnecessary_lazy_evaluations)]
883            crate::config::endpoint::Params {
884                region: self.region,
885                use_dual_stack: self
886                    .use_dual_stack
887                    .or_else(|| Some(false))
888                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
889                use_fips: self
890                    .use_fips
891                    .or_else(|| Some(false))
892                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
893                endpoint: self.endpoint,
894            },
895        )
896    }
897    /// Sets the value for region
898    ///
899    /// The AWS region used to dispatch the request.
900    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
901        self.region = Some(value.into());
902        self
903    }
904
905    /// Sets the value for region
906    ///
907    /// The AWS region used to dispatch the request.
908    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
909        self.region = param;
910        self
911    }
912    /// Sets the value for use_dual_stack
913    ///
914    /// When unset, this parameter has a default value of `false`.
915    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
916    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
917        self.use_dual_stack = Some(value.into());
918        self
919    }
920
921    /// Sets the value for use_dual_stack
922    ///
923    /// When unset, this parameter has a default value of `false`.
924    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
925    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
926        self.use_dual_stack = param;
927        self
928    }
929    /// Sets the value for use_fips
930    ///
931    /// When unset, this parameter has a default value of `false`.
932    /// 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.
933    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
934        self.use_fips = Some(value.into());
935        self
936    }
937
938    /// Sets the value for use_fips
939    ///
940    /// When unset, this parameter has a default value of `false`.
941    /// 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.
942    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
943        self.use_fips = param;
944        self
945    }
946    /// Sets the value for endpoint
947    ///
948    /// Override the endpoint used to send this request
949    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
950        self.endpoint = Some(value.into());
951        self
952    }
953
954    /// Sets the value for endpoint
955    ///
956    /// Override the endpoint used to send this request
957    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
958        self.endpoint = param;
959        self
960    }
961}
962
963/// An error that occurred during endpoint resolution
964#[derive(Debug)]
965pub struct InvalidParams {
966    field: std::borrow::Cow<'static, str>,
967}
968
969impl InvalidParams {
970    #[allow(dead_code)]
971    fn missing(field: &'static str) -> Self {
972        Self { field: field.into() }
973    }
974}
975
976impl std::fmt::Display for InvalidParams {
977    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
978        write!(f, "a required field was missing: `{}`", self.field)
979    }
980}
981
982impl std::error::Error for InvalidParams {}
983
984mod internals;