1
2
3 package endpoints
4
5 import (
6 "github.com/aws/aws-sdk-go-v2/aws"
7 endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
8 "github.com/aws/smithy-go/logging"
9 "regexp"
10 )
11
12
13 type Options struct {
14
15 Logger logging.Logger
16
17
18
19 LogDeprecated bool
20
21
22
23
24
25 ResolvedRegion string
26
27
28
29 DisableHTTPS bool
30
31
32 UseDualStackEndpoint aws.DualStackEndpointState
33
34
35 UseFIPSEndpoint aws.FIPSEndpointState
36 }
37
38 func (o Options) GetResolvedRegion() string {
39 return o.ResolvedRegion
40 }
41
42 func (o Options) GetDisableHTTPS() bool {
43 return o.DisableHTTPS
44 }
45
46 func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
47 return o.UseDualStackEndpoint
48 }
49
50 func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
51 return o.UseFIPSEndpoint
52 }
53
54 func transformToSharedOptions(options Options) endpoints.Options {
55 return endpoints.Options{
56 Logger: options.Logger,
57 LogDeprecated: options.LogDeprecated,
58 ResolvedRegion: options.ResolvedRegion,
59 DisableHTTPS: options.DisableHTTPS,
60 UseDualStackEndpoint: options.UseDualStackEndpoint,
61 UseFIPSEndpoint: options.UseFIPSEndpoint,
62 }
63 }
64
65
66 type Resolver struct {
67 partitions endpoints.Partitions
68 }
69
70
71 func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
72 if len(region) == 0 {
73 return endpoint, &aws.MissingRegionError{}
74 }
75
76 opt := transformToSharedOptions(options)
77 return r.partitions.ResolveEndpoint(region, opt)
78 }
79
80
81 func New() *Resolver {
82 return &Resolver{
83 partitions: defaultPartitions,
84 }
85 }
86
87 var partitionRegexp = struct {
88 Aws *regexp.Regexp
89 AwsCn *regexp.Regexp
90 AwsIso *regexp.Regexp
91 AwsIsoB *regexp.Regexp
92 AwsIsoE *regexp.Regexp
93 AwsIsoF *regexp.Regexp
94 AwsUsGov *regexp.Regexp
95 }{
96
97 Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$"),
98 AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
99 AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
100 AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
101 AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
102 AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
103 AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
104 }
105
106 var defaultPartitions = endpoints.Partitions{
107 {
108 ID: "aws",
109 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
110 {
111 Variant: endpoints.DualStackVariant,
112 }: {
113 Hostname: "api.ecr.{region}.api.aws",
114 Protocols: []string{"https"},
115 SignatureVersions: []string{"v4"},
116 },
117 {
118 Variant: endpoints.FIPSVariant,
119 }: {
120 Hostname: "ecr-fips.{region}.amazonaws.com",
121 Protocols: []string{"https"},
122 SignatureVersions: []string{"v4"},
123 },
124 {
125 Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
126 }: {
127 Hostname: "api.ecr-fips.{region}.api.aws",
128 Protocols: []string{"https"},
129 SignatureVersions: []string{"v4"},
130 },
131 {
132 Variant: 0,
133 }: {
134 Hostname: "api.ecr.{region}.amazonaws.com",
135 Protocols: []string{"https"},
136 SignatureVersions: []string{"v4"},
137 },
138 },
139 RegionRegex: partitionRegexp.Aws,
140 IsRegionalized: true,
141 Endpoints: endpoints.Endpoints{
142 endpoints.EndpointKey{
143 Region: "af-south-1",
144 }: endpoints.Endpoint{
145 Hostname: "api.ecr.af-south-1.amazonaws.com",
146 CredentialScope: endpoints.CredentialScope{
147 Region: "af-south-1",
148 },
149 },
150 endpoints.EndpointKey{
151 Region: "ap-east-1",
152 }: endpoints.Endpoint{
153 Hostname: "api.ecr.ap-east-1.amazonaws.com",
154 CredentialScope: endpoints.CredentialScope{
155 Region: "ap-east-1",
156 },
157 },
158 endpoints.EndpointKey{
159 Region: "ap-northeast-1",
160 }: endpoints.Endpoint{
161 Hostname: "api.ecr.ap-northeast-1.amazonaws.com",
162 CredentialScope: endpoints.CredentialScope{
163 Region: "ap-northeast-1",
164 },
165 },
166 endpoints.EndpointKey{
167 Region: "ap-northeast-2",
168 }: endpoints.Endpoint{
169 Hostname: "api.ecr.ap-northeast-2.amazonaws.com",
170 CredentialScope: endpoints.CredentialScope{
171 Region: "ap-northeast-2",
172 },
173 },
174 endpoints.EndpointKey{
175 Region: "ap-northeast-3",
176 }: endpoints.Endpoint{
177 Hostname: "api.ecr.ap-northeast-3.amazonaws.com",
178 CredentialScope: endpoints.CredentialScope{
179 Region: "ap-northeast-3",
180 },
181 },
182 endpoints.EndpointKey{
183 Region: "ap-south-1",
184 }: endpoints.Endpoint{
185 Hostname: "api.ecr.ap-south-1.amazonaws.com",
186 CredentialScope: endpoints.CredentialScope{
187 Region: "ap-south-1",
188 },
189 },
190 endpoints.EndpointKey{
191 Region: "ap-south-2",
192 }: endpoints.Endpoint{
193 Hostname: "api.ecr.ap-south-2.amazonaws.com",
194 CredentialScope: endpoints.CredentialScope{
195 Region: "ap-south-2",
196 },
197 },
198 endpoints.EndpointKey{
199 Region: "ap-southeast-1",
200 }: endpoints.Endpoint{
201 Hostname: "api.ecr.ap-southeast-1.amazonaws.com",
202 CredentialScope: endpoints.CredentialScope{
203 Region: "ap-southeast-1",
204 },
205 },
206 endpoints.EndpointKey{
207 Region: "ap-southeast-2",
208 }: endpoints.Endpoint{
209 Hostname: "api.ecr.ap-southeast-2.amazonaws.com",
210 CredentialScope: endpoints.CredentialScope{
211 Region: "ap-southeast-2",
212 },
213 },
214 endpoints.EndpointKey{
215 Region: "ap-southeast-3",
216 }: endpoints.Endpoint{
217 Hostname: "api.ecr.ap-southeast-3.amazonaws.com",
218 CredentialScope: endpoints.CredentialScope{
219 Region: "ap-southeast-3",
220 },
221 },
222 endpoints.EndpointKey{
223 Region: "ap-southeast-4",
224 }: endpoints.Endpoint{
225 Hostname: "api.ecr.ap-southeast-4.amazonaws.com",
226 CredentialScope: endpoints.CredentialScope{
227 Region: "ap-southeast-4",
228 },
229 },
230 endpoints.EndpointKey{
231 Region: "ca-central-1",
232 }: endpoints.Endpoint{
233 Hostname: "api.ecr.ca-central-1.amazonaws.com",
234 CredentialScope: endpoints.CredentialScope{
235 Region: "ca-central-1",
236 },
237 },
238 endpoints.EndpointKey{
239 Region: "dkr-us-east-1",
240 }: endpoints.Endpoint{
241 CredentialScope: endpoints.CredentialScope{
242 Region: "us-east-1",
243 },
244 Deprecated: aws.TrueTernary,
245 },
246 endpoints.EndpointKey{
247 Region: "dkr-us-east-1",
248 Variant: endpoints.FIPSVariant,
249 }: {
250 Hostname: "ecr-fips.us-east-1.amazonaws.com",
251 CredentialScope: endpoints.CredentialScope{
252 Region: "us-east-1",
253 },
254 Deprecated: aws.TrueTernary,
255 },
256 endpoints.EndpointKey{
257 Region: "dkr-us-east-2",
258 }: endpoints.Endpoint{
259 CredentialScope: endpoints.CredentialScope{
260 Region: "us-east-2",
261 },
262 Deprecated: aws.TrueTernary,
263 },
264 endpoints.EndpointKey{
265 Region: "dkr-us-east-2",
266 Variant: endpoints.FIPSVariant,
267 }: {
268 Hostname: "ecr-fips.us-east-2.amazonaws.com",
269 CredentialScope: endpoints.CredentialScope{
270 Region: "us-east-2",
271 },
272 Deprecated: aws.TrueTernary,
273 },
274 endpoints.EndpointKey{
275 Region: "dkr-us-west-1",
276 }: endpoints.Endpoint{
277 CredentialScope: endpoints.CredentialScope{
278 Region: "us-west-1",
279 },
280 Deprecated: aws.TrueTernary,
281 },
282 endpoints.EndpointKey{
283 Region: "dkr-us-west-1",
284 Variant: endpoints.FIPSVariant,
285 }: {
286 Hostname: "ecr-fips.us-west-1.amazonaws.com",
287 CredentialScope: endpoints.CredentialScope{
288 Region: "us-west-1",
289 },
290 Deprecated: aws.TrueTernary,
291 },
292 endpoints.EndpointKey{
293 Region: "dkr-us-west-2",
294 }: endpoints.Endpoint{
295 CredentialScope: endpoints.CredentialScope{
296 Region: "us-west-2",
297 },
298 Deprecated: aws.TrueTernary,
299 },
300 endpoints.EndpointKey{
301 Region: "dkr-us-west-2",
302 Variant: endpoints.FIPSVariant,
303 }: {
304 Hostname: "ecr-fips.us-west-2.amazonaws.com",
305 CredentialScope: endpoints.CredentialScope{
306 Region: "us-west-2",
307 },
308 Deprecated: aws.TrueTernary,
309 },
310 endpoints.EndpointKey{
311 Region: "eu-central-1",
312 }: endpoints.Endpoint{
313 Hostname: "api.ecr.eu-central-1.amazonaws.com",
314 CredentialScope: endpoints.CredentialScope{
315 Region: "eu-central-1",
316 },
317 },
318 endpoints.EndpointKey{
319 Region: "eu-central-2",
320 }: endpoints.Endpoint{
321 Hostname: "api.ecr.eu-central-2.amazonaws.com",
322 CredentialScope: endpoints.CredentialScope{
323 Region: "eu-central-2",
324 },
325 },
326 endpoints.EndpointKey{
327 Region: "eu-north-1",
328 }: endpoints.Endpoint{
329 Hostname: "api.ecr.eu-north-1.amazonaws.com",
330 CredentialScope: endpoints.CredentialScope{
331 Region: "eu-north-1",
332 },
333 },
334 endpoints.EndpointKey{
335 Region: "eu-south-1",
336 }: endpoints.Endpoint{
337 Hostname: "api.ecr.eu-south-1.amazonaws.com",
338 CredentialScope: endpoints.CredentialScope{
339 Region: "eu-south-1",
340 },
341 },
342 endpoints.EndpointKey{
343 Region: "eu-south-2",
344 }: endpoints.Endpoint{
345 Hostname: "api.ecr.eu-south-2.amazonaws.com",
346 CredentialScope: endpoints.CredentialScope{
347 Region: "eu-south-2",
348 },
349 },
350 endpoints.EndpointKey{
351 Region: "eu-west-1",
352 }: endpoints.Endpoint{
353 Hostname: "api.ecr.eu-west-1.amazonaws.com",
354 CredentialScope: endpoints.CredentialScope{
355 Region: "eu-west-1",
356 },
357 },
358 endpoints.EndpointKey{
359 Region: "eu-west-2",
360 }: endpoints.Endpoint{
361 Hostname: "api.ecr.eu-west-2.amazonaws.com",
362 CredentialScope: endpoints.CredentialScope{
363 Region: "eu-west-2",
364 },
365 },
366 endpoints.EndpointKey{
367 Region: "eu-west-3",
368 }: endpoints.Endpoint{
369 Hostname: "api.ecr.eu-west-3.amazonaws.com",
370 CredentialScope: endpoints.CredentialScope{
371 Region: "eu-west-3",
372 },
373 },
374 endpoints.EndpointKey{
375 Region: "fips-dkr-us-east-1",
376 }: endpoints.Endpoint{
377 Hostname: "ecr-fips.us-east-1.amazonaws.com",
378 CredentialScope: endpoints.CredentialScope{
379 Region: "us-east-1",
380 },
381 Deprecated: aws.TrueTernary,
382 },
383 endpoints.EndpointKey{
384 Region: "fips-dkr-us-east-2",
385 }: endpoints.Endpoint{
386 Hostname: "ecr-fips.us-east-2.amazonaws.com",
387 CredentialScope: endpoints.CredentialScope{
388 Region: "us-east-2",
389 },
390 Deprecated: aws.TrueTernary,
391 },
392 endpoints.EndpointKey{
393 Region: "fips-dkr-us-west-1",
394 }: endpoints.Endpoint{
395 Hostname: "ecr-fips.us-west-1.amazonaws.com",
396 CredentialScope: endpoints.CredentialScope{
397 Region: "us-west-1",
398 },
399 Deprecated: aws.TrueTernary,
400 },
401 endpoints.EndpointKey{
402 Region: "fips-dkr-us-west-2",
403 }: endpoints.Endpoint{
404 Hostname: "ecr-fips.us-west-2.amazonaws.com",
405 CredentialScope: endpoints.CredentialScope{
406 Region: "us-west-2",
407 },
408 Deprecated: aws.TrueTernary,
409 },
410 endpoints.EndpointKey{
411 Region: "fips-us-east-1",
412 }: endpoints.Endpoint{
413 Hostname: "ecr-fips.us-east-1.amazonaws.com",
414 CredentialScope: endpoints.CredentialScope{
415 Region: "us-east-1",
416 },
417 Deprecated: aws.TrueTernary,
418 },
419 endpoints.EndpointKey{
420 Region: "fips-us-east-2",
421 }: endpoints.Endpoint{
422 Hostname: "ecr-fips.us-east-2.amazonaws.com",
423 CredentialScope: endpoints.CredentialScope{
424 Region: "us-east-2",
425 },
426 Deprecated: aws.TrueTernary,
427 },
428 endpoints.EndpointKey{
429 Region: "fips-us-west-1",
430 }: endpoints.Endpoint{
431 Hostname: "ecr-fips.us-west-1.amazonaws.com",
432 CredentialScope: endpoints.CredentialScope{
433 Region: "us-west-1",
434 },
435 Deprecated: aws.TrueTernary,
436 },
437 endpoints.EndpointKey{
438 Region: "fips-us-west-2",
439 }: endpoints.Endpoint{
440 Hostname: "ecr-fips.us-west-2.amazonaws.com",
441 CredentialScope: endpoints.CredentialScope{
442 Region: "us-west-2",
443 },
444 Deprecated: aws.TrueTernary,
445 },
446 endpoints.EndpointKey{
447 Region: "il-central-1",
448 }: endpoints.Endpoint{
449 Hostname: "api.ecr.il-central-1.amazonaws.com",
450 CredentialScope: endpoints.CredentialScope{
451 Region: "il-central-1",
452 },
453 },
454 endpoints.EndpointKey{
455 Region: "me-central-1",
456 }: endpoints.Endpoint{
457 Hostname: "api.ecr.me-central-1.amazonaws.com",
458 CredentialScope: endpoints.CredentialScope{
459 Region: "me-central-1",
460 },
461 },
462 endpoints.EndpointKey{
463 Region: "me-south-1",
464 }: endpoints.Endpoint{
465 Hostname: "api.ecr.me-south-1.amazonaws.com",
466 CredentialScope: endpoints.CredentialScope{
467 Region: "me-south-1",
468 },
469 },
470 endpoints.EndpointKey{
471 Region: "sa-east-1",
472 }: endpoints.Endpoint{
473 Hostname: "api.ecr.sa-east-1.amazonaws.com",
474 CredentialScope: endpoints.CredentialScope{
475 Region: "sa-east-1",
476 },
477 },
478 endpoints.EndpointKey{
479 Region: "us-east-1",
480 }: endpoints.Endpoint{
481 Hostname: "api.ecr.us-east-1.amazonaws.com",
482 CredentialScope: endpoints.CredentialScope{
483 Region: "us-east-1",
484 },
485 },
486 endpoints.EndpointKey{
487 Region: "us-east-1",
488 Variant: endpoints.FIPSVariant,
489 }: {
490 Hostname: "ecr-fips.us-east-1.amazonaws.com",
491 CredentialScope: endpoints.CredentialScope{
492 Region: "us-east-1",
493 },
494 },
495 endpoints.EndpointKey{
496 Region: "us-east-2",
497 }: endpoints.Endpoint{
498 Hostname: "api.ecr.us-east-2.amazonaws.com",
499 CredentialScope: endpoints.CredentialScope{
500 Region: "us-east-2",
501 },
502 },
503 endpoints.EndpointKey{
504 Region: "us-east-2",
505 Variant: endpoints.FIPSVariant,
506 }: {
507 Hostname: "ecr-fips.us-east-2.amazonaws.com",
508 CredentialScope: endpoints.CredentialScope{
509 Region: "us-east-2",
510 },
511 },
512 endpoints.EndpointKey{
513 Region: "us-west-1",
514 }: endpoints.Endpoint{
515 Hostname: "api.ecr.us-west-1.amazonaws.com",
516 CredentialScope: endpoints.CredentialScope{
517 Region: "us-west-1",
518 },
519 },
520 endpoints.EndpointKey{
521 Region: "us-west-1",
522 Variant: endpoints.FIPSVariant,
523 }: {
524 Hostname: "ecr-fips.us-west-1.amazonaws.com",
525 CredentialScope: endpoints.CredentialScope{
526 Region: "us-west-1",
527 },
528 },
529 endpoints.EndpointKey{
530 Region: "us-west-2",
531 }: endpoints.Endpoint{
532 Hostname: "api.ecr.us-west-2.amazonaws.com",
533 CredentialScope: endpoints.CredentialScope{
534 Region: "us-west-2",
535 },
536 },
537 endpoints.EndpointKey{
538 Region: "us-west-2",
539 Variant: endpoints.FIPSVariant,
540 }: {
541 Hostname: "ecr-fips.us-west-2.amazonaws.com",
542 CredentialScope: endpoints.CredentialScope{
543 Region: "us-west-2",
544 },
545 },
546 },
547 },
548 {
549 ID: "aws-cn",
550 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
551 {
552 Variant: endpoints.DualStackVariant,
553 }: {
554 Hostname: "api.ecr.{region}.api.amazonwebservices.com.cn",
555 Protocols: []string{"https"},
556 SignatureVersions: []string{"v4"},
557 },
558 {
559 Variant: endpoints.FIPSVariant,
560 }: {
561 Hostname: "api.ecr-fips.{region}.amazonaws.com.cn",
562 Protocols: []string{"https"},
563 SignatureVersions: []string{"v4"},
564 },
565 {
566 Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
567 }: {
568 Hostname: "api.ecr-fips.{region}.api.amazonwebservices.com.cn",
569 Protocols: []string{"https"},
570 SignatureVersions: []string{"v4"},
571 },
572 {
573 Variant: 0,
574 }: {
575 Hostname: "api.ecr.{region}.amazonaws.com.cn",
576 Protocols: []string{"https"},
577 SignatureVersions: []string{"v4"},
578 },
579 },
580 RegionRegex: partitionRegexp.AwsCn,
581 IsRegionalized: true,
582 Endpoints: endpoints.Endpoints{
583 endpoints.EndpointKey{
584 Region: "cn-north-1",
585 }: endpoints.Endpoint{
586 Hostname: "api.ecr.cn-north-1.amazonaws.com.cn",
587 CredentialScope: endpoints.CredentialScope{
588 Region: "cn-north-1",
589 },
590 },
591 endpoints.EndpointKey{
592 Region: "cn-northwest-1",
593 }: endpoints.Endpoint{
594 Hostname: "api.ecr.cn-northwest-1.amazonaws.com.cn",
595 CredentialScope: endpoints.CredentialScope{
596 Region: "cn-northwest-1",
597 },
598 },
599 },
600 },
601 {
602 ID: "aws-iso",
603 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
604 {
605 Variant: endpoints.FIPSVariant,
606 }: {
607 Hostname: "api.ecr-fips.{region}.c2s.ic.gov",
608 Protocols: []string{"https"},
609 SignatureVersions: []string{"v4"},
610 },
611 {
612 Variant: 0,
613 }: {
614 Hostname: "api.ecr.{region}.c2s.ic.gov",
615 Protocols: []string{"https"},
616 SignatureVersions: []string{"v4"},
617 },
618 },
619 RegionRegex: partitionRegexp.AwsIso,
620 IsRegionalized: true,
621 Endpoints: endpoints.Endpoints{
622 endpoints.EndpointKey{
623 Region: "us-iso-east-1",
624 }: endpoints.Endpoint{
625 Hostname: "api.ecr.us-iso-east-1.c2s.ic.gov",
626 CredentialScope: endpoints.CredentialScope{
627 Region: "us-iso-east-1",
628 },
629 },
630 endpoints.EndpointKey{
631 Region: "us-iso-west-1",
632 }: endpoints.Endpoint{
633 Hostname: "api.ecr.us-iso-west-1.c2s.ic.gov",
634 CredentialScope: endpoints.CredentialScope{
635 Region: "us-iso-west-1",
636 },
637 },
638 },
639 },
640 {
641 ID: "aws-iso-b",
642 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
643 {
644 Variant: endpoints.FIPSVariant,
645 }: {
646 Hostname: "api.ecr-fips.{region}.sc2s.sgov.gov",
647 Protocols: []string{"https"},
648 SignatureVersions: []string{"v4"},
649 },
650 {
651 Variant: 0,
652 }: {
653 Hostname: "api.ecr.{region}.sc2s.sgov.gov",
654 Protocols: []string{"https"},
655 SignatureVersions: []string{"v4"},
656 },
657 },
658 RegionRegex: partitionRegexp.AwsIsoB,
659 IsRegionalized: true,
660 Endpoints: endpoints.Endpoints{
661 endpoints.EndpointKey{
662 Region: "us-isob-east-1",
663 }: endpoints.Endpoint{
664 Hostname: "api.ecr.us-isob-east-1.sc2s.sgov.gov",
665 CredentialScope: endpoints.CredentialScope{
666 Region: "us-isob-east-1",
667 },
668 },
669 },
670 },
671 {
672 ID: "aws-iso-e",
673 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
674 {
675 Variant: endpoints.FIPSVariant,
676 }: {
677 Hostname: "api.ecr-fips.{region}.cloud.adc-e.uk",
678 Protocols: []string{"https"},
679 SignatureVersions: []string{"v4"},
680 },
681 {
682 Variant: 0,
683 }: {
684 Hostname: "api.ecr.{region}.cloud.adc-e.uk",
685 Protocols: []string{"https"},
686 SignatureVersions: []string{"v4"},
687 },
688 },
689 RegionRegex: partitionRegexp.AwsIsoE,
690 IsRegionalized: true,
691 },
692 {
693 ID: "aws-iso-f",
694 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
695 {
696 Variant: endpoints.FIPSVariant,
697 }: {
698 Hostname: "api.ecr-fips.{region}.csp.hci.ic.gov",
699 Protocols: []string{"https"},
700 SignatureVersions: []string{"v4"},
701 },
702 {
703 Variant: 0,
704 }: {
705 Hostname: "api.ecr.{region}.csp.hci.ic.gov",
706 Protocols: []string{"https"},
707 SignatureVersions: []string{"v4"},
708 },
709 },
710 RegionRegex: partitionRegexp.AwsIsoF,
711 IsRegionalized: true,
712 },
713 {
714 ID: "aws-us-gov",
715 Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
716 {
717 Variant: endpoints.DualStackVariant,
718 }: {
719 Hostname: "api.ecr.{region}.api.aws",
720 Protocols: []string{"https"},
721 SignatureVersions: []string{"v4"},
722 },
723 {
724 Variant: endpoints.FIPSVariant,
725 }: {
726 Hostname: "ecr-fips.{region}.amazonaws.com",
727 Protocols: []string{"https"},
728 SignatureVersions: []string{"v4"},
729 },
730 {
731 Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
732 }: {
733 Hostname: "api.ecr-fips.{region}.api.aws",
734 Protocols: []string{"https"},
735 SignatureVersions: []string{"v4"},
736 },
737 {
738 Variant: 0,
739 }: {
740 Hostname: "api.ecr.{region}.amazonaws.com",
741 Protocols: []string{"https"},
742 SignatureVersions: []string{"v4"},
743 },
744 },
745 RegionRegex: partitionRegexp.AwsUsGov,
746 IsRegionalized: true,
747 Endpoints: endpoints.Endpoints{
748 endpoints.EndpointKey{
749 Region: "dkr-us-gov-east-1",
750 }: endpoints.Endpoint{
751 CredentialScope: endpoints.CredentialScope{
752 Region: "us-gov-east-1",
753 },
754 Deprecated: aws.TrueTernary,
755 },
756 endpoints.EndpointKey{
757 Region: "dkr-us-gov-east-1",
758 Variant: endpoints.FIPSVariant,
759 }: {
760 Hostname: "ecr-fips.us-gov-east-1.amazonaws.com",
761 CredentialScope: endpoints.CredentialScope{
762 Region: "us-gov-east-1",
763 },
764 Deprecated: aws.TrueTernary,
765 },
766 endpoints.EndpointKey{
767 Region: "dkr-us-gov-west-1",
768 }: endpoints.Endpoint{
769 CredentialScope: endpoints.CredentialScope{
770 Region: "us-gov-west-1",
771 },
772 Deprecated: aws.TrueTernary,
773 },
774 endpoints.EndpointKey{
775 Region: "dkr-us-gov-west-1",
776 Variant: endpoints.FIPSVariant,
777 }: {
778 Hostname: "ecr-fips.us-gov-west-1.amazonaws.com",
779 CredentialScope: endpoints.CredentialScope{
780 Region: "us-gov-west-1",
781 },
782 Deprecated: aws.TrueTernary,
783 },
784 endpoints.EndpointKey{
785 Region: "fips-dkr-us-gov-east-1",
786 }: endpoints.Endpoint{
787 Hostname: "ecr-fips.us-gov-east-1.amazonaws.com",
788 CredentialScope: endpoints.CredentialScope{
789 Region: "us-gov-east-1",
790 },
791 Deprecated: aws.TrueTernary,
792 },
793 endpoints.EndpointKey{
794 Region: "fips-dkr-us-gov-west-1",
795 }: endpoints.Endpoint{
796 Hostname: "ecr-fips.us-gov-west-1.amazonaws.com",
797 CredentialScope: endpoints.CredentialScope{
798 Region: "us-gov-west-1",
799 },
800 Deprecated: aws.TrueTernary,
801 },
802 endpoints.EndpointKey{
803 Region: "fips-us-gov-east-1",
804 }: endpoints.Endpoint{
805 Hostname: "ecr-fips.us-gov-east-1.amazonaws.com",
806 CredentialScope: endpoints.CredentialScope{
807 Region: "us-gov-east-1",
808 },
809 Deprecated: aws.TrueTernary,
810 },
811 endpoints.EndpointKey{
812 Region: "fips-us-gov-west-1",
813 }: endpoints.Endpoint{
814 Hostname: "ecr-fips.us-gov-west-1.amazonaws.com",
815 CredentialScope: endpoints.CredentialScope{
816 Region: "us-gov-west-1",
817 },
818 Deprecated: aws.TrueTernary,
819 },
820 endpoints.EndpointKey{
821 Region: "us-gov-east-1",
822 }: endpoints.Endpoint{
823 Hostname: "api.ecr.us-gov-east-1.amazonaws.com",
824 CredentialScope: endpoints.CredentialScope{
825 Region: "us-gov-east-1",
826 },
827 },
828 endpoints.EndpointKey{
829 Region: "us-gov-east-1",
830 Variant: endpoints.FIPSVariant,
831 }: {
832 Hostname: "ecr-fips.us-gov-east-1.amazonaws.com",
833 CredentialScope: endpoints.CredentialScope{
834 Region: "us-gov-east-1",
835 },
836 },
837 endpoints.EndpointKey{
838 Region: "us-gov-west-1",
839 }: endpoints.Endpoint{
840 Hostname: "api.ecr.us-gov-west-1.amazonaws.com",
841 CredentialScope: endpoints.CredentialScope{
842 Region: "us-gov-west-1",
843 },
844 },
845 endpoints.EndpointKey{
846 Region: "us-gov-west-1",
847 Variant: endpoints.FIPSVariant,
848 }: {
849 Hostname: "ecr-fips.us-gov-west-1.amazonaws.com",
850 CredentialScope: endpoints.CredentialScope{
851 Region: "us-gov-west-1",
852 },
853 },
854 },
855 },
856 }
857
View as plain text