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