Skip to main content

aws_sdk_athena/config/
endpoint.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use ::aws_smithy_runtime_api::client::endpoint::EndpointFuture;
3pub use ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver;
4pub use ::aws_smithy_types::endpoint::Endpoint;
5
6/// Interceptor that tracks endpoint override business metric.
7#[derive(Debug, Default)]
8pub(crate) struct EndpointOverrideFeatureTrackerInterceptor;
9
10#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
11impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EndpointOverrideFeatureTrackerInterceptor {
12    fn name(&self) -> &'static str {
13        "EndpointOverrideFeatureTrackerInterceptor"
14    }
15
16    fn read_before_execution(
17        &self,
18        _context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_>,
19        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
20    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
21        if cfg.load::<::aws_types::endpoint_config::EndpointUrl>().is_some() {
22            cfg.interceptor_state()
23                .store_append(::aws_runtime::sdk_feature::AwsSdkFeature::EndpointOverride);
24        }
25        ::std::result::Result::Ok(())
26    }
27}
28
29#[cfg(test)]
30mod test {
31
32    /// For region af-south-1 with FIPS disabled and DualStack disabled
33    #[test]
34    fn test_1() {
35        let params = crate::config::endpoint::Params::builder()
36            .region("af-south-1".to_string())
37            .use_fips(false)
38            .use_dual_stack(false)
39            .build()
40            .expect("invalid params");
41        let resolver = crate::config::endpoint::DefaultResolver::new();
42        let endpoint = resolver.resolve_endpoint(&params);
43        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.af-south-1.amazonaws.com");
44        assert_eq!(
45            endpoint,
46            ::aws_smithy_types::endpoint::Endpoint::builder()
47                .url("https://athena.af-south-1.amazonaws.com")
48                .build()
49        );
50    }
51
52    /// For region ap-east-1 with FIPS disabled and DualStack disabled
53    #[test]
54    fn test_2() {
55        let params = crate::config::endpoint::Params::builder()
56            .region("ap-east-1".to_string())
57            .use_fips(false)
58            .use_dual_stack(false)
59            .build()
60            .expect("invalid params");
61        let resolver = crate::config::endpoint::DefaultResolver::new();
62        let endpoint = resolver.resolve_endpoint(&params);
63        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-east-1.amazonaws.com");
64        assert_eq!(
65            endpoint,
66            ::aws_smithy_types::endpoint::Endpoint::builder()
67                .url("https://athena.ap-east-1.amazonaws.com")
68                .build()
69        );
70    }
71
72    /// For region ap-northeast-1 with FIPS disabled and DualStack disabled
73    #[test]
74    fn test_3() {
75        let params = crate::config::endpoint::Params::builder()
76            .region("ap-northeast-1".to_string())
77            .use_fips(false)
78            .use_dual_stack(false)
79            .build()
80            .expect("invalid params");
81        let resolver = crate::config::endpoint::DefaultResolver::new();
82        let endpoint = resolver.resolve_endpoint(&params);
83        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-northeast-1.amazonaws.com");
84        assert_eq!(
85            endpoint,
86            ::aws_smithy_types::endpoint::Endpoint::builder()
87                .url("https://athena.ap-northeast-1.amazonaws.com")
88                .build()
89        );
90    }
91
92    /// For region ap-northeast-2 with FIPS disabled and DualStack disabled
93    #[test]
94    fn test_4() {
95        let params = crate::config::endpoint::Params::builder()
96            .region("ap-northeast-2".to_string())
97            .use_fips(false)
98            .use_dual_stack(false)
99            .build()
100            .expect("invalid params");
101        let resolver = crate::config::endpoint::DefaultResolver::new();
102        let endpoint = resolver.resolve_endpoint(&params);
103        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-northeast-2.amazonaws.com");
104        assert_eq!(
105            endpoint,
106            ::aws_smithy_types::endpoint::Endpoint::builder()
107                .url("https://athena.ap-northeast-2.amazonaws.com")
108                .build()
109        );
110    }
111
112    /// For region ap-northeast-3 with FIPS disabled and DualStack disabled
113    #[test]
114    fn test_5() {
115        let params = crate::config::endpoint::Params::builder()
116            .region("ap-northeast-3".to_string())
117            .use_fips(false)
118            .use_dual_stack(false)
119            .build()
120            .expect("invalid params");
121        let resolver = crate::config::endpoint::DefaultResolver::new();
122        let endpoint = resolver.resolve_endpoint(&params);
123        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-northeast-3.amazonaws.com");
124        assert_eq!(
125            endpoint,
126            ::aws_smithy_types::endpoint::Endpoint::builder()
127                .url("https://athena.ap-northeast-3.amazonaws.com")
128                .build()
129        );
130    }
131
132    /// For region ap-south-1 with FIPS disabled and DualStack disabled
133    #[test]
134    fn test_6() {
135        let params = crate::config::endpoint::Params::builder()
136            .region("ap-south-1".to_string())
137            .use_fips(false)
138            .use_dual_stack(false)
139            .build()
140            .expect("invalid params");
141        let resolver = crate::config::endpoint::DefaultResolver::new();
142        let endpoint = resolver.resolve_endpoint(&params);
143        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-south-1.amazonaws.com");
144        assert_eq!(
145            endpoint,
146            ::aws_smithy_types::endpoint::Endpoint::builder()
147                .url("https://athena.ap-south-1.amazonaws.com")
148                .build()
149        );
150    }
151
152    /// For region ap-southeast-1 with FIPS disabled and DualStack disabled
153    #[test]
154    fn test_7() {
155        let params = crate::config::endpoint::Params::builder()
156            .region("ap-southeast-1".to_string())
157            .use_fips(false)
158            .use_dual_stack(false)
159            .build()
160            .expect("invalid params");
161        let resolver = crate::config::endpoint::DefaultResolver::new();
162        let endpoint = resolver.resolve_endpoint(&params);
163        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-southeast-1.amazonaws.com");
164        assert_eq!(
165            endpoint,
166            ::aws_smithy_types::endpoint::Endpoint::builder()
167                .url("https://athena.ap-southeast-1.amazonaws.com")
168                .build()
169        );
170    }
171
172    /// For region ap-southeast-2 with FIPS disabled and DualStack disabled
173    #[test]
174    fn test_8() {
175        let params = crate::config::endpoint::Params::builder()
176            .region("ap-southeast-2".to_string())
177            .use_fips(false)
178            .use_dual_stack(false)
179            .build()
180            .expect("invalid params");
181        let resolver = crate::config::endpoint::DefaultResolver::new();
182        let endpoint = resolver.resolve_endpoint(&params);
183        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ap-southeast-2.amazonaws.com");
184        assert_eq!(
185            endpoint,
186            ::aws_smithy_types::endpoint::Endpoint::builder()
187                .url("https://athena.ap-southeast-2.amazonaws.com")
188                .build()
189        );
190    }
191
192    /// For region ca-central-1 with FIPS disabled and DualStack disabled
193    #[test]
194    fn test_9() {
195        let params = crate::config::endpoint::Params::builder()
196            .region("ca-central-1".to_string())
197            .use_fips(false)
198            .use_dual_stack(false)
199            .build()
200            .expect("invalid params");
201        let resolver = crate::config::endpoint::DefaultResolver::new();
202        let endpoint = resolver.resolve_endpoint(&params);
203        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.ca-central-1.amazonaws.com");
204        assert_eq!(
205            endpoint,
206            ::aws_smithy_types::endpoint::Endpoint::builder()
207                .url("https://athena.ca-central-1.amazonaws.com")
208                .build()
209        );
210    }
211
212    /// For region eu-central-1 with FIPS disabled and DualStack disabled
213    #[test]
214    fn test_10() {
215        let params = crate::config::endpoint::Params::builder()
216            .region("eu-central-1".to_string())
217            .use_fips(false)
218            .use_dual_stack(false)
219            .build()
220            .expect("invalid params");
221        let resolver = crate::config::endpoint::DefaultResolver::new();
222        let endpoint = resolver.resolve_endpoint(&params);
223        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-central-1.amazonaws.com");
224        assert_eq!(
225            endpoint,
226            ::aws_smithy_types::endpoint::Endpoint::builder()
227                .url("https://athena.eu-central-1.amazonaws.com")
228                .build()
229        );
230    }
231
232    /// For region eu-north-1 with FIPS disabled and DualStack disabled
233    #[test]
234    fn test_11() {
235        let params = crate::config::endpoint::Params::builder()
236            .region("eu-north-1".to_string())
237            .use_fips(false)
238            .use_dual_stack(false)
239            .build()
240            .expect("invalid params");
241        let resolver = crate::config::endpoint::DefaultResolver::new();
242        let endpoint = resolver.resolve_endpoint(&params);
243        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-north-1.amazonaws.com");
244        assert_eq!(
245            endpoint,
246            ::aws_smithy_types::endpoint::Endpoint::builder()
247                .url("https://athena.eu-north-1.amazonaws.com")
248                .build()
249        );
250    }
251
252    /// For region eu-south-1 with FIPS disabled and DualStack disabled
253    #[test]
254    fn test_12() {
255        let params = crate::config::endpoint::Params::builder()
256            .region("eu-south-1".to_string())
257            .use_fips(false)
258            .use_dual_stack(false)
259            .build()
260            .expect("invalid params");
261        let resolver = crate::config::endpoint::DefaultResolver::new();
262        let endpoint = resolver.resolve_endpoint(&params);
263        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-south-1.amazonaws.com");
264        assert_eq!(
265            endpoint,
266            ::aws_smithy_types::endpoint::Endpoint::builder()
267                .url("https://athena.eu-south-1.amazonaws.com")
268                .build()
269        );
270    }
271
272    /// For region eu-west-1 with FIPS disabled and DualStack disabled
273    #[test]
274    fn test_13() {
275        let params = crate::config::endpoint::Params::builder()
276            .region("eu-west-1".to_string())
277            .use_fips(false)
278            .use_dual_stack(false)
279            .build()
280            .expect("invalid params");
281        let resolver = crate::config::endpoint::DefaultResolver::new();
282        let endpoint = resolver.resolve_endpoint(&params);
283        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-west-1.amazonaws.com");
284        assert_eq!(
285            endpoint,
286            ::aws_smithy_types::endpoint::Endpoint::builder()
287                .url("https://athena.eu-west-1.amazonaws.com")
288                .build()
289        );
290    }
291
292    /// For region eu-west-2 with FIPS disabled and DualStack disabled
293    #[test]
294    fn test_14() {
295        let params = crate::config::endpoint::Params::builder()
296            .region("eu-west-2".to_string())
297            .use_fips(false)
298            .use_dual_stack(false)
299            .build()
300            .expect("invalid params");
301        let resolver = crate::config::endpoint::DefaultResolver::new();
302        let endpoint = resolver.resolve_endpoint(&params);
303        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-west-2.amazonaws.com");
304        assert_eq!(
305            endpoint,
306            ::aws_smithy_types::endpoint::Endpoint::builder()
307                .url("https://athena.eu-west-2.amazonaws.com")
308                .build()
309        );
310    }
311
312    /// For region eu-west-3 with FIPS disabled and DualStack disabled
313    #[test]
314    fn test_15() {
315        let params = crate::config::endpoint::Params::builder()
316            .region("eu-west-3".to_string())
317            .use_fips(false)
318            .use_dual_stack(false)
319            .build()
320            .expect("invalid params");
321        let resolver = crate::config::endpoint::DefaultResolver::new();
322        let endpoint = resolver.resolve_endpoint(&params);
323        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.eu-west-3.amazonaws.com");
324        assert_eq!(
325            endpoint,
326            ::aws_smithy_types::endpoint::Endpoint::builder()
327                .url("https://athena.eu-west-3.amazonaws.com")
328                .build()
329        );
330    }
331
332    /// For region me-south-1 with FIPS disabled and DualStack disabled
333    #[test]
334    fn test_16() {
335        let params = crate::config::endpoint::Params::builder()
336            .region("me-south-1".to_string())
337            .use_fips(false)
338            .use_dual_stack(false)
339            .build()
340            .expect("invalid params");
341        let resolver = crate::config::endpoint::DefaultResolver::new();
342        let endpoint = resolver.resolve_endpoint(&params);
343        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.me-south-1.amazonaws.com");
344        assert_eq!(
345            endpoint,
346            ::aws_smithy_types::endpoint::Endpoint::builder()
347                .url("https://athena.me-south-1.amazonaws.com")
348                .build()
349        );
350    }
351
352    /// For region sa-east-1 with FIPS disabled and DualStack disabled
353    #[test]
354    fn test_17() {
355        let params = crate::config::endpoint::Params::builder()
356            .region("sa-east-1".to_string())
357            .use_fips(false)
358            .use_dual_stack(false)
359            .build()
360            .expect("invalid params");
361        let resolver = crate::config::endpoint::DefaultResolver::new();
362        let endpoint = resolver.resolve_endpoint(&params);
363        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.sa-east-1.amazonaws.com");
364        assert_eq!(
365            endpoint,
366            ::aws_smithy_types::endpoint::Endpoint::builder()
367                .url("https://athena.sa-east-1.amazonaws.com")
368                .build()
369        );
370    }
371
372    /// For region us-east-1 with FIPS disabled and DualStack disabled
373    #[test]
374    fn test_18() {
375        let params = crate::config::endpoint::Params::builder()
376            .region("us-east-1".to_string())
377            .use_fips(false)
378            .use_dual_stack(false)
379            .build()
380            .expect("invalid params");
381        let resolver = crate::config::endpoint::DefaultResolver::new();
382        let endpoint = resolver.resolve_endpoint(&params);
383        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-east-1.amazonaws.com");
384        assert_eq!(
385            endpoint,
386            ::aws_smithy_types::endpoint::Endpoint::builder()
387                .url("https://athena.us-east-1.amazonaws.com")
388                .build()
389        );
390    }
391
392    /// For region us-east-1 with FIPS enabled and DualStack disabled
393    #[test]
394    fn test_19() {
395        let params = crate::config::endpoint::Params::builder()
396            .region("us-east-1".to_string())
397            .use_fips(true)
398            .use_dual_stack(false)
399            .build()
400            .expect("invalid params");
401        let resolver = crate::config::endpoint::DefaultResolver::new();
402        let endpoint = resolver.resolve_endpoint(&params);
403        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-east-1.amazonaws.com");
404        assert_eq!(
405            endpoint,
406            ::aws_smithy_types::endpoint::Endpoint::builder()
407                .url("https://athena-fips.us-east-1.amazonaws.com")
408                .build()
409        );
410    }
411
412    /// For region us-east-2 with FIPS disabled and DualStack disabled
413    #[test]
414    fn test_20() {
415        let params = crate::config::endpoint::Params::builder()
416            .region("us-east-2".to_string())
417            .use_fips(false)
418            .use_dual_stack(false)
419            .build()
420            .expect("invalid params");
421        let resolver = crate::config::endpoint::DefaultResolver::new();
422        let endpoint = resolver.resolve_endpoint(&params);
423        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-east-2.amazonaws.com");
424        assert_eq!(
425            endpoint,
426            ::aws_smithy_types::endpoint::Endpoint::builder()
427                .url("https://athena.us-east-2.amazonaws.com")
428                .build()
429        );
430    }
431
432    /// For region us-east-2 with FIPS enabled and DualStack disabled
433    #[test]
434    fn test_21() {
435        let params = crate::config::endpoint::Params::builder()
436            .region("us-east-2".to_string())
437            .use_fips(true)
438            .use_dual_stack(false)
439            .build()
440            .expect("invalid params");
441        let resolver = crate::config::endpoint::DefaultResolver::new();
442        let endpoint = resolver.resolve_endpoint(&params);
443        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-east-2.amazonaws.com");
444        assert_eq!(
445            endpoint,
446            ::aws_smithy_types::endpoint::Endpoint::builder()
447                .url("https://athena-fips.us-east-2.amazonaws.com")
448                .build()
449        );
450    }
451
452    /// For region us-west-1 with FIPS disabled and DualStack disabled
453    #[test]
454    fn test_22() {
455        let params = crate::config::endpoint::Params::builder()
456            .region("us-west-1".to_string())
457            .use_fips(false)
458            .use_dual_stack(false)
459            .build()
460            .expect("invalid params");
461        let resolver = crate::config::endpoint::DefaultResolver::new();
462        let endpoint = resolver.resolve_endpoint(&params);
463        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-west-1.amazonaws.com");
464        assert_eq!(
465            endpoint,
466            ::aws_smithy_types::endpoint::Endpoint::builder()
467                .url("https://athena.us-west-1.amazonaws.com")
468                .build()
469        );
470    }
471
472    /// For region us-west-1 with FIPS enabled and DualStack disabled
473    #[test]
474    fn test_23() {
475        let params = crate::config::endpoint::Params::builder()
476            .region("us-west-1".to_string())
477            .use_fips(true)
478            .use_dual_stack(false)
479            .build()
480            .expect("invalid params");
481        let resolver = crate::config::endpoint::DefaultResolver::new();
482        let endpoint = resolver.resolve_endpoint(&params);
483        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-west-1.amazonaws.com");
484        assert_eq!(
485            endpoint,
486            ::aws_smithy_types::endpoint::Endpoint::builder()
487                .url("https://athena-fips.us-west-1.amazonaws.com")
488                .build()
489        );
490    }
491
492    /// For region us-west-2 with FIPS disabled and DualStack disabled
493    #[test]
494    fn test_24() {
495        let params = crate::config::endpoint::Params::builder()
496            .region("us-west-2".to_string())
497            .use_fips(false)
498            .use_dual_stack(false)
499            .build()
500            .expect("invalid params");
501        let resolver = crate::config::endpoint::DefaultResolver::new();
502        let endpoint = resolver.resolve_endpoint(&params);
503        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-west-2.amazonaws.com");
504        assert_eq!(
505            endpoint,
506            ::aws_smithy_types::endpoint::Endpoint::builder()
507                .url("https://athena.us-west-2.amazonaws.com")
508                .build()
509        );
510    }
511
512    /// For region us-west-2 with FIPS enabled and DualStack disabled
513    #[test]
514    fn test_25() {
515        let params = crate::config::endpoint::Params::builder()
516            .region("us-west-2".to_string())
517            .use_fips(true)
518            .use_dual_stack(false)
519            .build()
520            .expect("invalid params");
521        let resolver = crate::config::endpoint::DefaultResolver::new();
522        let endpoint = resolver.resolve_endpoint(&params);
523        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-west-2.amazonaws.com");
524        assert_eq!(
525            endpoint,
526            ::aws_smithy_types::endpoint::Endpoint::builder()
527                .url("https://athena-fips.us-west-2.amazonaws.com")
528                .build()
529        );
530    }
531
532    /// For region us-east-1 with FIPS enabled and DualStack enabled
533    #[test]
534    fn test_26() {
535        let params = crate::config::endpoint::Params::builder()
536            .region("us-east-1".to_string())
537            .use_fips(true)
538            .use_dual_stack(true)
539            .build()
540            .expect("invalid params");
541        let resolver = crate::config::endpoint::DefaultResolver::new();
542        let endpoint = resolver.resolve_endpoint(&params);
543        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-east-1.api.aws");
544        assert_eq!(
545            endpoint,
546            ::aws_smithy_types::endpoint::Endpoint::builder()
547                .url("https://athena-fips.us-east-1.api.aws")
548                .build()
549        );
550    }
551
552    /// For region us-east-1 with FIPS disabled and DualStack enabled
553    #[test]
554    fn test_27() {
555        let params = crate::config::endpoint::Params::builder()
556            .region("us-east-1".to_string())
557            .use_fips(false)
558            .use_dual_stack(true)
559            .build()
560            .expect("invalid params");
561        let resolver = crate::config::endpoint::DefaultResolver::new();
562        let endpoint = resolver.resolve_endpoint(&params);
563        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-east-1.api.aws");
564        assert_eq!(
565            endpoint,
566            ::aws_smithy_types::endpoint::Endpoint::builder()
567                .url("https://athena.us-east-1.api.aws")
568                .build()
569        );
570    }
571
572    /// For region cn-north-1 with FIPS disabled and DualStack disabled
573    #[test]
574    fn test_28() {
575        let params = crate::config::endpoint::Params::builder()
576            .region("cn-north-1".to_string())
577            .use_fips(false)
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://athena.cn-north-1.amazonaws.com.cn");
584        assert_eq!(
585            endpoint,
586            ::aws_smithy_types::endpoint::Endpoint::builder()
587                .url("https://athena.cn-north-1.amazonaws.com.cn")
588                .build()
589        );
590    }
591
592    /// For region cn-northwest-1 with FIPS disabled and DualStack disabled
593    #[test]
594    fn test_29() {
595        let params = crate::config::endpoint::Params::builder()
596            .region("cn-northwest-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://athena.cn-northwest-1.amazonaws.com.cn");
604        assert_eq!(
605            endpoint,
606            ::aws_smithy_types::endpoint::Endpoint::builder()
607                .url("https://athena.cn-northwest-1.amazonaws.com.cn")
608                .build()
609        );
610    }
611
612    /// For region cn-north-1 with FIPS enabled and DualStack enabled
613    #[test]
614    fn test_30() {
615        let params = crate::config::endpoint::Params::builder()
616            .region("cn-north-1".to_string())
617            .use_fips(true)
618            .use_dual_stack(true)
619            .build()
620            .expect("invalid params");
621        let resolver = crate::config::endpoint::DefaultResolver::new();
622        let endpoint = resolver.resolve_endpoint(&params);
623        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.cn-north-1.api.amazonwebservices.com.cn");
624        assert_eq!(
625            endpoint,
626            ::aws_smithy_types::endpoint::Endpoint::builder()
627                .url("https://athena-fips.cn-north-1.api.amazonwebservices.com.cn")
628                .build()
629        );
630    }
631
632    /// For region cn-north-1 with FIPS enabled and DualStack disabled
633    #[test]
634    fn test_31() {
635        let params = crate::config::endpoint::Params::builder()
636            .region("cn-north-1".to_string())
637            .use_fips(true)
638            .use_dual_stack(false)
639            .build()
640            .expect("invalid params");
641        let resolver = crate::config::endpoint::DefaultResolver::new();
642        let endpoint = resolver.resolve_endpoint(&params);
643        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.cn-north-1.amazonaws.com.cn");
644        assert_eq!(
645            endpoint,
646            ::aws_smithy_types::endpoint::Endpoint::builder()
647                .url("https://athena-fips.cn-north-1.amazonaws.com.cn")
648                .build()
649        );
650    }
651
652    /// For region cn-north-1 with FIPS disabled and DualStack enabled
653    #[test]
654    fn test_32() {
655        let params = crate::config::endpoint::Params::builder()
656            .region("cn-north-1".to_string())
657            .use_fips(false)
658            .use_dual_stack(true)
659            .build()
660            .expect("invalid params");
661        let resolver = crate::config::endpoint::DefaultResolver::new();
662        let endpoint = resolver.resolve_endpoint(&params);
663        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.cn-north-1.api.amazonwebservices.com.cn");
664        assert_eq!(
665            endpoint,
666            ::aws_smithy_types::endpoint::Endpoint::builder()
667                .url("https://athena.cn-north-1.api.amazonwebservices.com.cn")
668                .build()
669        );
670    }
671
672    /// For region us-gov-east-1 with FIPS disabled and DualStack disabled
673    #[test]
674    fn test_33() {
675        let params = crate::config::endpoint::Params::builder()
676            .region("us-gov-east-1".to_string())
677            .use_fips(false)
678            .use_dual_stack(false)
679            .build()
680            .expect("invalid params");
681        let resolver = crate::config::endpoint::DefaultResolver::new();
682        let endpoint = resolver.resolve_endpoint(&params);
683        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-gov-east-1.amazonaws.com");
684        assert_eq!(
685            endpoint,
686            ::aws_smithy_types::endpoint::Endpoint::builder()
687                .url("https://athena.us-gov-east-1.amazonaws.com")
688                .build()
689        );
690    }
691
692    /// For region us-gov-east-1 with FIPS enabled and DualStack disabled
693    #[test]
694    fn test_34() {
695        let params = crate::config::endpoint::Params::builder()
696            .region("us-gov-east-1".to_string())
697            .use_fips(true)
698            .use_dual_stack(false)
699            .build()
700            .expect("invalid params");
701        let resolver = crate::config::endpoint::DefaultResolver::new();
702        let endpoint = resolver.resolve_endpoint(&params);
703        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-gov-east-1.amazonaws.com");
704        assert_eq!(
705            endpoint,
706            ::aws_smithy_types::endpoint::Endpoint::builder()
707                .url("https://athena-fips.us-gov-east-1.amazonaws.com")
708                .build()
709        );
710    }
711
712    /// For region us-gov-west-1 with FIPS disabled and DualStack disabled
713    #[test]
714    fn test_35() {
715        let params = crate::config::endpoint::Params::builder()
716            .region("us-gov-west-1".to_string())
717            .use_fips(false)
718            .use_dual_stack(false)
719            .build()
720            .expect("invalid params");
721        let resolver = crate::config::endpoint::DefaultResolver::new();
722        let endpoint = resolver.resolve_endpoint(&params);
723        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-gov-west-1.amazonaws.com");
724        assert_eq!(
725            endpoint,
726            ::aws_smithy_types::endpoint::Endpoint::builder()
727                .url("https://athena.us-gov-west-1.amazonaws.com")
728                .build()
729        );
730    }
731
732    /// For region us-gov-west-1 with FIPS enabled and DualStack disabled
733    #[test]
734    fn test_36() {
735        let params = crate::config::endpoint::Params::builder()
736            .region("us-gov-west-1".to_string())
737            .use_fips(true)
738            .use_dual_stack(false)
739            .build()
740            .expect("invalid params");
741        let resolver = crate::config::endpoint::DefaultResolver::new();
742        let endpoint = resolver.resolve_endpoint(&params);
743        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-gov-west-1.amazonaws.com");
744        assert_eq!(
745            endpoint,
746            ::aws_smithy_types::endpoint::Endpoint::builder()
747                .url("https://athena-fips.us-gov-west-1.amazonaws.com")
748                .build()
749        );
750    }
751
752    /// For region us-gov-east-1 with FIPS enabled and DualStack enabled
753    #[test]
754    fn test_37() {
755        let params = crate::config::endpoint::Params::builder()
756            .region("us-gov-east-1".to_string())
757            .use_fips(true)
758            .use_dual_stack(true)
759            .build()
760            .expect("invalid params");
761        let resolver = crate::config::endpoint::DefaultResolver::new();
762        let endpoint = resolver.resolve_endpoint(&params);
763        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-gov-east-1.api.aws");
764        assert_eq!(
765            endpoint,
766            ::aws_smithy_types::endpoint::Endpoint::builder()
767                .url("https://athena-fips.us-gov-east-1.api.aws")
768                .build()
769        );
770    }
771
772    /// For region us-gov-east-1 with FIPS disabled and DualStack enabled
773    #[test]
774    fn test_38() {
775        let params = crate::config::endpoint::Params::builder()
776            .region("us-gov-east-1".to_string())
777            .use_fips(false)
778            .use_dual_stack(true)
779            .build()
780            .expect("invalid params");
781        let resolver = crate::config::endpoint::DefaultResolver::new();
782        let endpoint = resolver.resolve_endpoint(&params);
783        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-gov-east-1.api.aws");
784        assert_eq!(
785            endpoint,
786            ::aws_smithy_types::endpoint::Endpoint::builder()
787                .url("https://athena.us-gov-east-1.api.aws")
788                .build()
789        );
790    }
791
792    /// For region us-iso-east-1 with FIPS enabled and DualStack disabled
793    #[test]
794    fn test_39() {
795        let params = crate::config::endpoint::Params::builder()
796            .region("us-iso-east-1".to_string())
797            .use_fips(true)
798            .use_dual_stack(false)
799            .build()
800            .expect("invalid params");
801        let resolver = crate::config::endpoint::DefaultResolver::new();
802        let endpoint = resolver.resolve_endpoint(&params);
803        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-iso-east-1.c2s.ic.gov");
804        assert_eq!(
805            endpoint,
806            ::aws_smithy_types::endpoint::Endpoint::builder()
807                .url("https://athena-fips.us-iso-east-1.c2s.ic.gov")
808                .build()
809        );
810    }
811
812    /// For region us-iso-east-1 with FIPS disabled and DualStack disabled
813    #[test]
814    fn test_40() {
815        let params = crate::config::endpoint::Params::builder()
816            .region("us-iso-east-1".to_string())
817            .use_fips(false)
818            .use_dual_stack(false)
819            .build()
820            .expect("invalid params");
821        let resolver = crate::config::endpoint::DefaultResolver::new();
822        let endpoint = resolver.resolve_endpoint(&params);
823        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-iso-east-1.c2s.ic.gov");
824        assert_eq!(
825            endpoint,
826            ::aws_smithy_types::endpoint::Endpoint::builder()
827                .url("https://athena.us-iso-east-1.c2s.ic.gov")
828                .build()
829        );
830    }
831
832    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
833    #[test]
834    fn test_41() {
835        let params = crate::config::endpoint::Params::builder()
836            .region("us-isob-east-1".to_string())
837            .use_fips(true)
838            .use_dual_stack(false)
839            .build()
840            .expect("invalid params");
841        let resolver = crate::config::endpoint::DefaultResolver::new();
842        let endpoint = resolver.resolve_endpoint(&params);
843        let endpoint = endpoint.expect("Expected valid endpoint: https://athena-fips.us-isob-east-1.sc2s.sgov.gov");
844        assert_eq!(
845            endpoint,
846            ::aws_smithy_types::endpoint::Endpoint::builder()
847                .url("https://athena-fips.us-isob-east-1.sc2s.sgov.gov")
848                .build()
849        );
850    }
851
852    /// For region us-isob-east-1 with FIPS disabled and DualStack disabled
853    #[test]
854    fn test_42() {
855        let params = crate::config::endpoint::Params::builder()
856            .region("us-isob-east-1".to_string())
857            .use_fips(false)
858            .use_dual_stack(false)
859            .build()
860            .expect("invalid params");
861        let resolver = crate::config::endpoint::DefaultResolver::new();
862        let endpoint = resolver.resolve_endpoint(&params);
863        let endpoint = endpoint.expect("Expected valid endpoint: https://athena.us-isob-east-1.sc2s.sgov.gov");
864        assert_eq!(
865            endpoint,
866            ::aws_smithy_types::endpoint::Endpoint::builder()
867                .url("https://athena.us-isob-east-1.sc2s.sgov.gov")
868                .build()
869        );
870    }
871
872    /// For custom endpoint with region set and fips disabled and dualstack disabled
873    #[test]
874    fn test_43() {
875        let params = crate::config::endpoint::Params::builder()
876            .region("us-east-1".to_string())
877            .use_fips(false)
878            .use_dual_stack(false)
879            .endpoint("https://example.com".to_string())
880            .build()
881            .expect("invalid params");
882        let resolver = crate::config::endpoint::DefaultResolver::new();
883        let endpoint = resolver.resolve_endpoint(&params);
884        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
885        assert_eq!(
886            endpoint,
887            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
888        );
889    }
890
891    /// For custom endpoint with region not set and fips disabled and dualstack disabled
892    #[test]
893    fn test_44() {
894        let params = crate::config::endpoint::Params::builder()
895            .use_fips(false)
896            .use_dual_stack(false)
897            .endpoint("https://example.com".to_string())
898            .build()
899            .expect("invalid params");
900        let resolver = crate::config::endpoint::DefaultResolver::new();
901        let endpoint = resolver.resolve_endpoint(&params);
902        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
903        assert_eq!(
904            endpoint,
905            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
906        );
907    }
908
909    /// For custom endpoint with fips enabled and dualstack disabled
910    #[test]
911    fn test_45() {
912        let params = crate::config::endpoint::Params::builder()
913            .region("us-east-1".to_string())
914            .use_fips(true)
915            .use_dual_stack(false)
916            .endpoint("https://example.com".to_string())
917            .build()
918            .expect("invalid params");
919        let resolver = crate::config::endpoint::DefaultResolver::new();
920        let endpoint = resolver.resolve_endpoint(&params);
921        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]");
922        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
923    }
924
925    /// For custom endpoint with fips disabled and dualstack enabled
926    #[test]
927    fn test_46() {
928        let params = crate::config::endpoint::Params::builder()
929            .region("us-east-1".to_string())
930            .use_fips(false)
931            .use_dual_stack(true)
932            .endpoint("https://example.com".to_string())
933            .build()
934            .expect("invalid params");
935        let resolver = crate::config::endpoint::DefaultResolver::new();
936        let endpoint = resolver.resolve_endpoint(&params);
937        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]");
938        assert_eq!(
939            format!("{}", error),
940            "Invalid Configuration: Dualstack and custom endpoint are not supported"
941        )
942    }
943
944    /// Missing region
945    #[test]
946    fn test_47() {
947        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
948        let resolver = crate::config::endpoint::DefaultResolver::new();
949        let endpoint = resolver.resolve_endpoint(&params);
950        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
951        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
952    }
953}
954
955/// Endpoint resolver trait specific to Amazon Athena
956pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
957    /// Resolve an endpoint with the given parameters
958    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
959
960    /// Convert this service-specific resolver into a `SharedEndpointResolver`
961    ///
962    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
963    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
964    where
965        Self: Sized + 'static,
966    {
967        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
968    }
969}
970
971#[derive(Debug)]
972struct DowncastParams<T>(T);
973impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
974where
975    T: ResolveEndpoint,
976{
977    fn resolve_endpoint<'a>(
978        &'a self,
979        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
980    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
981        let ep = match params.get::<crate::config::endpoint::Params>() {
982            Some(params) => self.0.resolve_endpoint(params),
983            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
984        };
985        ep
986    }
987}
988
989#[derive(Debug)]
990/// The default endpoint resolver.
991pub struct DefaultResolver {
992    partition_resolver: &'static crate::endpoint_lib::partition::PartitionResolver,
993    endpoint_cache: ::arc_swap::ArcSwap<::std::option::Option<(Params, ::aws_smithy_types::endpoint::Endpoint)>>,
994}
995
996impl Default for DefaultResolver {
997    fn default() -> Self {
998        Self::new()
999    }
1000}
1001
1002impl DefaultResolver {
1003    /// Create a new DefaultResolver
1004    pub fn new() -> Self {
1005        Self {
1006            partition_resolver: &crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER,
1007            endpoint_cache: ::arc_swap::ArcSwap::from_pointee(None),
1008        }
1009    }
1010
1011    #[allow(
1012        unused_variables,
1013        unused_parens,
1014        clippy::double_parens,
1015        clippy::useless_conversion,
1016        clippy::bool_comparison,
1017        clippy::comparison_to_empty,
1018        clippy::needless_borrow,
1019        clippy::useless_asref,
1020        clippy::redundant_closure_call,
1021        clippy::clone_on_copy
1022    )]
1023    fn resolve_endpoint<'a>(
1024        &'a self,
1025        params: &'a crate::config::endpoint::Params,
1026    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
1027        let mut _diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
1028        #[allow(unused_mut)]
1029        let mut context = ConditionContext::default();
1030
1031        // Param bindings
1032        let region = &params.region;
1033        let use_dual_stack = &params.use_dual_stack;
1034        let use_fips = &params.use_fips;
1035        let endpoint = &params.endpoint;
1036
1037        let mut current_ref: i32 = 2;
1038        loop {
1039            match current_ref {
1040                ref_val if ref_val >= 100_000_000 => {
1041                    return match (ref_val - 100_000_000) as usize {
1042                        0 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1043                            "No endpoint rule matched",
1044                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1045                        1 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1046                            "Invalid Configuration: FIPS and custom endpoint are not supported".to_string(),
1047                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1048                        2 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1049                            "Invalid Configuration: Dualstack and custom endpoint are not supported".to_string(),
1050                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1051                        3 => {
1052                            let endpoint = params.endpoint.as_deref().unwrap_or_default();
1053                            ::std::result::Result::Ok(::aws_smithy_types::endpoint::Endpoint::builder().url(endpoint.to_owned()).build())
1054                        }
1055                        4 => {
1056                            let region = params.region.as_deref().unwrap_or_default();
1057                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
1058                            ::std::result::Result::Ok(
1059                                ::aws_smithy_types::endpoint::Endpoint::builder()
1060                                    .url({
1061                                        let mut out = String::new();
1062                                        out.push_str("https://athena-fips.");
1063                                        #[allow(clippy::needless_borrow)]
1064                                        out.push_str(&region.as_ref());
1065                                        out.push('.');
1066                                        #[allow(clippy::needless_borrow)]
1067                                        out.push_str(&partition_result.dual_stack_dns_suffix());
1068                                        out
1069                                    })
1070                                    .build(),
1071                            )
1072                        }
1073                        5 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1074                            "FIPS and DualStack are enabled, but this partition does not support one or both".to_string(),
1075                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1076                        6 => {
1077                            let region = params.region.as_deref().unwrap_or_default();
1078                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
1079                            ::std::result::Result::Ok(
1080                                ::aws_smithy_types::endpoint::Endpoint::builder()
1081                                    .url({
1082                                        let mut out = String::new();
1083                                        out.push_str("https://athena-fips.");
1084                                        #[allow(clippy::needless_borrow)]
1085                                        out.push_str(&region.as_ref());
1086                                        out.push('.');
1087                                        #[allow(clippy::needless_borrow)]
1088                                        out.push_str(&partition_result.dns_suffix());
1089                                        out
1090                                    })
1091                                    .build(),
1092                            )
1093                        }
1094                        7 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1095                            "FIPS is enabled but this partition does not support FIPS".to_string(),
1096                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1097                        8 => {
1098                            let region = params.region.as_deref().unwrap_or_default();
1099                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
1100                            ::std::result::Result::Ok(
1101                                ::aws_smithy_types::endpoint::Endpoint::builder()
1102                                    .url({
1103                                        let mut out = String::new();
1104                                        out.push_str("https://athena.");
1105                                        #[allow(clippy::needless_borrow)]
1106                                        out.push_str(&region.as_ref());
1107                                        out.push('.');
1108                                        #[allow(clippy::needless_borrow)]
1109                                        out.push_str(&partition_result.dual_stack_dns_suffix());
1110                                        out
1111                                    })
1112                                    .build(),
1113                            )
1114                        }
1115                        9 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1116                            "DualStack is enabled but this partition does not support DualStack".to_string(),
1117                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1118                        10 => {
1119                            let region = params.region.as_deref().unwrap_or_default();
1120                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
1121                            ::std::result::Result::Ok(
1122                                ::aws_smithy_types::endpoint::Endpoint::builder()
1123                                    .url({
1124                                        let mut out = String::new();
1125                                        out.push_str("https://athena.");
1126                                        #[allow(clippy::needless_borrow)]
1127                                        out.push_str(&region.as_ref());
1128                                        out.push('.');
1129                                        #[allow(clippy::needless_borrow)]
1130                                        out.push_str(&partition_result.dns_suffix());
1131                                        out
1132                                    })
1133                                    .build(),
1134                            )
1135                        }
1136                        11 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1137                            "Invalid Configuration: Missing Region".to_string(),
1138                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1139                        _ => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
1140                            "No endpoint rule matched",
1141                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
1142                    };
1143                }
1144                1 | -1 => {
1145                    return ::std::result::Result::Err(
1146                        Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message("No endpoint rule matched"))
1147                            as ::aws_smithy_runtime_api::box_error::BoxError,
1148                    )
1149                }
1150                ref_val => {
1151                    let is_complement = ref_val < 0;
1152                    let node = &NODES[(ref_val.unsigned_abs() as usize) - 1];
1153                    let condition_result = match node.condition_index {
1154                        0 => endpoint.is_some(),
1155                        1 => region.is_some(),
1156                        2 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
1157                            let partition_result = &mut context.partition_result;
1158                            let partition_resolver = &self.partition_resolver;
1159                            {
1160                                *partition_result = partition_resolver
1161                                    .resolve_partition(if let Some(param) = region { param } else { return false }, _diagnostic_collector)
1162                                    .map(|inner| inner.into());
1163                                partition_result.is_some()
1164                            }
1165                        })(&mut _diagnostic_collector),
1166                        3 => (use_fips) == (&true),
1167                        4 => (use_dual_stack) == (&true),
1168                        5 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
1169                            let partition_result = &context.partition_result;
1170                            let partition_resolver = &self.partition_resolver;
1171                            (if let Some(inner) = partition_result {
1172                                inner.supports_dual_stack()
1173                            } else {
1174                                return false;
1175                            }) == (true)
1176                        })(&mut _diagnostic_collector),
1177                        6 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
1178                            let partition_result = &context.partition_result;
1179                            let partition_resolver = &self.partition_resolver;
1180                            (if let Some(inner) = partition_result {
1181                                inner.supports_fips()
1182                            } else {
1183                                return false;
1184                            }) == (true)
1185                        })(&mut _diagnostic_collector),
1186                        _ => unreachable!("Invalid condition index"),
1187                    };
1188                    current_ref = if is_complement ^ condition_result { node.high_ref } else { node.low_ref };
1189                }
1190            }
1191        }
1192    }
1193}
1194
1195impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
1196    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
1197        // Check single-entry cache (lock-free read via ArcSwap)
1198        let cached = self.endpoint_cache.load();
1199        if let Some((cached_params, cached_endpoint)) = cached.as_ref() {
1200            if cached_params == params {
1201                return ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(::std::result::Result::Ok(cached_endpoint.clone()));
1202            }
1203        }
1204        drop(cached);
1205        let result = self.resolve_endpoint(params);
1206        if let ::std::result::Result::Ok(ref endpoint) = result {
1207            self.endpoint_cache.store(::std::sync::Arc::new(Some((params.clone(), endpoint.clone()))));
1208        }
1209        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(result)
1210    }
1211}
1212const NODES: [crate::endpoint_lib::bdd_interpreter::BddNode; 13] = [
1213    crate::endpoint_lib::bdd_interpreter::BddNode {
1214        condition_index: -1,
1215        high_ref: 1,
1216        low_ref: -1,
1217    },
1218    crate::endpoint_lib::bdd_interpreter::BddNode {
1219        condition_index: 0,
1220        high_ref: 12,
1221        low_ref: 3,
1222    },
1223    crate::endpoint_lib::bdd_interpreter::BddNode {
1224        condition_index: 1,
1225        high_ref: 4,
1226        low_ref: 100000011,
1227    },
1228    crate::endpoint_lib::bdd_interpreter::BddNode {
1229        condition_index: 2,
1230        high_ref: 5,
1231        low_ref: 100000011,
1232    },
1233    crate::endpoint_lib::bdd_interpreter::BddNode {
1234        condition_index: 3,
1235        high_ref: 8,
1236        low_ref: 6,
1237    },
1238    crate::endpoint_lib::bdd_interpreter::BddNode {
1239        condition_index: 4,
1240        high_ref: 7,
1241        low_ref: 100000010,
1242    },
1243    crate::endpoint_lib::bdd_interpreter::BddNode {
1244        condition_index: 5,
1245        high_ref: 100000008,
1246        low_ref: 100000009,
1247    },
1248    crate::endpoint_lib::bdd_interpreter::BddNode {
1249        condition_index: 4,
1250        high_ref: 10,
1251        low_ref: 9,
1252    },
1253    crate::endpoint_lib::bdd_interpreter::BddNode {
1254        condition_index: 6,
1255        high_ref: 100000006,
1256        low_ref: 100000007,
1257    },
1258    crate::endpoint_lib::bdd_interpreter::BddNode {
1259        condition_index: 5,
1260        high_ref: 11,
1261        low_ref: 100000005,
1262    },
1263    crate::endpoint_lib::bdd_interpreter::BddNode {
1264        condition_index: 6,
1265        high_ref: 100000004,
1266        low_ref: 100000005,
1267    },
1268    crate::endpoint_lib::bdd_interpreter::BddNode {
1269        condition_index: 3,
1270        high_ref: 100000001,
1271        low_ref: 13,
1272    },
1273    crate::endpoint_lib::bdd_interpreter::BddNode {
1274        condition_index: 4,
1275        high_ref: 100000002,
1276        low_ref: 100000003,
1277    },
1278];
1279// These are all optional since they are set by conditions and will
1280// all be unset when we start evaluation
1281#[derive(Default)]
1282#[allow(unused_lifetimes)]
1283pub(crate) struct ConditionContext<'a> {
1284    pub(crate) partition_result: Option<crate::endpoint_lib::partition::Partition<'a>>,
1285    // Sometimes none of the members reference the lifetime, this makes it still valid
1286    phantom: std::marker::PhantomData<&'a ()>,
1287}
1288
1289#[non_exhaustive]
1290#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
1291/// Configuration parameters for resolving the correct endpoint
1292pub struct Params {
1293    /// The AWS region used to dispatch the request.
1294    pub(crate) region: ::std::option::Option<::std::string::String>,
1295    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1296    pub(crate) use_dual_stack: bool,
1297    /// 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.
1298    pub(crate) use_fips: bool,
1299    /// Override the endpoint used to send this request
1300    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
1301}
1302impl Params {
1303    /// Create a builder for [`Params`]
1304    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
1305        crate::config::endpoint::ParamsBuilder::default()
1306    }
1307    /// The AWS region used to dispatch the request.
1308    pub fn region(&self) -> ::std::option::Option<&str> {
1309        self.region.as_deref()
1310    }
1311    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1312    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
1313        Some(self.use_dual_stack)
1314    }
1315    /// 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.
1316    pub fn use_fips(&self) -> ::std::option::Option<bool> {
1317        Some(self.use_fips)
1318    }
1319    /// Override the endpoint used to send this request
1320    pub fn endpoint(&self) -> ::std::option::Option<&str> {
1321        self.endpoint.as_deref()
1322    }
1323}
1324
1325/// Builder for [`Params`]
1326#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
1327pub struct ParamsBuilder {
1328    region: ::std::option::Option<::std::string::String>,
1329    use_dual_stack: ::std::option::Option<bool>,
1330    use_fips: ::std::option::Option<bool>,
1331    endpoint: ::std::option::Option<::std::string::String>,
1332}
1333impl ParamsBuilder {
1334    /// Consume this builder, creating [`Params`].
1335    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
1336        if let Some(region) = &self.region {
1337            if !crate::endpoint_lib::host::is_valid_host_label(
1338                region.as_ref() as &str,
1339                true,
1340                &mut crate::endpoint_lib::diagnostic::DiagnosticCollector::new(),
1341            ) {
1342                return Err(crate::config::endpoint::InvalidParams::invalid_value(
1343                    "region",
1344                    "must be a valid host label",
1345                ));
1346            }
1347        };
1348        Ok(
1349            #[allow(clippy::unnecessary_lazy_evaluations)]
1350            crate::config::endpoint::Params {
1351                region: self.region,
1352                use_dual_stack: self
1353                    .use_dual_stack
1354                    .or_else(|| Some(false))
1355                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
1356                use_fips: self
1357                    .use_fips
1358                    .or_else(|| Some(false))
1359                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
1360                endpoint: self.endpoint,
1361            },
1362        )
1363    }
1364    /// Sets the value for region
1365    ///
1366    /// The AWS region used to dispatch the request.
1367    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
1368        self.region = Some(value.into());
1369        self
1370    }
1371
1372    /// Sets the value for region
1373    ///
1374    /// The AWS region used to dispatch the request.
1375    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
1376        self.region = param;
1377        self
1378    }
1379    /// Sets the value for use_dual_stack
1380    ///
1381    /// When unset, this parameter has a default value of `false`.
1382    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1383    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
1384        self.use_dual_stack = Some(value.into());
1385        self
1386    }
1387
1388    /// Sets the value for use_dual_stack
1389    ///
1390    /// When unset, this parameter has a default value of `false`.
1391    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1392    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
1393        self.use_dual_stack = param;
1394        self
1395    }
1396    /// Sets the value for use_fips
1397    ///
1398    /// When unset, this parameter has a default value of `false`.
1399    /// 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.
1400    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
1401        self.use_fips = Some(value.into());
1402        self
1403    }
1404
1405    /// Sets the value for use_fips
1406    ///
1407    /// When unset, this parameter has a default value of `false`.
1408    /// 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.
1409    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
1410        self.use_fips = param;
1411        self
1412    }
1413    /// Sets the value for endpoint
1414    ///
1415    /// Override the endpoint used to send this request
1416    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
1417        self.endpoint = Some(value.into());
1418        self
1419    }
1420
1421    /// Sets the value for endpoint
1422    ///
1423    /// Override the endpoint used to send this request
1424    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
1425        self.endpoint = param;
1426        self
1427    }
1428}
1429
1430/// An error that occurred during endpoint resolution
1431#[derive(Debug)]
1432pub struct InvalidParams {
1433    field: std::borrow::Cow<'static, str>,
1434    kind: InvalidParamsErrorKind,
1435}
1436
1437/// The kind of invalid parameter error
1438#[derive(Debug)]
1439enum InvalidParamsErrorKind {
1440    MissingField,
1441    InvalidValue { message: &'static str },
1442}
1443
1444impl InvalidParams {
1445    #[allow(dead_code)]
1446    fn missing(field: &'static str) -> Self {
1447        Self {
1448            field: field.into(),
1449            kind: InvalidParamsErrorKind::MissingField,
1450        }
1451    }
1452
1453    #[allow(dead_code)]
1454    fn invalid_value(field: &'static str, message: &'static str) -> Self {
1455        Self {
1456            field: field.into(),
1457            kind: InvalidParamsErrorKind::InvalidValue { message },
1458        }
1459    }
1460}
1461
1462impl std::fmt::Display for InvalidParams {
1463    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1464        match self.kind {
1465            InvalidParamsErrorKind::MissingField => write!(f, "a required field was missing: `{}`", self.field),
1466            InvalidParamsErrorKind::InvalidValue { message } => write!(f, "invalid value for field: `{}` - {}", self.field, message),
1467        }
1468    }
1469}
1470
1471impl std::error::Error for InvalidParams {}