Skip to main content

aws_sdk_appstream/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 ap-northeast-1 with FIPS disabled and DualStack disabled
33    #[test]
34    fn test_1() {
35        let params = crate::config::endpoint::Params::builder()
36            .region("ap-northeast-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://appstream2.ap-northeast-1.amazonaws.com");
44        assert_eq!(
45            endpoint,
46            ::aws_smithy_types::endpoint::Endpoint::builder()
47                .url("https://appstream2.ap-northeast-1.amazonaws.com")
48                .build()
49        );
50    }
51
52    /// For region ap-northeast-2 with FIPS disabled and DualStack disabled
53    #[test]
54    fn test_2() {
55        let params = crate::config::endpoint::Params::builder()
56            .region("ap-northeast-2".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://appstream2.ap-northeast-2.amazonaws.com");
64        assert_eq!(
65            endpoint,
66            ::aws_smithy_types::endpoint::Endpoint::builder()
67                .url("https://appstream2.ap-northeast-2.amazonaws.com")
68                .build()
69        );
70    }
71
72    /// For region ap-south-1 with FIPS disabled and DualStack disabled
73    #[test]
74    fn test_3() {
75        let params = crate::config::endpoint::Params::builder()
76            .region("ap-south-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://appstream2.ap-south-1.amazonaws.com");
84        assert_eq!(
85            endpoint,
86            ::aws_smithy_types::endpoint::Endpoint::builder()
87                .url("https://appstream2.ap-south-1.amazonaws.com")
88                .build()
89        );
90    }
91
92    /// For region ap-southeast-1 with FIPS disabled and DualStack disabled
93    #[test]
94    fn test_4() {
95        let params = crate::config::endpoint::Params::builder()
96            .region("ap-southeast-1".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://appstream2.ap-southeast-1.amazonaws.com");
104        assert_eq!(
105            endpoint,
106            ::aws_smithy_types::endpoint::Endpoint::builder()
107                .url("https://appstream2.ap-southeast-1.amazonaws.com")
108                .build()
109        );
110    }
111
112    /// For region ap-southeast-2 with FIPS disabled and DualStack disabled
113    #[test]
114    fn test_5() {
115        let params = crate::config::endpoint::Params::builder()
116            .region("ap-southeast-2".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://appstream2.ap-southeast-2.amazonaws.com");
124        assert_eq!(
125            endpoint,
126            ::aws_smithy_types::endpoint::Endpoint::builder()
127                .url("https://appstream2.ap-southeast-2.amazonaws.com")
128                .build()
129        );
130    }
131
132    /// For region ca-central-1 with FIPS disabled and DualStack disabled
133    #[test]
134    fn test_6() {
135        let params = crate::config::endpoint::Params::builder()
136            .region("ca-central-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://appstream2.ca-central-1.amazonaws.com");
144        assert_eq!(
145            endpoint,
146            ::aws_smithy_types::endpoint::Endpoint::builder()
147                .url("https://appstream2.ca-central-1.amazonaws.com")
148                .build()
149        );
150    }
151
152    /// For region eu-central-1 with FIPS disabled and DualStack disabled
153    #[test]
154    fn test_7() {
155        let params = crate::config::endpoint::Params::builder()
156            .region("eu-central-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://appstream2.eu-central-1.amazonaws.com");
164        assert_eq!(
165            endpoint,
166            ::aws_smithy_types::endpoint::Endpoint::builder()
167                .url("https://appstream2.eu-central-1.amazonaws.com")
168                .build()
169        );
170    }
171
172    /// For region eu-west-1 with FIPS disabled and DualStack disabled
173    #[test]
174    fn test_8() {
175        let params = crate::config::endpoint::Params::builder()
176            .region("eu-west-1".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://appstream2.eu-west-1.amazonaws.com");
184        assert_eq!(
185            endpoint,
186            ::aws_smithy_types::endpoint::Endpoint::builder()
187                .url("https://appstream2.eu-west-1.amazonaws.com")
188                .build()
189        );
190    }
191
192    /// For region eu-west-2 with FIPS disabled and DualStack disabled
193    #[test]
194    fn test_9() {
195        let params = crate::config::endpoint::Params::builder()
196            .region("eu-west-2".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://appstream2.eu-west-2.amazonaws.com");
204        assert_eq!(
205            endpoint,
206            ::aws_smithy_types::endpoint::Endpoint::builder()
207                .url("https://appstream2.eu-west-2.amazonaws.com")
208                .build()
209        );
210    }
211
212    /// For region us-east-1 with FIPS disabled and DualStack disabled
213    #[test]
214    fn test_10() {
215        let params = crate::config::endpoint::Params::builder()
216            .region("us-east-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://appstream2.us-east-1.amazonaws.com");
224        assert_eq!(
225            endpoint,
226            ::aws_smithy_types::endpoint::Endpoint::builder()
227                .url("https://appstream2.us-east-1.amazonaws.com")
228                .build()
229        );
230    }
231
232    /// For region us-east-1 with FIPS enabled and DualStack disabled
233    #[test]
234    fn test_11() {
235        let params = crate::config::endpoint::Params::builder()
236            .region("us-east-1".to_string())
237            .use_fips(true)
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://appstream2-fips.us-east-1.amazonaws.com");
244        assert_eq!(
245            endpoint,
246            ::aws_smithy_types::endpoint::Endpoint::builder()
247                .url("https://appstream2-fips.us-east-1.amazonaws.com")
248                .build()
249        );
250    }
251
252    /// For region us-east-2 with FIPS disabled and DualStack disabled
253    #[test]
254    fn test_12() {
255        let params = crate::config::endpoint::Params::builder()
256            .region("us-east-2".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://appstream2.us-east-2.amazonaws.com");
264        assert_eq!(
265            endpoint,
266            ::aws_smithy_types::endpoint::Endpoint::builder()
267                .url("https://appstream2.us-east-2.amazonaws.com")
268                .build()
269        );
270    }
271
272    /// For region us-west-2 with FIPS disabled and DualStack disabled
273    #[test]
274    fn test_13() {
275        let params = crate::config::endpoint::Params::builder()
276            .region("us-west-2".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://appstream2.us-west-2.amazonaws.com");
284        assert_eq!(
285            endpoint,
286            ::aws_smithy_types::endpoint::Endpoint::builder()
287                .url("https://appstream2.us-west-2.amazonaws.com")
288                .build()
289        );
290    }
291
292    /// For region us-west-2 with FIPS enabled and DualStack disabled
293    #[test]
294    fn test_14() {
295        let params = crate::config::endpoint::Params::builder()
296            .region("us-west-2".to_string())
297            .use_fips(true)
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://appstream2-fips.us-west-2.amazonaws.com");
304        assert_eq!(
305            endpoint,
306            ::aws_smithy_types::endpoint::Endpoint::builder()
307                .url("https://appstream2-fips.us-west-2.amazonaws.com")
308                .build()
309        );
310    }
311
312    /// For region us-east-1 with FIPS enabled and DualStack enabled
313    #[test]
314    fn test_15() {
315        let params = crate::config::endpoint::Params::builder()
316            .region("us-east-1".to_string())
317            .use_fips(true)
318            .use_dual_stack(true)
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://appstream2-fips.us-east-1.api.aws");
324        assert_eq!(
325            endpoint,
326            ::aws_smithy_types::endpoint::Endpoint::builder()
327                .url("https://appstream2-fips.us-east-1.api.aws")
328                .build()
329        );
330    }
331
332    /// For region us-east-1 with FIPS disabled and DualStack enabled
333    #[test]
334    fn test_16() {
335        let params = crate::config::endpoint::Params::builder()
336            .region("us-east-1".to_string())
337            .use_fips(false)
338            .use_dual_stack(true)
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://appstream2.us-east-1.api.aws");
344        assert_eq!(
345            endpoint,
346            ::aws_smithy_types::endpoint::Endpoint::builder()
347                .url("https://appstream2.us-east-1.api.aws")
348                .build()
349        );
350    }
351
352    /// For region cn-north-1 with FIPS enabled and DualStack enabled
353    #[test]
354    fn test_17() {
355        let params = crate::config::endpoint::Params::builder()
356            .region("cn-north-1".to_string())
357            .use_fips(true)
358            .use_dual_stack(true)
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://appstream2-fips.cn-north-1.api.amazonwebservices.com.cn");
364        assert_eq!(
365            endpoint,
366            ::aws_smithy_types::endpoint::Endpoint::builder()
367                .url("https://appstream2-fips.cn-north-1.api.amazonwebservices.com.cn")
368                .build()
369        );
370    }
371
372    /// For region cn-north-1 with FIPS enabled and DualStack disabled
373    #[test]
374    fn test_18() {
375        let params = crate::config::endpoint::Params::builder()
376            .region("cn-north-1".to_string())
377            .use_fips(true)
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://appstream2-fips.cn-north-1.amazonaws.com.cn");
384        assert_eq!(
385            endpoint,
386            ::aws_smithy_types::endpoint::Endpoint::builder()
387                .url("https://appstream2-fips.cn-north-1.amazonaws.com.cn")
388                .build()
389        );
390    }
391
392    /// For region cn-north-1 with FIPS disabled and DualStack enabled
393    #[test]
394    fn test_19() {
395        let params = crate::config::endpoint::Params::builder()
396            .region("cn-north-1".to_string())
397            .use_fips(false)
398            .use_dual_stack(true)
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://appstream2.cn-north-1.api.amazonwebservices.com.cn");
404        assert_eq!(
405            endpoint,
406            ::aws_smithy_types::endpoint::Endpoint::builder()
407                .url("https://appstream2.cn-north-1.api.amazonwebservices.com.cn")
408                .build()
409        );
410    }
411
412    /// For region cn-north-1 with FIPS disabled and DualStack disabled
413    #[test]
414    fn test_20() {
415        let params = crate::config::endpoint::Params::builder()
416            .region("cn-north-1".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://appstream2.cn-north-1.amazonaws.com.cn");
424        assert_eq!(
425            endpoint,
426            ::aws_smithy_types::endpoint::Endpoint::builder()
427                .url("https://appstream2.cn-north-1.amazonaws.com.cn")
428                .build()
429        );
430    }
431
432    /// For region us-gov-west-1 with FIPS disabled and DualStack disabled
433    #[test]
434    fn test_21() {
435        let params = crate::config::endpoint::Params::builder()
436            .region("us-gov-west-1".to_string())
437            .use_fips(false)
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://appstream2.us-gov-west-1.amazonaws.com");
444        assert_eq!(
445            endpoint,
446            ::aws_smithy_types::endpoint::Endpoint::builder()
447                .url("https://appstream2.us-gov-west-1.amazonaws.com")
448                .build()
449        );
450    }
451
452    /// For region us-gov-west-1 with FIPS enabled and DualStack disabled
453    #[test]
454    fn test_22() {
455        let params = crate::config::endpoint::Params::builder()
456            .region("us-gov-west-1".to_string())
457            .use_fips(true)
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://appstream2-fips.us-gov-west-1.amazonaws.com");
464        assert_eq!(
465            endpoint,
466            ::aws_smithy_types::endpoint::Endpoint::builder()
467                .url("https://appstream2-fips.us-gov-west-1.amazonaws.com")
468                .build()
469        );
470    }
471
472    /// For region us-gov-east-1 with FIPS enabled and DualStack enabled
473    #[test]
474    fn test_23() {
475        let params = crate::config::endpoint::Params::builder()
476            .region("us-gov-east-1".to_string())
477            .use_fips(true)
478            .use_dual_stack(true)
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://appstream2-fips.us-gov-east-1.api.aws");
484        assert_eq!(
485            endpoint,
486            ::aws_smithy_types::endpoint::Endpoint::builder()
487                .url("https://appstream2-fips.us-gov-east-1.api.aws")
488                .build()
489        );
490    }
491
492    /// For region us-gov-east-1 with FIPS enabled and DualStack disabled
493    #[test]
494    fn test_24() {
495        let params = crate::config::endpoint::Params::builder()
496            .region("us-gov-east-1".to_string())
497            .use_fips(true)
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://appstream2-fips.us-gov-east-1.amazonaws.com");
504        assert_eq!(
505            endpoint,
506            ::aws_smithy_types::endpoint::Endpoint::builder()
507                .url("https://appstream2-fips.us-gov-east-1.amazonaws.com")
508                .build()
509        );
510    }
511
512    /// For region us-gov-east-1 with FIPS disabled and DualStack enabled
513    #[test]
514    fn test_25() {
515        let params = crate::config::endpoint::Params::builder()
516            .region("us-gov-east-1".to_string())
517            .use_fips(false)
518            .use_dual_stack(true)
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://appstream2.us-gov-east-1.api.aws");
524        assert_eq!(
525            endpoint,
526            ::aws_smithy_types::endpoint::Endpoint::builder()
527                .url("https://appstream2.us-gov-east-1.api.aws")
528                .build()
529        );
530    }
531
532    /// For region us-gov-east-1 with FIPS disabled and DualStack disabled
533    #[test]
534    fn test_26() {
535        let params = crate::config::endpoint::Params::builder()
536            .region("us-gov-east-1".to_string())
537            .use_fips(false)
538            .use_dual_stack(false)
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://appstream2.us-gov-east-1.amazonaws.com");
544        assert_eq!(
545            endpoint,
546            ::aws_smithy_types::endpoint::Endpoint::builder()
547                .url("https://appstream2.us-gov-east-1.amazonaws.com")
548                .build()
549        );
550    }
551
552    /// For region us-iso-east-1 with FIPS enabled and DualStack disabled
553    #[test]
554    fn test_27() {
555        let params = crate::config::endpoint::Params::builder()
556            .region("us-iso-east-1".to_string())
557            .use_fips(true)
558            .use_dual_stack(false)
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://appstream2-fips.us-iso-east-1.c2s.ic.gov");
564        assert_eq!(
565            endpoint,
566            ::aws_smithy_types::endpoint::Endpoint::builder()
567                .url("https://appstream2-fips.us-iso-east-1.c2s.ic.gov")
568                .build()
569        );
570    }
571
572    /// For region us-iso-east-1 with FIPS disabled and DualStack disabled
573    #[test]
574    fn test_28() {
575        let params = crate::config::endpoint::Params::builder()
576            .region("us-iso-east-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://appstream2.us-iso-east-1.c2s.ic.gov");
584        assert_eq!(
585            endpoint,
586            ::aws_smithy_types::endpoint::Endpoint::builder()
587                .url("https://appstream2.us-iso-east-1.c2s.ic.gov")
588                .build()
589        );
590    }
591
592    /// For region us-isob-east-1 with FIPS enabled and DualStack disabled
593    #[test]
594    fn test_29() {
595        let params = crate::config::endpoint::Params::builder()
596            .region("us-isob-east-1".to_string())
597            .use_fips(true)
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://appstream2-fips.us-isob-east-1.sc2s.sgov.gov");
604        assert_eq!(
605            endpoint,
606            ::aws_smithy_types::endpoint::Endpoint::builder()
607                .url("https://appstream2-fips.us-isob-east-1.sc2s.sgov.gov")
608                .build()
609        );
610    }
611
612    /// For region us-isob-east-1 with FIPS disabled and DualStack disabled
613    #[test]
614    fn test_30() {
615        let params = crate::config::endpoint::Params::builder()
616            .region("us-isob-east-1".to_string())
617            .use_fips(false)
618            .use_dual_stack(false)
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://appstream2.us-isob-east-1.sc2s.sgov.gov");
624        assert_eq!(
625            endpoint,
626            ::aws_smithy_types::endpoint::Endpoint::builder()
627                .url("https://appstream2.us-isob-east-1.sc2s.sgov.gov")
628                .build()
629        );
630    }
631
632    /// For custom endpoint with region set and fips disabled and dualstack disabled
633    #[test]
634    fn test_31() {
635        let params = crate::config::endpoint::Params::builder()
636            .region("us-east-1".to_string())
637            .use_fips(false)
638            .use_dual_stack(false)
639            .endpoint("https://example.com".to_string())
640            .build()
641            .expect("invalid params");
642        let resolver = crate::config::endpoint::DefaultResolver::new();
643        let endpoint = resolver.resolve_endpoint(&params);
644        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
645        assert_eq!(
646            endpoint,
647            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
648        );
649    }
650
651    /// For custom endpoint with region not set and fips disabled and dualstack disabled
652    #[test]
653    fn test_32() {
654        let params = crate::config::endpoint::Params::builder()
655            .use_fips(false)
656            .use_dual_stack(false)
657            .endpoint("https://example.com".to_string())
658            .build()
659            .expect("invalid params");
660        let resolver = crate::config::endpoint::DefaultResolver::new();
661        let endpoint = resolver.resolve_endpoint(&params);
662        let endpoint = endpoint.expect("Expected valid endpoint: https://example.com");
663        assert_eq!(
664            endpoint,
665            ::aws_smithy_types::endpoint::Endpoint::builder().url("https://example.com").build()
666        );
667    }
668
669    /// For custom endpoint with fips enabled and dualstack disabled
670    #[test]
671    fn test_33() {
672        let params = crate::config::endpoint::Params::builder()
673            .region("us-east-1".to_string())
674            .use_fips(true)
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 error = endpoint.expect_err("expected error: Invalid Configuration: FIPS and custom endpoint are not supported [For custom endpoint with fips enabled and dualstack disabled]");
682        assert_eq!(format!("{}", error), "Invalid Configuration: FIPS and custom endpoint are not supported")
683    }
684
685    /// For custom endpoint with fips disabled and dualstack enabled
686    #[test]
687    fn test_34() {
688        let params = crate::config::endpoint::Params::builder()
689            .region("us-east-1".to_string())
690            .use_fips(false)
691            .use_dual_stack(true)
692            .endpoint("https://example.com".to_string())
693            .build()
694            .expect("invalid params");
695        let resolver = crate::config::endpoint::DefaultResolver::new();
696        let endpoint = resolver.resolve_endpoint(&params);
697        let error = endpoint.expect_err("expected error: Invalid Configuration: Dualstack and custom endpoint are not supported [For custom endpoint with fips disabled and dualstack enabled]");
698        assert_eq!(
699            format!("{}", error),
700            "Invalid Configuration: Dualstack and custom endpoint are not supported"
701        )
702    }
703
704    /// Missing region
705    #[test]
706    fn test_35() {
707        let params = crate::config::endpoint::Params::builder().build().expect("invalid params");
708        let resolver = crate::config::endpoint::DefaultResolver::new();
709        let endpoint = resolver.resolve_endpoint(&params);
710        let error = endpoint.expect_err("expected error: Invalid Configuration: Missing Region [Missing region]");
711        assert_eq!(format!("{}", error), "Invalid Configuration: Missing Region")
712    }
713}
714
715/// Endpoint resolver trait specific to Amazon AppStream
716pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
717    /// Resolve an endpoint with the given parameters
718    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
719
720    /// Convert this service-specific resolver into a `SharedEndpointResolver`
721    ///
722    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
723    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
724    where
725        Self: Sized + 'static,
726    {
727        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
728    }
729}
730
731#[derive(Debug)]
732struct DowncastParams<T>(T);
733impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
734where
735    T: ResolveEndpoint,
736{
737    fn resolve_endpoint<'a>(
738        &'a self,
739        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
740    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
741        let ep = match params.get::<crate::config::endpoint::Params>() {
742            Some(params) => self.0.resolve_endpoint(params),
743            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
744        };
745        ep
746    }
747}
748
749#[derive(Debug)]
750/// The default endpoint resolver.
751pub struct DefaultResolver {
752    partition_resolver: &'static crate::endpoint_lib::partition::PartitionResolver,
753    endpoint_cache: ::arc_swap::ArcSwap<::std::option::Option<(Params, ::aws_smithy_types::endpoint::Endpoint)>>,
754}
755
756impl Default for DefaultResolver {
757    fn default() -> Self {
758        Self::new()
759    }
760}
761
762impl DefaultResolver {
763    /// Create a new DefaultResolver
764    pub fn new() -> Self {
765        Self {
766            partition_resolver: &crate::endpoint_lib::DEFAULT_PARTITION_RESOLVER,
767            endpoint_cache: ::arc_swap::ArcSwap::from_pointee(None),
768        }
769    }
770
771    #[allow(
772        unused_variables,
773        unused_parens,
774        clippy::double_parens,
775        clippy::useless_conversion,
776        clippy::bool_comparison,
777        clippy::comparison_to_empty,
778        clippy::needless_borrow,
779        clippy::useless_asref,
780        clippy::redundant_closure_call,
781        clippy::clone_on_copy,
782        clippy::single_char_add_str
783    )]
784    fn resolve_endpoint<'a>(
785        &'a self,
786        params: &'a crate::config::endpoint::Params,
787    ) -> ::std::result::Result<::aws_smithy_types::endpoint::Endpoint, ::aws_smithy_runtime_api::box_error::BoxError> {
788        let mut _diagnostic_collector = crate::endpoint_lib::diagnostic::DiagnosticCollector::new();
789        #[allow(unused_mut)]
790        let mut context = ConditionContext::default();
791
792        // Param bindings
793        let region = &params.region;
794        let use_dual_stack = &params.use_dual_stack;
795        let use_fips = &params.use_fips;
796        let endpoint = &params.endpoint;
797
798        let mut current_ref: i32 = 2;
799        loop {
800            match current_ref {
801                ref_val if ref_val >= 100_000_000 => {
802                    return match (ref_val - 100_000_000) as usize {
803                        0 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
804                            "No endpoint rule matched",
805                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
806                        1 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
807                            "Invalid Configuration: FIPS and custom endpoint are not supported".to_string(),
808                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
809                        2 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
810                            "Invalid Configuration: Dualstack and custom endpoint are not supported".to_string(),
811                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
812                        3 => {
813                            let endpoint = params.endpoint.as_deref().unwrap_or_default();
814                            ::std::result::Result::Ok(::aws_smithy_types::endpoint::Endpoint::builder().url(endpoint.to_owned()).build())
815                        }
816                        4 => {
817                            let region = params.region.as_deref().unwrap_or_default();
818                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
819                            ::std::result::Result::Ok(
820                                ::aws_smithy_types::endpoint::Endpoint::builder()
821                                    .url({
822                                        let mut out = String::new();
823                                        out.push_str("https://appstream2-fips.");
824                                        #[allow(clippy::needless_borrow)]
825                                        out.push_str(&region.as_ref());
826                                        out.push_str(".");
827                                        #[allow(clippy::needless_borrow)]
828                                        out.push_str(&partition_result.dual_stack_dns_suffix());
829                                        out
830                                    })
831                                    .build(),
832                            )
833                        }
834                        5 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
835                            "FIPS and DualStack are enabled, but this partition does not support one or both".to_string(),
836                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
837                        6 => {
838                            let region = params.region.as_deref().unwrap_or_default();
839                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
840                            ::std::result::Result::Ok(
841                                ::aws_smithy_types::endpoint::Endpoint::builder()
842                                    .url({
843                                        let mut out = String::new();
844                                        out.push_str("https://appstream2-fips.");
845                                        #[allow(clippy::needless_borrow)]
846                                        out.push_str(&region.as_ref());
847                                        out.push_str(".");
848                                        #[allow(clippy::needless_borrow)]
849                                        out.push_str(&partition_result.dns_suffix());
850                                        out
851                                    })
852                                    .build(),
853                            )
854                        }
855                        7 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
856                            "FIPS is enabled but this partition does not support FIPS".to_string(),
857                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
858                        8 => {
859                            let region = params.region.as_deref().unwrap_or_default();
860                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
861                            ::std::result::Result::Ok(
862                                ::aws_smithy_types::endpoint::Endpoint::builder()
863                                    .url({
864                                        let mut out = String::new();
865                                        out.push_str("https://appstream2.");
866                                        #[allow(clippy::needless_borrow)]
867                                        out.push_str(&region.as_ref());
868                                        out.push_str(".");
869                                        #[allow(clippy::needless_borrow)]
870                                        out.push_str(&partition_result.dual_stack_dns_suffix());
871                                        out
872                                    })
873                                    .build(),
874                            )
875                        }
876                        9 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
877                            "DualStack is enabled but this partition does not support DualStack".to_string(),
878                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
879                        10 => {
880                            let region = params.region.as_deref().unwrap_or_default();
881                            ::std::result::Result::Ok(
882                                ::aws_smithy_types::endpoint::Endpoint::builder()
883                                    .url({
884                                        let mut out = String::new();
885                                        out.push_str("https://appstream2.");
886                                        #[allow(clippy::needless_borrow)]
887                                        out.push_str(&region.as_ref());
888                                        out.push_str(".amazonaws.com");
889                                        out
890                                    })
891                                    .build(),
892                            )
893                        }
894                        11 => {
895                            let region = params.region.as_deref().unwrap_or_default();
896                            let partition_result = context.partition_result.as_ref().expect("Guaranteed to have a value by earlier checks.");
897                            ::std::result::Result::Ok(
898                                ::aws_smithy_types::endpoint::Endpoint::builder()
899                                    .url({
900                                        let mut out = String::new();
901                                        out.push_str("https://appstream2.");
902                                        #[allow(clippy::needless_borrow)]
903                                        out.push_str(&region.as_ref());
904                                        out.push_str(".");
905                                        #[allow(clippy::needless_borrow)]
906                                        out.push_str(&partition_result.dns_suffix());
907                                        out
908                                    })
909                                    .build(),
910                            )
911                        }
912                        12 => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
913                            "Invalid Configuration: Missing Region".to_string(),
914                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
915                        _ => ::std::result::Result::Err(Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message(
916                            "No endpoint rule matched",
917                        )) as ::aws_smithy_runtime_api::box_error::BoxError),
918                    };
919                }
920                1 | -1 => {
921                    return ::std::result::Result::Err(
922                        Box::new(::aws_smithy_http::endpoint::ResolveEndpointError::message("No endpoint rule matched"))
923                            as ::aws_smithy_runtime_api::box_error::BoxError,
924                    )
925                }
926                ref_val => {
927                    let is_complement = ref_val < 0;
928                    let node = &NODES[(ref_val.unsigned_abs() as usize) - 1];
929                    let condition_result = match node.condition_index {
930                        0 => endpoint.is_some(),
931                        1 => region.is_some(),
932                        2 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
933                            let partition_result = &mut context.partition_result;
934                            let partition_resolver = &self.partition_resolver;
935                            {
936                                *partition_result = partition_resolver
937                                    .resolve_partition(if let Some(param) = region { param } else { return false }, _diagnostic_collector)
938                                    .map(|inner| inner.into());
939                                partition_result.is_some()
940                            }
941                        })(&mut _diagnostic_collector),
942                        3 => (use_fips) == (&true),
943                        4 => (use_dual_stack) == (&true),
944                        5 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
945                            let partition_result = &context.partition_result;
946                            let partition_resolver = &self.partition_resolver;
947                            (if let Some(inner) = partition_result {
948                                inner.supports_dual_stack()
949                            } else {
950                                return false;
951                            }) == (true)
952                        })(&mut _diagnostic_collector),
953                        6 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
954                            let partition_result = &context.partition_result;
955                            let partition_resolver = &self.partition_resolver;
956                            (if let Some(inner) = partition_result {
957                                inner.supports_fips()
958                            } else {
959                                return false;
960                            }) == (true)
961                        })(&mut _diagnostic_collector),
962                        7 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
963                            let partition_result = &context.partition_result;
964                            let partition_resolver = &self.partition_resolver;
965                            (if let Some(inner) = partition_result {
966                                inner.name()
967                            } else {
968                                return false;
969                            }) == ("aws-us-gov")
970                        })(&mut _diagnostic_collector),
971                        8 => (|_diagnostic_collector: &mut crate::endpoint_lib::diagnostic::DiagnosticCollector| -> bool {
972                            let partition_result = &context.partition_result;
973                            let partition_resolver = &self.partition_resolver;
974                            (if let Some(inner) = partition_result {
975                                inner.name()
976                            } else {
977                                return false;
978                            }) == ("aws")
979                        })(&mut _diagnostic_collector),
980                        _ => unreachable!("Invalid condition index"),
981                    };
982                    current_ref = if is_complement ^ condition_result { node.high_ref } else { node.low_ref };
983                }
984            }
985        }
986    }
987}
988
989impl crate::config::endpoint::ResolveEndpoint for DefaultResolver {
990    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
991        // Check single-entry cache (lock-free read via ArcSwap)
992        let cached = self.endpoint_cache.load();
993        if let Some((cached_params, cached_endpoint)) = cached.as_ref() {
994            if cached_params == params {
995                return ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(::std::result::Result::Ok(cached_endpoint.clone()));
996            }
997        }
998        drop(cached);
999        let result = self.resolve_endpoint(params);
1000        if let ::std::result::Result::Ok(ref endpoint) = result {
1001            self.endpoint_cache.store(::std::sync::Arc::new(Some((params.clone(), endpoint.clone()))));
1002        }
1003        ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(result)
1004    }
1005}
1006const NODES: [crate::endpoint_lib::bdd_interpreter::BddNode; 15] = [
1007    crate::endpoint_lib::bdd_interpreter::BddNode {
1008        condition_index: -1,
1009        high_ref: 1,
1010        low_ref: -1,
1011    },
1012    crate::endpoint_lib::bdd_interpreter::BddNode {
1013        condition_index: 0,
1014        high_ref: 14,
1015        low_ref: 3,
1016    },
1017    crate::endpoint_lib::bdd_interpreter::BddNode {
1018        condition_index: 1,
1019        high_ref: 4,
1020        low_ref: 100000012,
1021    },
1022    crate::endpoint_lib::bdd_interpreter::BddNode {
1023        condition_index: 2,
1024        high_ref: 5,
1025        low_ref: 100000012,
1026    },
1027    crate::endpoint_lib::bdd_interpreter::BddNode {
1028        condition_index: 3,
1029        high_ref: 10,
1030        low_ref: 6,
1031    },
1032    crate::endpoint_lib::bdd_interpreter::BddNode {
1033        condition_index: 4,
1034        high_ref: 9,
1035        low_ref: 7,
1036    },
1037    crate::endpoint_lib::bdd_interpreter::BddNode {
1038        condition_index: 7,
1039        high_ref: 100000010,
1040        low_ref: 8,
1041    },
1042    crate::endpoint_lib::bdd_interpreter::BddNode {
1043        condition_index: 8,
1044        high_ref: 100000010,
1045        low_ref: 100000011,
1046    },
1047    crate::endpoint_lib::bdd_interpreter::BddNode {
1048        condition_index: 5,
1049        high_ref: 100000008,
1050        low_ref: 100000009,
1051    },
1052    crate::endpoint_lib::bdd_interpreter::BddNode {
1053        condition_index: 4,
1054        high_ref: 12,
1055        low_ref: 11,
1056    },
1057    crate::endpoint_lib::bdd_interpreter::BddNode {
1058        condition_index: 6,
1059        high_ref: 100000006,
1060        low_ref: 100000007,
1061    },
1062    crate::endpoint_lib::bdd_interpreter::BddNode {
1063        condition_index: 5,
1064        high_ref: 13,
1065        low_ref: 100000005,
1066    },
1067    crate::endpoint_lib::bdd_interpreter::BddNode {
1068        condition_index: 6,
1069        high_ref: 100000004,
1070        low_ref: 100000005,
1071    },
1072    crate::endpoint_lib::bdd_interpreter::BddNode {
1073        condition_index: 3,
1074        high_ref: 100000001,
1075        low_ref: 15,
1076    },
1077    crate::endpoint_lib::bdd_interpreter::BddNode {
1078        condition_index: 4,
1079        high_ref: 100000002,
1080        low_ref: 100000003,
1081    },
1082];
1083// These are all optional since they are set by conditions and will
1084// all be unset when we start evaluation
1085#[derive(Default)]
1086#[allow(unused_lifetimes)]
1087pub(crate) struct ConditionContext<'a> {
1088    pub(crate) partition_result: Option<crate::endpoint_lib::partition::Partition<'a>>,
1089    // Sometimes none of the members reference the lifetime, this makes it still valid
1090    phantom: std::marker::PhantomData<&'a ()>,
1091}
1092
1093#[non_exhaustive]
1094#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
1095/// Configuration parameters for resolving the correct endpoint
1096pub struct Params {
1097    /// The AWS region used to dispatch the request.
1098    pub(crate) region: ::std::option::Option<::std::string::String>,
1099    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1100    pub(crate) use_dual_stack: bool,
1101    /// 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.
1102    pub(crate) use_fips: bool,
1103    /// Override the endpoint used to send this request
1104    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
1105}
1106impl Params {
1107    /// Create a builder for [`Params`]
1108    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
1109        crate::config::endpoint::ParamsBuilder::default()
1110    }
1111    /// The AWS region used to dispatch the request.
1112    pub fn region(&self) -> ::std::option::Option<&str> {
1113        self.region.as_deref()
1114    }
1115    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1116    pub fn use_dual_stack(&self) -> ::std::option::Option<bool> {
1117        Some(self.use_dual_stack)
1118    }
1119    /// 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.
1120    pub fn use_fips(&self) -> ::std::option::Option<bool> {
1121        Some(self.use_fips)
1122    }
1123    /// Override the endpoint used to send this request
1124    pub fn endpoint(&self) -> ::std::option::Option<&str> {
1125        self.endpoint.as_deref()
1126    }
1127}
1128
1129/// Builder for [`Params`]
1130#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
1131pub struct ParamsBuilder {
1132    region: ::std::option::Option<::std::string::String>,
1133    use_dual_stack: ::std::option::Option<bool>,
1134    use_fips: ::std::option::Option<bool>,
1135    endpoint: ::std::option::Option<::std::string::String>,
1136}
1137impl ParamsBuilder {
1138    /// Consume this builder, creating [`Params`].
1139    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
1140        if let Some(region) = &self.region {
1141            if !crate::endpoint_lib::host::is_valid_host_label(
1142                region.as_ref() as &str,
1143                true,
1144                &mut crate::endpoint_lib::diagnostic::DiagnosticCollector::new(),
1145            ) {
1146                return Err(crate::config::endpoint::InvalidParams::invalid_value(
1147                    "region",
1148                    "must be a valid host label",
1149                ));
1150            }
1151        };
1152        Ok(
1153            #[allow(clippy::unnecessary_lazy_evaluations)]
1154            crate::config::endpoint::Params {
1155                region: self.region,
1156                use_dual_stack: self
1157                    .use_dual_stack
1158                    .or_else(|| Some(false))
1159                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_dual_stack"))?,
1160                use_fips: self
1161                    .use_fips
1162                    .or_else(|| Some(false))
1163                    .ok_or_else(|| crate::config::endpoint::InvalidParams::missing("use_fips"))?,
1164                endpoint: self.endpoint,
1165            },
1166        )
1167    }
1168    /// Sets the value for region
1169    ///
1170    /// The AWS region used to dispatch the request.
1171    pub fn region(mut self, value: impl Into<::std::string::String>) -> Self {
1172        self.region = Some(value.into());
1173        self
1174    }
1175
1176    /// Sets the value for region
1177    ///
1178    /// The AWS region used to dispatch the request.
1179    pub fn set_region(mut self, param: Option<::std::string::String>) -> Self {
1180        self.region = param;
1181        self
1182    }
1183    /// Sets the value for use_dual_stack
1184    ///
1185    /// When unset, this parameter has a default value of `false`.
1186    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1187    pub fn use_dual_stack(mut self, value: impl Into<bool>) -> Self {
1188        self.use_dual_stack = Some(value.into());
1189        self
1190    }
1191
1192    /// Sets the value for use_dual_stack
1193    ///
1194    /// When unset, this parameter has a default value of `false`.
1195    /// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
1196    pub fn set_use_dual_stack(mut self, param: Option<bool>) -> Self {
1197        self.use_dual_stack = param;
1198        self
1199    }
1200    /// Sets the value for use_fips
1201    ///
1202    /// When unset, this parameter has a default value of `false`.
1203    /// 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.
1204    pub fn use_fips(mut self, value: impl Into<bool>) -> Self {
1205        self.use_fips = Some(value.into());
1206        self
1207    }
1208
1209    /// Sets the value for use_fips
1210    ///
1211    /// When unset, this parameter has a default value of `false`.
1212    /// 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.
1213    pub fn set_use_fips(mut self, param: Option<bool>) -> Self {
1214        self.use_fips = param;
1215        self
1216    }
1217    /// Sets the value for endpoint
1218    ///
1219    /// Override the endpoint used to send this request
1220    pub fn endpoint(mut self, value: impl Into<::std::string::String>) -> Self {
1221        self.endpoint = Some(value.into());
1222        self
1223    }
1224
1225    /// Sets the value for endpoint
1226    ///
1227    /// Override the endpoint used to send this request
1228    pub fn set_endpoint(mut self, param: Option<::std::string::String>) -> Self {
1229        self.endpoint = param;
1230        self
1231    }
1232}
1233
1234/// An error that occurred during endpoint resolution
1235#[derive(Debug)]
1236pub struct InvalidParams {
1237    field: std::borrow::Cow<'static, str>,
1238    kind: InvalidParamsErrorKind,
1239}
1240
1241/// The kind of invalid parameter error
1242#[derive(Debug)]
1243enum InvalidParamsErrorKind {
1244    MissingField,
1245    InvalidValue { message: &'static str },
1246}
1247
1248impl InvalidParams {
1249    #[allow(dead_code)]
1250    fn missing(field: &'static str) -> Self {
1251        Self {
1252            field: field.into(),
1253            kind: InvalidParamsErrorKind::MissingField,
1254        }
1255    }
1256
1257    #[allow(dead_code)]
1258    fn invalid_value(field: &'static str, message: &'static str) -> Self {
1259        Self {
1260            field: field.into(),
1261            kind: InvalidParamsErrorKind::InvalidValue { message },
1262        }
1263    }
1264}
1265
1266impl std::fmt::Display for InvalidParams {
1267    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1268        match self.kind {
1269            InvalidParamsErrorKind::MissingField => write!(f, "a required field was missing: `{}`", self.field),
1270            InvalidParamsErrorKind::InvalidValue { message } => write!(f, "invalid value for field: `{}` - {}", self.field, message),
1271        }
1272    }
1273}
1274
1275impl std::error::Error for InvalidParams {}