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