Skip to main content

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