1
2
3 package sso
4
5 import (
6 "context"
7 smithy "github.com/aws/smithy-go"
8 smithyendpoints "github.com/aws/smithy-go/endpoints"
9 "github.com/aws/smithy-go/ptr"
10 "net/http"
11 "net/url"
12 "reflect"
13 "strings"
14 "testing"
15 )
16
17
18 func TestEndpointCase0(t *testing.T) {
19 var params = EndpointParameters{
20 Region: ptr.String("ap-east-1"),
21 UseFIPS: ptr.Bool(false),
22 UseDualStack: ptr.Bool(false),
23 }
24
25 resolver := NewDefaultEndpointResolverV2()
26 result, err := resolver.ResolveEndpoint(context.Background(), params)
27 _, _ = result, err
28
29 if err != nil {
30 t.Fatalf("expect no error, got %v", err)
31 }
32
33 uri, _ := url.Parse("https://portal.sso.ap-east-1.amazonaws.com")
34
35 expectEndpoint := smithyendpoints.Endpoint{
36 URI: *uri,
37 Headers: http.Header{},
38 Properties: smithy.Properties{},
39 }
40
41 if e, a := expectEndpoint.URI, result.URI; e != a {
42 t.Errorf("expect %v URI, got %v", e, a)
43 }
44
45 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
46 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
47 }
48
49 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
50 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
51 }
52 }
53
54
55 func TestEndpointCase1(t *testing.T) {
56 var params = EndpointParameters{
57 Region: ptr.String("ap-northeast-1"),
58 UseFIPS: ptr.Bool(false),
59 UseDualStack: ptr.Bool(false),
60 }
61
62 resolver := NewDefaultEndpointResolverV2()
63 result, err := resolver.ResolveEndpoint(context.Background(), params)
64 _, _ = result, err
65
66 if err != nil {
67 t.Fatalf("expect no error, got %v", err)
68 }
69
70 uri, _ := url.Parse("https://portal.sso.ap-northeast-1.amazonaws.com")
71
72 expectEndpoint := smithyendpoints.Endpoint{
73 URI: *uri,
74 Headers: http.Header{},
75 Properties: smithy.Properties{},
76 }
77
78 if e, a := expectEndpoint.URI, result.URI; e != a {
79 t.Errorf("expect %v URI, got %v", e, a)
80 }
81
82 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
83 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
84 }
85
86 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
87 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
88 }
89 }
90
91
92 func TestEndpointCase2(t *testing.T) {
93 var params = EndpointParameters{
94 Region: ptr.String("ap-northeast-2"),
95 UseFIPS: ptr.Bool(false),
96 UseDualStack: ptr.Bool(false),
97 }
98
99 resolver := NewDefaultEndpointResolverV2()
100 result, err := resolver.ResolveEndpoint(context.Background(), params)
101 _, _ = result, err
102
103 if err != nil {
104 t.Fatalf("expect no error, got %v", err)
105 }
106
107 uri, _ := url.Parse("https://portal.sso.ap-northeast-2.amazonaws.com")
108
109 expectEndpoint := smithyendpoints.Endpoint{
110 URI: *uri,
111 Headers: http.Header{},
112 Properties: smithy.Properties{},
113 }
114
115 if e, a := expectEndpoint.URI, result.URI; e != a {
116 t.Errorf("expect %v URI, got %v", e, a)
117 }
118
119 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
120 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
121 }
122
123 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
124 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
125 }
126 }
127
128
129 func TestEndpointCase3(t *testing.T) {
130 var params = EndpointParameters{
131 Region: ptr.String("ap-northeast-3"),
132 UseFIPS: ptr.Bool(false),
133 UseDualStack: ptr.Bool(false),
134 }
135
136 resolver := NewDefaultEndpointResolverV2()
137 result, err := resolver.ResolveEndpoint(context.Background(), params)
138 _, _ = result, err
139
140 if err != nil {
141 t.Fatalf("expect no error, got %v", err)
142 }
143
144 uri, _ := url.Parse("https://portal.sso.ap-northeast-3.amazonaws.com")
145
146 expectEndpoint := smithyendpoints.Endpoint{
147 URI: *uri,
148 Headers: http.Header{},
149 Properties: smithy.Properties{},
150 }
151
152 if e, a := expectEndpoint.URI, result.URI; e != a {
153 t.Errorf("expect %v URI, got %v", e, a)
154 }
155
156 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
157 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
158 }
159
160 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
161 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
162 }
163 }
164
165
166 func TestEndpointCase4(t *testing.T) {
167 var params = EndpointParameters{
168 Region: ptr.String("ap-south-1"),
169 UseFIPS: ptr.Bool(false),
170 UseDualStack: ptr.Bool(false),
171 }
172
173 resolver := NewDefaultEndpointResolverV2()
174 result, err := resolver.ResolveEndpoint(context.Background(), params)
175 _, _ = result, err
176
177 if err != nil {
178 t.Fatalf("expect no error, got %v", err)
179 }
180
181 uri, _ := url.Parse("https://portal.sso.ap-south-1.amazonaws.com")
182
183 expectEndpoint := smithyendpoints.Endpoint{
184 URI: *uri,
185 Headers: http.Header{},
186 Properties: smithy.Properties{},
187 }
188
189 if e, a := expectEndpoint.URI, result.URI; e != a {
190 t.Errorf("expect %v URI, got %v", e, a)
191 }
192
193 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
194 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
195 }
196
197 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
198 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
199 }
200 }
201
202
203 func TestEndpointCase5(t *testing.T) {
204 var params = EndpointParameters{
205 Region: ptr.String("ap-southeast-1"),
206 UseFIPS: ptr.Bool(false),
207 UseDualStack: ptr.Bool(false),
208 }
209
210 resolver := NewDefaultEndpointResolverV2()
211 result, err := resolver.ResolveEndpoint(context.Background(), params)
212 _, _ = result, err
213
214 if err != nil {
215 t.Fatalf("expect no error, got %v", err)
216 }
217
218 uri, _ := url.Parse("https://portal.sso.ap-southeast-1.amazonaws.com")
219
220 expectEndpoint := smithyendpoints.Endpoint{
221 URI: *uri,
222 Headers: http.Header{},
223 Properties: smithy.Properties{},
224 }
225
226 if e, a := expectEndpoint.URI, result.URI; e != a {
227 t.Errorf("expect %v URI, got %v", e, a)
228 }
229
230 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
231 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
232 }
233
234 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
235 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
236 }
237 }
238
239
240 func TestEndpointCase6(t *testing.T) {
241 var params = EndpointParameters{
242 Region: ptr.String("ap-southeast-2"),
243 UseFIPS: ptr.Bool(false),
244 UseDualStack: ptr.Bool(false),
245 }
246
247 resolver := NewDefaultEndpointResolverV2()
248 result, err := resolver.ResolveEndpoint(context.Background(), params)
249 _, _ = result, err
250
251 if err != nil {
252 t.Fatalf("expect no error, got %v", err)
253 }
254
255 uri, _ := url.Parse("https://portal.sso.ap-southeast-2.amazonaws.com")
256
257 expectEndpoint := smithyendpoints.Endpoint{
258 URI: *uri,
259 Headers: http.Header{},
260 Properties: smithy.Properties{},
261 }
262
263 if e, a := expectEndpoint.URI, result.URI; e != a {
264 t.Errorf("expect %v URI, got %v", e, a)
265 }
266
267 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
268 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
269 }
270
271 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
272 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
273 }
274 }
275
276
277 func TestEndpointCase7(t *testing.T) {
278 var params = EndpointParameters{
279 Region: ptr.String("ca-central-1"),
280 UseFIPS: ptr.Bool(false),
281 UseDualStack: ptr.Bool(false),
282 }
283
284 resolver := NewDefaultEndpointResolverV2()
285 result, err := resolver.ResolveEndpoint(context.Background(), params)
286 _, _ = result, err
287
288 if err != nil {
289 t.Fatalf("expect no error, got %v", err)
290 }
291
292 uri, _ := url.Parse("https://portal.sso.ca-central-1.amazonaws.com")
293
294 expectEndpoint := smithyendpoints.Endpoint{
295 URI: *uri,
296 Headers: http.Header{},
297 Properties: smithy.Properties{},
298 }
299
300 if e, a := expectEndpoint.URI, result.URI; e != a {
301 t.Errorf("expect %v URI, got %v", e, a)
302 }
303
304 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
305 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
306 }
307
308 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
309 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
310 }
311 }
312
313
314 func TestEndpointCase8(t *testing.T) {
315 var params = EndpointParameters{
316 Region: ptr.String("eu-central-1"),
317 UseFIPS: ptr.Bool(false),
318 UseDualStack: ptr.Bool(false),
319 }
320
321 resolver := NewDefaultEndpointResolverV2()
322 result, err := resolver.ResolveEndpoint(context.Background(), params)
323 _, _ = result, err
324
325 if err != nil {
326 t.Fatalf("expect no error, got %v", err)
327 }
328
329 uri, _ := url.Parse("https://portal.sso.eu-central-1.amazonaws.com")
330
331 expectEndpoint := smithyendpoints.Endpoint{
332 URI: *uri,
333 Headers: http.Header{},
334 Properties: smithy.Properties{},
335 }
336
337 if e, a := expectEndpoint.URI, result.URI; e != a {
338 t.Errorf("expect %v URI, got %v", e, a)
339 }
340
341 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
342 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
343 }
344
345 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
346 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
347 }
348 }
349
350
351 func TestEndpointCase9(t *testing.T) {
352 var params = EndpointParameters{
353 Region: ptr.String("eu-north-1"),
354 UseFIPS: ptr.Bool(false),
355 UseDualStack: ptr.Bool(false),
356 }
357
358 resolver := NewDefaultEndpointResolverV2()
359 result, err := resolver.ResolveEndpoint(context.Background(), params)
360 _, _ = result, err
361
362 if err != nil {
363 t.Fatalf("expect no error, got %v", err)
364 }
365
366 uri, _ := url.Parse("https://portal.sso.eu-north-1.amazonaws.com")
367
368 expectEndpoint := smithyendpoints.Endpoint{
369 URI: *uri,
370 Headers: http.Header{},
371 Properties: smithy.Properties{},
372 }
373
374 if e, a := expectEndpoint.URI, result.URI; e != a {
375 t.Errorf("expect %v URI, got %v", e, a)
376 }
377
378 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
379 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
380 }
381
382 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
383 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
384 }
385 }
386
387
388 func TestEndpointCase10(t *testing.T) {
389 var params = EndpointParameters{
390 Region: ptr.String("eu-south-1"),
391 UseFIPS: ptr.Bool(false),
392 UseDualStack: ptr.Bool(false),
393 }
394
395 resolver := NewDefaultEndpointResolverV2()
396 result, err := resolver.ResolveEndpoint(context.Background(), params)
397 _, _ = result, err
398
399 if err != nil {
400 t.Fatalf("expect no error, got %v", err)
401 }
402
403 uri, _ := url.Parse("https://portal.sso.eu-south-1.amazonaws.com")
404
405 expectEndpoint := smithyendpoints.Endpoint{
406 URI: *uri,
407 Headers: http.Header{},
408 Properties: smithy.Properties{},
409 }
410
411 if e, a := expectEndpoint.URI, result.URI; e != a {
412 t.Errorf("expect %v URI, got %v", e, a)
413 }
414
415 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
416 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
417 }
418
419 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
420 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
421 }
422 }
423
424
425 func TestEndpointCase11(t *testing.T) {
426 var params = EndpointParameters{
427 Region: ptr.String("eu-west-1"),
428 UseFIPS: ptr.Bool(false),
429 UseDualStack: ptr.Bool(false),
430 }
431
432 resolver := NewDefaultEndpointResolverV2()
433 result, err := resolver.ResolveEndpoint(context.Background(), params)
434 _, _ = result, err
435
436 if err != nil {
437 t.Fatalf("expect no error, got %v", err)
438 }
439
440 uri, _ := url.Parse("https://portal.sso.eu-west-1.amazonaws.com")
441
442 expectEndpoint := smithyendpoints.Endpoint{
443 URI: *uri,
444 Headers: http.Header{},
445 Properties: smithy.Properties{},
446 }
447
448 if e, a := expectEndpoint.URI, result.URI; e != a {
449 t.Errorf("expect %v URI, got %v", e, a)
450 }
451
452 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
453 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
454 }
455
456 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
457 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
458 }
459 }
460
461
462 func TestEndpointCase12(t *testing.T) {
463 var params = EndpointParameters{
464 Region: ptr.String("eu-west-2"),
465 UseFIPS: ptr.Bool(false),
466 UseDualStack: ptr.Bool(false),
467 }
468
469 resolver := NewDefaultEndpointResolverV2()
470 result, err := resolver.ResolveEndpoint(context.Background(), params)
471 _, _ = result, err
472
473 if err != nil {
474 t.Fatalf("expect no error, got %v", err)
475 }
476
477 uri, _ := url.Parse("https://portal.sso.eu-west-2.amazonaws.com")
478
479 expectEndpoint := smithyendpoints.Endpoint{
480 URI: *uri,
481 Headers: http.Header{},
482 Properties: smithy.Properties{},
483 }
484
485 if e, a := expectEndpoint.URI, result.URI; e != a {
486 t.Errorf("expect %v URI, got %v", e, a)
487 }
488
489 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
490 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
491 }
492
493 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
494 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
495 }
496 }
497
498
499 func TestEndpointCase13(t *testing.T) {
500 var params = EndpointParameters{
501 Region: ptr.String("eu-west-3"),
502 UseFIPS: ptr.Bool(false),
503 UseDualStack: ptr.Bool(false),
504 }
505
506 resolver := NewDefaultEndpointResolverV2()
507 result, err := resolver.ResolveEndpoint(context.Background(), params)
508 _, _ = result, err
509
510 if err != nil {
511 t.Fatalf("expect no error, got %v", err)
512 }
513
514 uri, _ := url.Parse("https://portal.sso.eu-west-3.amazonaws.com")
515
516 expectEndpoint := smithyendpoints.Endpoint{
517 URI: *uri,
518 Headers: http.Header{},
519 Properties: smithy.Properties{},
520 }
521
522 if e, a := expectEndpoint.URI, result.URI; e != a {
523 t.Errorf("expect %v URI, got %v", e, a)
524 }
525
526 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
527 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
528 }
529
530 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
531 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
532 }
533 }
534
535
536 func TestEndpointCase14(t *testing.T) {
537 var params = EndpointParameters{
538 Region: ptr.String("me-south-1"),
539 UseFIPS: ptr.Bool(false),
540 UseDualStack: ptr.Bool(false),
541 }
542
543 resolver := NewDefaultEndpointResolverV2()
544 result, err := resolver.ResolveEndpoint(context.Background(), params)
545 _, _ = result, err
546
547 if err != nil {
548 t.Fatalf("expect no error, got %v", err)
549 }
550
551 uri, _ := url.Parse("https://portal.sso.me-south-1.amazonaws.com")
552
553 expectEndpoint := smithyendpoints.Endpoint{
554 URI: *uri,
555 Headers: http.Header{},
556 Properties: smithy.Properties{},
557 }
558
559 if e, a := expectEndpoint.URI, result.URI; e != a {
560 t.Errorf("expect %v URI, got %v", e, a)
561 }
562
563 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
564 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
565 }
566
567 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
568 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
569 }
570 }
571
572
573 func TestEndpointCase15(t *testing.T) {
574 var params = EndpointParameters{
575 Region: ptr.String("sa-east-1"),
576 UseFIPS: ptr.Bool(false),
577 UseDualStack: ptr.Bool(false),
578 }
579
580 resolver := NewDefaultEndpointResolverV2()
581 result, err := resolver.ResolveEndpoint(context.Background(), params)
582 _, _ = result, err
583
584 if err != nil {
585 t.Fatalf("expect no error, got %v", err)
586 }
587
588 uri, _ := url.Parse("https://portal.sso.sa-east-1.amazonaws.com")
589
590 expectEndpoint := smithyendpoints.Endpoint{
591 URI: *uri,
592 Headers: http.Header{},
593 Properties: smithy.Properties{},
594 }
595
596 if e, a := expectEndpoint.URI, result.URI; e != a {
597 t.Errorf("expect %v URI, got %v", e, a)
598 }
599
600 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
601 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
602 }
603
604 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
605 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
606 }
607 }
608
609
610 func TestEndpointCase16(t *testing.T) {
611 var params = EndpointParameters{
612 Region: ptr.String("us-east-1"),
613 UseFIPS: ptr.Bool(false),
614 UseDualStack: ptr.Bool(false),
615 }
616
617 resolver := NewDefaultEndpointResolverV2()
618 result, err := resolver.ResolveEndpoint(context.Background(), params)
619 _, _ = result, err
620
621 if err != nil {
622 t.Fatalf("expect no error, got %v", err)
623 }
624
625 uri, _ := url.Parse("https://portal.sso.us-east-1.amazonaws.com")
626
627 expectEndpoint := smithyendpoints.Endpoint{
628 URI: *uri,
629 Headers: http.Header{},
630 Properties: smithy.Properties{},
631 }
632
633 if e, a := expectEndpoint.URI, result.URI; e != a {
634 t.Errorf("expect %v URI, got %v", e, a)
635 }
636
637 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
638 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
639 }
640
641 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
642 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
643 }
644 }
645
646
647 func TestEndpointCase17(t *testing.T) {
648 var params = EndpointParameters{
649 Region: ptr.String("us-east-2"),
650 UseFIPS: ptr.Bool(false),
651 UseDualStack: ptr.Bool(false),
652 }
653
654 resolver := NewDefaultEndpointResolverV2()
655 result, err := resolver.ResolveEndpoint(context.Background(), params)
656 _, _ = result, err
657
658 if err != nil {
659 t.Fatalf("expect no error, got %v", err)
660 }
661
662 uri, _ := url.Parse("https://portal.sso.us-east-2.amazonaws.com")
663
664 expectEndpoint := smithyendpoints.Endpoint{
665 URI: *uri,
666 Headers: http.Header{},
667 Properties: smithy.Properties{},
668 }
669
670 if e, a := expectEndpoint.URI, result.URI; e != a {
671 t.Errorf("expect %v URI, got %v", e, a)
672 }
673
674 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
675 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
676 }
677
678 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
679 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
680 }
681 }
682
683
684 func TestEndpointCase18(t *testing.T) {
685 var params = EndpointParameters{
686 Region: ptr.String("us-west-2"),
687 UseFIPS: ptr.Bool(false),
688 UseDualStack: ptr.Bool(false),
689 }
690
691 resolver := NewDefaultEndpointResolverV2()
692 result, err := resolver.ResolveEndpoint(context.Background(), params)
693 _, _ = result, err
694
695 if err != nil {
696 t.Fatalf("expect no error, got %v", err)
697 }
698
699 uri, _ := url.Parse("https://portal.sso.us-west-2.amazonaws.com")
700
701 expectEndpoint := smithyendpoints.Endpoint{
702 URI: *uri,
703 Headers: http.Header{},
704 Properties: smithy.Properties{},
705 }
706
707 if e, a := expectEndpoint.URI, result.URI; e != a {
708 t.Errorf("expect %v URI, got %v", e, a)
709 }
710
711 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
712 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
713 }
714
715 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
716 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
717 }
718 }
719
720
721 func TestEndpointCase19(t *testing.T) {
722 var params = EndpointParameters{
723 Region: ptr.String("us-east-1"),
724 UseFIPS: ptr.Bool(true),
725 UseDualStack: ptr.Bool(true),
726 }
727
728 resolver := NewDefaultEndpointResolverV2()
729 result, err := resolver.ResolveEndpoint(context.Background(), params)
730 _, _ = result, err
731
732 if err != nil {
733 t.Fatalf("expect no error, got %v", err)
734 }
735
736 uri, _ := url.Parse("https://portal.sso-fips.us-east-1.api.aws")
737
738 expectEndpoint := smithyendpoints.Endpoint{
739 URI: *uri,
740 Headers: http.Header{},
741 Properties: smithy.Properties{},
742 }
743
744 if e, a := expectEndpoint.URI, result.URI; e != a {
745 t.Errorf("expect %v URI, got %v", e, a)
746 }
747
748 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
749 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
750 }
751
752 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
753 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
754 }
755 }
756
757
758 func TestEndpointCase20(t *testing.T) {
759 var params = EndpointParameters{
760 Region: ptr.String("us-east-1"),
761 UseFIPS: ptr.Bool(true),
762 UseDualStack: ptr.Bool(false),
763 }
764
765 resolver := NewDefaultEndpointResolverV2()
766 result, err := resolver.ResolveEndpoint(context.Background(), params)
767 _, _ = result, err
768
769 if err != nil {
770 t.Fatalf("expect no error, got %v", err)
771 }
772
773 uri, _ := url.Parse("https://portal.sso-fips.us-east-1.amazonaws.com")
774
775 expectEndpoint := smithyendpoints.Endpoint{
776 URI: *uri,
777 Headers: http.Header{},
778 Properties: smithy.Properties{},
779 }
780
781 if e, a := expectEndpoint.URI, result.URI; e != a {
782 t.Errorf("expect %v URI, got %v", e, a)
783 }
784
785 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
786 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
787 }
788
789 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
790 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
791 }
792 }
793
794
795 func TestEndpointCase21(t *testing.T) {
796 var params = EndpointParameters{
797 Region: ptr.String("us-east-1"),
798 UseFIPS: ptr.Bool(false),
799 UseDualStack: ptr.Bool(true),
800 }
801
802 resolver := NewDefaultEndpointResolverV2()
803 result, err := resolver.ResolveEndpoint(context.Background(), params)
804 _, _ = result, err
805
806 if err != nil {
807 t.Fatalf("expect no error, got %v", err)
808 }
809
810 uri, _ := url.Parse("https://portal.sso.us-east-1.api.aws")
811
812 expectEndpoint := smithyendpoints.Endpoint{
813 URI: *uri,
814 Headers: http.Header{},
815 Properties: smithy.Properties{},
816 }
817
818 if e, a := expectEndpoint.URI, result.URI; e != a {
819 t.Errorf("expect %v URI, got %v", e, a)
820 }
821
822 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
823 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
824 }
825
826 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
827 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
828 }
829 }
830
831
832 func TestEndpointCase22(t *testing.T) {
833 var params = EndpointParameters{
834 Region: ptr.String("cn-north-1"),
835 UseFIPS: ptr.Bool(true),
836 UseDualStack: ptr.Bool(true),
837 }
838
839 resolver := NewDefaultEndpointResolverV2()
840 result, err := resolver.ResolveEndpoint(context.Background(), params)
841 _, _ = result, err
842
843 if err != nil {
844 t.Fatalf("expect no error, got %v", err)
845 }
846
847 uri, _ := url.Parse("https://portal.sso-fips.cn-north-1.api.amazonwebservices.com.cn")
848
849 expectEndpoint := smithyendpoints.Endpoint{
850 URI: *uri,
851 Headers: http.Header{},
852 Properties: smithy.Properties{},
853 }
854
855 if e, a := expectEndpoint.URI, result.URI; e != a {
856 t.Errorf("expect %v URI, got %v", e, a)
857 }
858
859 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
860 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
861 }
862
863 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
864 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
865 }
866 }
867
868
869 func TestEndpointCase23(t *testing.T) {
870 var params = EndpointParameters{
871 Region: ptr.String("cn-north-1"),
872 UseFIPS: ptr.Bool(true),
873 UseDualStack: ptr.Bool(false),
874 }
875
876 resolver := NewDefaultEndpointResolverV2()
877 result, err := resolver.ResolveEndpoint(context.Background(), params)
878 _, _ = result, err
879
880 if err != nil {
881 t.Fatalf("expect no error, got %v", err)
882 }
883
884 uri, _ := url.Parse("https://portal.sso-fips.cn-north-1.amazonaws.com.cn")
885
886 expectEndpoint := smithyendpoints.Endpoint{
887 URI: *uri,
888 Headers: http.Header{},
889 Properties: smithy.Properties{},
890 }
891
892 if e, a := expectEndpoint.URI, result.URI; e != a {
893 t.Errorf("expect %v URI, got %v", e, a)
894 }
895
896 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
897 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
898 }
899
900 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
901 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
902 }
903 }
904
905
906 func TestEndpointCase24(t *testing.T) {
907 var params = EndpointParameters{
908 Region: ptr.String("cn-north-1"),
909 UseFIPS: ptr.Bool(false),
910 UseDualStack: ptr.Bool(true),
911 }
912
913 resolver := NewDefaultEndpointResolverV2()
914 result, err := resolver.ResolveEndpoint(context.Background(), params)
915 _, _ = result, err
916
917 if err != nil {
918 t.Fatalf("expect no error, got %v", err)
919 }
920
921 uri, _ := url.Parse("https://portal.sso.cn-north-1.api.amazonwebservices.com.cn")
922
923 expectEndpoint := smithyendpoints.Endpoint{
924 URI: *uri,
925 Headers: http.Header{},
926 Properties: smithy.Properties{},
927 }
928
929 if e, a := expectEndpoint.URI, result.URI; e != a {
930 t.Errorf("expect %v URI, got %v", e, a)
931 }
932
933 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
934 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
935 }
936
937 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
938 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
939 }
940 }
941
942
943 func TestEndpointCase25(t *testing.T) {
944 var params = EndpointParameters{
945 Region: ptr.String("cn-north-1"),
946 UseFIPS: ptr.Bool(false),
947 UseDualStack: ptr.Bool(false),
948 }
949
950 resolver := NewDefaultEndpointResolverV2()
951 result, err := resolver.ResolveEndpoint(context.Background(), params)
952 _, _ = result, err
953
954 if err != nil {
955 t.Fatalf("expect no error, got %v", err)
956 }
957
958 uri, _ := url.Parse("https://portal.sso.cn-north-1.amazonaws.com.cn")
959
960 expectEndpoint := smithyendpoints.Endpoint{
961 URI: *uri,
962 Headers: http.Header{},
963 Properties: smithy.Properties{},
964 }
965
966 if e, a := expectEndpoint.URI, result.URI; e != a {
967 t.Errorf("expect %v URI, got %v", e, a)
968 }
969
970 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
971 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
972 }
973
974 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
975 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
976 }
977 }
978
979
980 func TestEndpointCase26(t *testing.T) {
981 var params = EndpointParameters{
982 Region: ptr.String("us-gov-east-1"),
983 UseFIPS: ptr.Bool(false),
984 UseDualStack: ptr.Bool(false),
985 }
986
987 resolver := NewDefaultEndpointResolverV2()
988 result, err := resolver.ResolveEndpoint(context.Background(), params)
989 _, _ = result, err
990
991 if err != nil {
992 t.Fatalf("expect no error, got %v", err)
993 }
994
995 uri, _ := url.Parse("https://portal.sso.us-gov-east-1.amazonaws.com")
996
997 expectEndpoint := smithyendpoints.Endpoint{
998 URI: *uri,
999 Headers: http.Header{},
1000 Properties: smithy.Properties{},
1001 }
1002
1003 if e, a := expectEndpoint.URI, result.URI; e != a {
1004 t.Errorf("expect %v URI, got %v", e, a)
1005 }
1006
1007 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1008 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1009 }
1010
1011 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1012 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1013 }
1014 }
1015
1016
1017 func TestEndpointCase27(t *testing.T) {
1018 var params = EndpointParameters{
1019 Region: ptr.String("us-gov-west-1"),
1020 UseFIPS: ptr.Bool(false),
1021 UseDualStack: ptr.Bool(false),
1022 }
1023
1024 resolver := NewDefaultEndpointResolverV2()
1025 result, err := resolver.ResolveEndpoint(context.Background(), params)
1026 _, _ = result, err
1027
1028 if err != nil {
1029 t.Fatalf("expect no error, got %v", err)
1030 }
1031
1032 uri, _ := url.Parse("https://portal.sso.us-gov-west-1.amazonaws.com")
1033
1034 expectEndpoint := smithyendpoints.Endpoint{
1035 URI: *uri,
1036 Headers: http.Header{},
1037 Properties: smithy.Properties{},
1038 }
1039
1040 if e, a := expectEndpoint.URI, result.URI; e != a {
1041 t.Errorf("expect %v URI, got %v", e, a)
1042 }
1043
1044 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1045 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1046 }
1047
1048 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1049 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1050 }
1051 }
1052
1053
1054 func TestEndpointCase28(t *testing.T) {
1055 var params = EndpointParameters{
1056 Region: ptr.String("us-gov-east-1"),
1057 UseFIPS: ptr.Bool(true),
1058 UseDualStack: ptr.Bool(true),
1059 }
1060
1061 resolver := NewDefaultEndpointResolverV2()
1062 result, err := resolver.ResolveEndpoint(context.Background(), params)
1063 _, _ = result, err
1064
1065 if err != nil {
1066 t.Fatalf("expect no error, got %v", err)
1067 }
1068
1069 uri, _ := url.Parse("https://portal.sso-fips.us-gov-east-1.api.aws")
1070
1071 expectEndpoint := smithyendpoints.Endpoint{
1072 URI: *uri,
1073 Headers: http.Header{},
1074 Properties: smithy.Properties{},
1075 }
1076
1077 if e, a := expectEndpoint.URI, result.URI; e != a {
1078 t.Errorf("expect %v URI, got %v", e, a)
1079 }
1080
1081 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1082 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1083 }
1084
1085 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1086 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1087 }
1088 }
1089
1090
1091 func TestEndpointCase29(t *testing.T) {
1092 var params = EndpointParameters{
1093 Region: ptr.String("us-gov-east-1"),
1094 UseFIPS: ptr.Bool(true),
1095 UseDualStack: ptr.Bool(false),
1096 }
1097
1098 resolver := NewDefaultEndpointResolverV2()
1099 result, err := resolver.ResolveEndpoint(context.Background(), params)
1100 _, _ = result, err
1101
1102 if err != nil {
1103 t.Fatalf("expect no error, got %v", err)
1104 }
1105
1106 uri, _ := url.Parse("https://portal.sso.us-gov-east-1.amazonaws.com")
1107
1108 expectEndpoint := smithyendpoints.Endpoint{
1109 URI: *uri,
1110 Headers: http.Header{},
1111 Properties: smithy.Properties{},
1112 }
1113
1114 if e, a := expectEndpoint.URI, result.URI; e != a {
1115 t.Errorf("expect %v URI, got %v", e, a)
1116 }
1117
1118 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1119 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1120 }
1121
1122 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1123 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1124 }
1125 }
1126
1127
1128 func TestEndpointCase30(t *testing.T) {
1129 var params = EndpointParameters{
1130 Region: ptr.String("us-gov-east-1"),
1131 UseFIPS: ptr.Bool(false),
1132 UseDualStack: ptr.Bool(true),
1133 }
1134
1135 resolver := NewDefaultEndpointResolverV2()
1136 result, err := resolver.ResolveEndpoint(context.Background(), params)
1137 _, _ = result, err
1138
1139 if err != nil {
1140 t.Fatalf("expect no error, got %v", err)
1141 }
1142
1143 uri, _ := url.Parse("https://portal.sso.us-gov-east-1.api.aws")
1144
1145 expectEndpoint := smithyendpoints.Endpoint{
1146 URI: *uri,
1147 Headers: http.Header{},
1148 Properties: smithy.Properties{},
1149 }
1150
1151 if e, a := expectEndpoint.URI, result.URI; e != a {
1152 t.Errorf("expect %v URI, got %v", e, a)
1153 }
1154
1155 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1156 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1157 }
1158
1159 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1160 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1161 }
1162 }
1163
1164
1165 func TestEndpointCase31(t *testing.T) {
1166 var params = EndpointParameters{
1167 Region: ptr.String("us-iso-east-1"),
1168 UseFIPS: ptr.Bool(true),
1169 UseDualStack: ptr.Bool(true),
1170 }
1171
1172 resolver := NewDefaultEndpointResolverV2()
1173 result, err := resolver.ResolveEndpoint(context.Background(), params)
1174 _, _ = result, err
1175
1176 if err == nil {
1177 t.Fatalf("expect error, got none")
1178 }
1179 if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) {
1180 t.Errorf("expect %v error in %v", e, a)
1181 }
1182 }
1183
1184
1185 func TestEndpointCase32(t *testing.T) {
1186 var params = EndpointParameters{
1187 Region: ptr.String("us-iso-east-1"),
1188 UseFIPS: ptr.Bool(true),
1189 UseDualStack: ptr.Bool(false),
1190 }
1191
1192 resolver := NewDefaultEndpointResolverV2()
1193 result, err := resolver.ResolveEndpoint(context.Background(), params)
1194 _, _ = result, err
1195
1196 if err != nil {
1197 t.Fatalf("expect no error, got %v", err)
1198 }
1199
1200 uri, _ := url.Parse("https://portal.sso-fips.us-iso-east-1.c2s.ic.gov")
1201
1202 expectEndpoint := smithyendpoints.Endpoint{
1203 URI: *uri,
1204 Headers: http.Header{},
1205 Properties: smithy.Properties{},
1206 }
1207
1208 if e, a := expectEndpoint.URI, result.URI; e != a {
1209 t.Errorf("expect %v URI, got %v", e, a)
1210 }
1211
1212 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1213 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1214 }
1215
1216 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1217 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1218 }
1219 }
1220
1221
1222 func TestEndpointCase33(t *testing.T) {
1223 var params = EndpointParameters{
1224 Region: ptr.String("us-iso-east-1"),
1225 UseFIPS: ptr.Bool(false),
1226 UseDualStack: ptr.Bool(true),
1227 }
1228
1229 resolver := NewDefaultEndpointResolverV2()
1230 result, err := resolver.ResolveEndpoint(context.Background(), params)
1231 _, _ = result, err
1232
1233 if err == nil {
1234 t.Fatalf("expect error, got none")
1235 }
1236 if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) {
1237 t.Errorf("expect %v error in %v", e, a)
1238 }
1239 }
1240
1241
1242 func TestEndpointCase34(t *testing.T) {
1243 var params = EndpointParameters{
1244 Region: ptr.String("us-iso-east-1"),
1245 UseFIPS: ptr.Bool(false),
1246 UseDualStack: ptr.Bool(false),
1247 }
1248
1249 resolver := NewDefaultEndpointResolverV2()
1250 result, err := resolver.ResolveEndpoint(context.Background(), params)
1251 _, _ = result, err
1252
1253 if err != nil {
1254 t.Fatalf("expect no error, got %v", err)
1255 }
1256
1257 uri, _ := url.Parse("https://portal.sso.us-iso-east-1.c2s.ic.gov")
1258
1259 expectEndpoint := smithyendpoints.Endpoint{
1260 URI: *uri,
1261 Headers: http.Header{},
1262 Properties: smithy.Properties{},
1263 }
1264
1265 if e, a := expectEndpoint.URI, result.URI; e != a {
1266 t.Errorf("expect %v URI, got %v", e, a)
1267 }
1268
1269 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1270 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1271 }
1272
1273 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1274 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1275 }
1276 }
1277
1278
1279 func TestEndpointCase35(t *testing.T) {
1280 var params = EndpointParameters{
1281 Region: ptr.String("us-isob-east-1"),
1282 UseFIPS: ptr.Bool(true),
1283 UseDualStack: ptr.Bool(true),
1284 }
1285
1286 resolver := NewDefaultEndpointResolverV2()
1287 result, err := resolver.ResolveEndpoint(context.Background(), params)
1288 _, _ = result, err
1289
1290 if err == nil {
1291 t.Fatalf("expect error, got none")
1292 }
1293 if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) {
1294 t.Errorf("expect %v error in %v", e, a)
1295 }
1296 }
1297
1298
1299 func TestEndpointCase36(t *testing.T) {
1300 var params = EndpointParameters{
1301 Region: ptr.String("us-isob-east-1"),
1302 UseFIPS: ptr.Bool(true),
1303 UseDualStack: ptr.Bool(false),
1304 }
1305
1306 resolver := NewDefaultEndpointResolverV2()
1307 result, err := resolver.ResolveEndpoint(context.Background(), params)
1308 _, _ = result, err
1309
1310 if err != nil {
1311 t.Fatalf("expect no error, got %v", err)
1312 }
1313
1314 uri, _ := url.Parse("https://portal.sso-fips.us-isob-east-1.sc2s.sgov.gov")
1315
1316 expectEndpoint := smithyendpoints.Endpoint{
1317 URI: *uri,
1318 Headers: http.Header{},
1319 Properties: smithy.Properties{},
1320 }
1321
1322 if e, a := expectEndpoint.URI, result.URI; e != a {
1323 t.Errorf("expect %v URI, got %v", e, a)
1324 }
1325
1326 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1327 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1328 }
1329
1330 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1331 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1332 }
1333 }
1334
1335
1336 func TestEndpointCase37(t *testing.T) {
1337 var params = EndpointParameters{
1338 Region: ptr.String("us-isob-east-1"),
1339 UseFIPS: ptr.Bool(false),
1340 UseDualStack: ptr.Bool(true),
1341 }
1342
1343 resolver := NewDefaultEndpointResolverV2()
1344 result, err := resolver.ResolveEndpoint(context.Background(), params)
1345 _, _ = result, err
1346
1347 if err == nil {
1348 t.Fatalf("expect error, got none")
1349 }
1350 if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) {
1351 t.Errorf("expect %v error in %v", e, a)
1352 }
1353 }
1354
1355
1356 func TestEndpointCase38(t *testing.T) {
1357 var params = EndpointParameters{
1358 Region: ptr.String("us-isob-east-1"),
1359 UseFIPS: ptr.Bool(false),
1360 UseDualStack: ptr.Bool(false),
1361 }
1362
1363 resolver := NewDefaultEndpointResolverV2()
1364 result, err := resolver.ResolveEndpoint(context.Background(), params)
1365 _, _ = result, err
1366
1367 if err != nil {
1368 t.Fatalf("expect no error, got %v", err)
1369 }
1370
1371 uri, _ := url.Parse("https://portal.sso.us-isob-east-1.sc2s.sgov.gov")
1372
1373 expectEndpoint := smithyendpoints.Endpoint{
1374 URI: *uri,
1375 Headers: http.Header{},
1376 Properties: smithy.Properties{},
1377 }
1378
1379 if e, a := expectEndpoint.URI, result.URI; e != a {
1380 t.Errorf("expect %v URI, got %v", e, a)
1381 }
1382
1383 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1384 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1385 }
1386
1387 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1388 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1389 }
1390 }
1391
1392
1393 func TestEndpointCase39(t *testing.T) {
1394 var params = EndpointParameters{
1395 Region: ptr.String("us-east-1"),
1396 UseFIPS: ptr.Bool(false),
1397 UseDualStack: ptr.Bool(false),
1398 Endpoint: ptr.String("https://example.com"),
1399 }
1400
1401 resolver := NewDefaultEndpointResolverV2()
1402 result, err := resolver.ResolveEndpoint(context.Background(), params)
1403 _, _ = result, err
1404
1405 if err != nil {
1406 t.Fatalf("expect no error, got %v", err)
1407 }
1408
1409 uri, _ := url.Parse("https://example.com")
1410
1411 expectEndpoint := smithyendpoints.Endpoint{
1412 URI: *uri,
1413 Headers: http.Header{},
1414 Properties: smithy.Properties{},
1415 }
1416
1417 if e, a := expectEndpoint.URI, result.URI; e != a {
1418 t.Errorf("expect %v URI, got %v", e, a)
1419 }
1420
1421 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1422 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1423 }
1424
1425 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1426 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1427 }
1428 }
1429
1430
1431 func TestEndpointCase40(t *testing.T) {
1432 var params = EndpointParameters{
1433 UseFIPS: ptr.Bool(false),
1434 UseDualStack: ptr.Bool(false),
1435 Endpoint: ptr.String("https://example.com"),
1436 }
1437
1438 resolver := NewDefaultEndpointResolverV2()
1439 result, err := resolver.ResolveEndpoint(context.Background(), params)
1440 _, _ = result, err
1441
1442 if err != nil {
1443 t.Fatalf("expect no error, got %v", err)
1444 }
1445
1446 uri, _ := url.Parse("https://example.com")
1447
1448 expectEndpoint := smithyendpoints.Endpoint{
1449 URI: *uri,
1450 Headers: http.Header{},
1451 Properties: smithy.Properties{},
1452 }
1453
1454 if e, a := expectEndpoint.URI, result.URI; e != a {
1455 t.Errorf("expect %v URI, got %v", e, a)
1456 }
1457
1458 if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) {
1459 t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers)
1460 }
1461
1462 if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) {
1463 t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties)
1464 }
1465 }
1466
1467
1468 func TestEndpointCase41(t *testing.T) {
1469 var params = EndpointParameters{
1470 Region: ptr.String("us-east-1"),
1471 UseFIPS: ptr.Bool(true),
1472 UseDualStack: ptr.Bool(false),
1473 Endpoint: ptr.String("https://example.com"),
1474 }
1475
1476 resolver := NewDefaultEndpointResolverV2()
1477 result, err := resolver.ResolveEndpoint(context.Background(), params)
1478 _, _ = result, err
1479
1480 if err == nil {
1481 t.Fatalf("expect error, got none")
1482 }
1483 if e, a := "Invalid Configuration: FIPS and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) {
1484 t.Errorf("expect %v error in %v", e, a)
1485 }
1486 }
1487
1488
1489 func TestEndpointCase42(t *testing.T) {
1490 var params = EndpointParameters{
1491 Region: ptr.String("us-east-1"),
1492 UseFIPS: ptr.Bool(false),
1493 UseDualStack: ptr.Bool(true),
1494 Endpoint: ptr.String("https://example.com"),
1495 }
1496
1497 resolver := NewDefaultEndpointResolverV2()
1498 result, err := resolver.ResolveEndpoint(context.Background(), params)
1499 _, _ = result, err
1500
1501 if err == nil {
1502 t.Fatalf("expect error, got none")
1503 }
1504 if e, a := "Invalid Configuration: Dualstack and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) {
1505 t.Errorf("expect %v error in %v", e, a)
1506 }
1507 }
1508
1509
1510 func TestEndpointCase43(t *testing.T) {
1511 var params = EndpointParameters{}
1512
1513 resolver := NewDefaultEndpointResolverV2()
1514 result, err := resolver.ResolveEndpoint(context.Background(), params)
1515 _, _ = result, err
1516
1517 if err == nil {
1518 t.Fatalf("expect error, got none")
1519 }
1520 if e, a := "Invalid Configuration: Missing Region", err.Error(); !strings.Contains(a, e) {
1521 t.Errorf("expect %v error in %v", e, a)
1522 }
1523 }
1524
View as plain text