123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- // Code generated by smithy-go-codegen DO NOT EDIT.
- package endpoints
- import (
- "github.com/aws/aws-sdk-go-v2/aws"
- endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
- "github.com/aws/smithy-go/logging"
- "regexp"
- )
- // Options is the endpoint resolver configuration options
- type Options struct {
- // Logger is a logging implementation that log events should be sent to.
- Logger logging.Logger
- // LogDeprecated indicates that deprecated endpoints should be logged to the
- // provided logger.
- LogDeprecated bool
- // ResolvedRegion is used to override the region to be resolved, rather then the
- // using the value passed to the ResolveEndpoint method. This value is used by the
- // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
- // name. You must not set this value directly in your application.
- ResolvedRegion string
- // DisableHTTPS informs the resolver to return an endpoint that does not use the
- // HTTPS scheme.
- DisableHTTPS bool
- // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
- UseDualStackEndpoint aws.DualStackEndpointState
- // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
- UseFIPSEndpoint aws.FIPSEndpointState
- }
- func (o Options) GetResolvedRegion() string {
- return o.ResolvedRegion
- }
- func (o Options) GetDisableHTTPS() bool {
- return o.DisableHTTPS
- }
- func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
- return o.UseDualStackEndpoint
- }
- func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
- return o.UseFIPSEndpoint
- }
- func transformToSharedOptions(options Options) endpoints.Options {
- return endpoints.Options{
- Logger: options.Logger,
- LogDeprecated: options.LogDeprecated,
- ResolvedRegion: options.ResolvedRegion,
- DisableHTTPS: options.DisableHTTPS,
- UseDualStackEndpoint: options.UseDualStackEndpoint,
- UseFIPSEndpoint: options.UseFIPSEndpoint,
- }
- }
- // Resolver SSO OIDC endpoint resolver
- type Resolver struct {
- partitions endpoints.Partitions
- }
- // ResolveEndpoint resolves the service endpoint for the given region and options
- func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
- if len(region) == 0 {
- return endpoint, &aws.MissingRegionError{}
- }
- opt := transformToSharedOptions(options)
- return r.partitions.ResolveEndpoint(region, opt)
- }
- // New returns a new Resolver
- func New() *Resolver {
- return &Resolver{
- partitions: defaultPartitions,
- }
- }
- var partitionRegexp = struct {
- Aws *regexp.Regexp
- AwsCn *regexp.Regexp
- AwsIso *regexp.Regexp
- AwsIsoB *regexp.Regexp
- AwsUsGov *regexp.Regexp
- }{
- Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"),
- AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
- AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
- AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
- AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
- }
- var defaultPartitions = endpoints.Partitions{
- {
- ID: "aws",
- Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
- {
- Variant: endpoints.DualStackVariant,
- }: {
- Hostname: "oidc.{region}.api.aws",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant,
- }: {
- Hostname: "oidc-fips.{region}.amazonaws.com",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
- }: {
- Hostname: "oidc-fips.{region}.api.aws",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: 0,
- }: {
- Hostname: "oidc.{region}.amazonaws.com",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- },
- RegionRegex: partitionRegexp.Aws,
- IsRegionalized: true,
- Endpoints: endpoints.Endpoints{
- endpoints.EndpointKey{
- Region: "af-south-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.af-south-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "af-south-1",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-east-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-east-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-east-1",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-northeast-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-northeast-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-northeast-1",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-northeast-2",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-northeast-2.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-northeast-2",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-northeast-3",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-northeast-3.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-northeast-3",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-south-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-south-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-south-1",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-southeast-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-southeast-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-southeast-1",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-southeast-2",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-southeast-2.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-southeast-2",
- },
- },
- endpoints.EndpointKey{
- Region: "ap-southeast-3",
- }: endpoints.Endpoint{
- Hostname: "oidc.ap-southeast-3.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ap-southeast-3",
- },
- },
- endpoints.EndpointKey{
- Region: "ca-central-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.ca-central-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "ca-central-1",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-central-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-central-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-central-1",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-north-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-north-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-north-1",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-south-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-south-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-south-1",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-west-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-west-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-west-1",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-west-2",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-west-2.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-west-2",
- },
- },
- endpoints.EndpointKey{
- Region: "eu-west-3",
- }: endpoints.Endpoint{
- Hostname: "oidc.eu-west-3.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "eu-west-3",
- },
- },
- endpoints.EndpointKey{
- Region: "me-south-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.me-south-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "me-south-1",
- },
- },
- endpoints.EndpointKey{
- Region: "sa-east-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.sa-east-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "sa-east-1",
- },
- },
- endpoints.EndpointKey{
- Region: "us-east-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-east-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-east-1",
- },
- },
- endpoints.EndpointKey{
- Region: "us-east-2",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-east-2.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-east-2",
- },
- },
- endpoints.EndpointKey{
- Region: "us-west-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-west-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-west-1",
- },
- },
- endpoints.EndpointKey{
- Region: "us-west-2",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-west-2.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-west-2",
- },
- },
- },
- },
- {
- ID: "aws-cn",
- Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
- {
- Variant: endpoints.DualStackVariant,
- }: {
- Hostname: "oidc.{region}.api.amazonwebservices.com.cn",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant,
- }: {
- Hostname: "oidc-fips.{region}.amazonaws.com.cn",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
- }: {
- Hostname: "oidc-fips.{region}.api.amazonwebservices.com.cn",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: 0,
- }: {
- Hostname: "oidc.{region}.amazonaws.com.cn",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- },
- RegionRegex: partitionRegexp.AwsCn,
- IsRegionalized: true,
- },
- {
- ID: "aws-iso",
- Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
- {
- Variant: endpoints.FIPSVariant,
- }: {
- Hostname: "oidc-fips.{region}.c2s.ic.gov",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: 0,
- }: {
- Hostname: "oidc.{region}.c2s.ic.gov",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- },
- RegionRegex: partitionRegexp.AwsIso,
- IsRegionalized: true,
- },
- {
- ID: "aws-iso-b",
- Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
- {
- Variant: endpoints.FIPSVariant,
- }: {
- Hostname: "oidc-fips.{region}.sc2s.sgov.gov",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: 0,
- }: {
- Hostname: "oidc.{region}.sc2s.sgov.gov",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- },
- RegionRegex: partitionRegexp.AwsIsoB,
- IsRegionalized: true,
- },
- {
- ID: "aws-us-gov",
- Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
- {
- Variant: endpoints.DualStackVariant,
- }: {
- Hostname: "oidc.{region}.api.aws",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant,
- }: {
- Hostname: "oidc-fips.{region}.amazonaws.com",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
- }: {
- Hostname: "oidc-fips.{region}.api.aws",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- {
- Variant: 0,
- }: {
- Hostname: "oidc.{region}.amazonaws.com",
- Protocols: []string{"https"},
- SignatureVersions: []string{"v4"},
- },
- },
- RegionRegex: partitionRegexp.AwsUsGov,
- IsRegionalized: true,
- Endpoints: endpoints.Endpoints{
- endpoints.EndpointKey{
- Region: "us-gov-east-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-gov-east-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-gov-east-1",
- },
- },
- endpoints.EndpointKey{
- Region: "us-gov-west-1",
- }: endpoints.Endpoint{
- Hostname: "oidc.us-gov-west-1.amazonaws.com",
- CredentialScope: endpoints.CredentialScope{
- Region: "us-gov-west-1",
- },
- },
- },
- },
- }
|