...

Source file src/github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints/endpoints.go

Documentation: github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints

     1  // Code generated by smithy-go-codegen DO NOT EDIT.
     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  // Options is the endpoint resolver configuration options
    13  type Options struct {
    14  	// Logger is a logging implementation that log events should be sent to.
    15  	Logger logging.Logger
    16  
    17  	// LogDeprecated indicates that deprecated endpoints should be logged to the
    18  	// provided logger.
    19  	LogDeprecated bool
    20  
    21  	// ResolvedRegion is used to override the region to be resolved, rather then the
    22  	// using the value passed to the ResolveEndpoint method. This value is used by the
    23  	// SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
    24  	// name. You must not set this value directly in your application.
    25  	ResolvedRegion string
    26  
    27  	// DisableHTTPS informs the resolver to return an endpoint that does not use the
    28  	// HTTPS scheme.
    29  	DisableHTTPS bool
    30  
    31  	// UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
    32  	UseDualStackEndpoint aws.DualStackEndpointState
    33  
    34  	// UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
    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  // Resolver SSO OIDC endpoint resolver
    66  type Resolver struct {
    67  	partitions endpoints.Partitions
    68  }
    69  
    70  // ResolveEndpoint resolves the service endpoint for the given region and options
    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  // New returns a new Resolver
    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:          "oidc.{region}.api.aws",
   114  				Protocols:         []string{"https"},
   115  				SignatureVersions: []string{"v4"},
   116  			},
   117  			{
   118  				Variant: endpoints.FIPSVariant,
   119  			}: {
   120  				Hostname:          "oidc-fips.{region}.amazonaws.com",
   121  				Protocols:         []string{"https"},
   122  				SignatureVersions: []string{"v4"},
   123  			},
   124  			{
   125  				Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
   126  			}: {
   127  				Hostname:          "oidc-fips.{region}.api.aws",
   128  				Protocols:         []string{"https"},
   129  				SignatureVersions: []string{"v4"},
   130  			},
   131  			{
   132  				Variant: 0,
   133  			}: {
   134  				Hostname:          "oidc.{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: "oidc.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: "oidc.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: "oidc.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: "oidc.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: "oidc.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: "oidc.ap-south-1.amazonaws.com",
   186  				CredentialScope: endpoints.CredentialScope{
   187  					Region: "ap-south-1",
   188  				},
   189  			},
   190  			endpoints.EndpointKey{
   191  				Region: "ap-southeast-1",
   192  			}: endpoints.Endpoint{
   193  				Hostname: "oidc.ap-southeast-1.amazonaws.com",
   194  				CredentialScope: endpoints.CredentialScope{
   195  					Region: "ap-southeast-1",
   196  				},
   197  			},
   198  			endpoints.EndpointKey{
   199  				Region: "ap-southeast-2",
   200  			}: endpoints.Endpoint{
   201  				Hostname: "oidc.ap-southeast-2.amazonaws.com",
   202  				CredentialScope: endpoints.CredentialScope{
   203  					Region: "ap-southeast-2",
   204  				},
   205  			},
   206  			endpoints.EndpointKey{
   207  				Region: "ap-southeast-3",
   208  			}: endpoints.Endpoint{
   209  				Hostname: "oidc.ap-southeast-3.amazonaws.com",
   210  				CredentialScope: endpoints.CredentialScope{
   211  					Region: "ap-southeast-3",
   212  				},
   213  			},
   214  			endpoints.EndpointKey{
   215  				Region: "ap-southeast-4",
   216  			}: endpoints.Endpoint{
   217  				Hostname: "oidc.ap-southeast-4.amazonaws.com",
   218  				CredentialScope: endpoints.CredentialScope{
   219  					Region: "ap-southeast-4",
   220  				},
   221  			},
   222  			endpoints.EndpointKey{
   223  				Region: "ca-central-1",
   224  			}: endpoints.Endpoint{
   225  				Hostname: "oidc.ca-central-1.amazonaws.com",
   226  				CredentialScope: endpoints.CredentialScope{
   227  					Region: "ca-central-1",
   228  				},
   229  			},
   230  			endpoints.EndpointKey{
   231  				Region: "eu-central-1",
   232  			}: endpoints.Endpoint{
   233  				Hostname: "oidc.eu-central-1.amazonaws.com",
   234  				CredentialScope: endpoints.CredentialScope{
   235  					Region: "eu-central-1",
   236  				},
   237  			},
   238  			endpoints.EndpointKey{
   239  				Region: "eu-central-2",
   240  			}: endpoints.Endpoint{
   241  				Hostname: "oidc.eu-central-2.amazonaws.com",
   242  				CredentialScope: endpoints.CredentialScope{
   243  					Region: "eu-central-2",
   244  				},
   245  			},
   246  			endpoints.EndpointKey{
   247  				Region: "eu-north-1",
   248  			}: endpoints.Endpoint{
   249  				Hostname: "oidc.eu-north-1.amazonaws.com",
   250  				CredentialScope: endpoints.CredentialScope{
   251  					Region: "eu-north-1",
   252  				},
   253  			},
   254  			endpoints.EndpointKey{
   255  				Region: "eu-south-1",
   256  			}: endpoints.Endpoint{
   257  				Hostname: "oidc.eu-south-1.amazonaws.com",
   258  				CredentialScope: endpoints.CredentialScope{
   259  					Region: "eu-south-1",
   260  				},
   261  			},
   262  			endpoints.EndpointKey{
   263  				Region: "eu-west-1",
   264  			}: endpoints.Endpoint{
   265  				Hostname: "oidc.eu-west-1.amazonaws.com",
   266  				CredentialScope: endpoints.CredentialScope{
   267  					Region: "eu-west-1",
   268  				},
   269  			},
   270  			endpoints.EndpointKey{
   271  				Region: "eu-west-2",
   272  			}: endpoints.Endpoint{
   273  				Hostname: "oidc.eu-west-2.amazonaws.com",
   274  				CredentialScope: endpoints.CredentialScope{
   275  					Region: "eu-west-2",
   276  				},
   277  			},
   278  			endpoints.EndpointKey{
   279  				Region: "eu-west-3",
   280  			}: endpoints.Endpoint{
   281  				Hostname: "oidc.eu-west-3.amazonaws.com",
   282  				CredentialScope: endpoints.CredentialScope{
   283  					Region: "eu-west-3",
   284  				},
   285  			},
   286  			endpoints.EndpointKey{
   287  				Region: "il-central-1",
   288  			}: endpoints.Endpoint{
   289  				Hostname: "oidc.il-central-1.amazonaws.com",
   290  				CredentialScope: endpoints.CredentialScope{
   291  					Region: "il-central-1",
   292  				},
   293  			},
   294  			endpoints.EndpointKey{
   295  				Region: "me-central-1",
   296  			}: endpoints.Endpoint{
   297  				Hostname: "oidc.me-central-1.amazonaws.com",
   298  				CredentialScope: endpoints.CredentialScope{
   299  					Region: "me-central-1",
   300  				},
   301  			},
   302  			endpoints.EndpointKey{
   303  				Region: "me-south-1",
   304  			}: endpoints.Endpoint{
   305  				Hostname: "oidc.me-south-1.amazonaws.com",
   306  				CredentialScope: endpoints.CredentialScope{
   307  					Region: "me-south-1",
   308  				},
   309  			},
   310  			endpoints.EndpointKey{
   311  				Region: "sa-east-1",
   312  			}: endpoints.Endpoint{
   313  				Hostname: "oidc.sa-east-1.amazonaws.com",
   314  				CredentialScope: endpoints.CredentialScope{
   315  					Region: "sa-east-1",
   316  				},
   317  			},
   318  			endpoints.EndpointKey{
   319  				Region: "us-east-1",
   320  			}: endpoints.Endpoint{
   321  				Hostname: "oidc.us-east-1.amazonaws.com",
   322  				CredentialScope: endpoints.CredentialScope{
   323  					Region: "us-east-1",
   324  				},
   325  			},
   326  			endpoints.EndpointKey{
   327  				Region: "us-east-2",
   328  			}: endpoints.Endpoint{
   329  				Hostname: "oidc.us-east-2.amazonaws.com",
   330  				CredentialScope: endpoints.CredentialScope{
   331  					Region: "us-east-2",
   332  				},
   333  			},
   334  			endpoints.EndpointKey{
   335  				Region: "us-west-1",
   336  			}: endpoints.Endpoint{
   337  				Hostname: "oidc.us-west-1.amazonaws.com",
   338  				CredentialScope: endpoints.CredentialScope{
   339  					Region: "us-west-1",
   340  				},
   341  			},
   342  			endpoints.EndpointKey{
   343  				Region: "us-west-2",
   344  			}: endpoints.Endpoint{
   345  				Hostname: "oidc.us-west-2.amazonaws.com",
   346  				CredentialScope: endpoints.CredentialScope{
   347  					Region: "us-west-2",
   348  				},
   349  			},
   350  		},
   351  	},
   352  	{
   353  		ID: "aws-cn",
   354  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   355  			{
   356  				Variant: endpoints.DualStackVariant,
   357  			}: {
   358  				Hostname:          "oidc.{region}.api.amazonwebservices.com.cn",
   359  				Protocols:         []string{"https"},
   360  				SignatureVersions: []string{"v4"},
   361  			},
   362  			{
   363  				Variant: endpoints.FIPSVariant,
   364  			}: {
   365  				Hostname:          "oidc-fips.{region}.amazonaws.com.cn",
   366  				Protocols:         []string{"https"},
   367  				SignatureVersions: []string{"v4"},
   368  			},
   369  			{
   370  				Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
   371  			}: {
   372  				Hostname:          "oidc-fips.{region}.api.amazonwebservices.com.cn",
   373  				Protocols:         []string{"https"},
   374  				SignatureVersions: []string{"v4"},
   375  			},
   376  			{
   377  				Variant: 0,
   378  			}: {
   379  				Hostname:          "oidc.{region}.amazonaws.com.cn",
   380  				Protocols:         []string{"https"},
   381  				SignatureVersions: []string{"v4"},
   382  			},
   383  		},
   384  		RegionRegex:    partitionRegexp.AwsCn,
   385  		IsRegionalized: true,
   386  		Endpoints: endpoints.Endpoints{
   387  			endpoints.EndpointKey{
   388  				Region: "cn-north-1",
   389  			}: endpoints.Endpoint{
   390  				Hostname: "oidc.cn-north-1.amazonaws.com.cn",
   391  				CredentialScope: endpoints.CredentialScope{
   392  					Region: "cn-north-1",
   393  				},
   394  			},
   395  			endpoints.EndpointKey{
   396  				Region: "cn-northwest-1",
   397  			}: endpoints.Endpoint{
   398  				Hostname: "oidc.cn-northwest-1.amazonaws.com.cn",
   399  				CredentialScope: endpoints.CredentialScope{
   400  					Region: "cn-northwest-1",
   401  				},
   402  			},
   403  		},
   404  	},
   405  	{
   406  		ID: "aws-iso",
   407  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   408  			{
   409  				Variant: endpoints.FIPSVariant,
   410  			}: {
   411  				Hostname:          "oidc-fips.{region}.c2s.ic.gov",
   412  				Protocols:         []string{"https"},
   413  				SignatureVersions: []string{"v4"},
   414  			},
   415  			{
   416  				Variant: 0,
   417  			}: {
   418  				Hostname:          "oidc.{region}.c2s.ic.gov",
   419  				Protocols:         []string{"https"},
   420  				SignatureVersions: []string{"v4"},
   421  			},
   422  		},
   423  		RegionRegex:    partitionRegexp.AwsIso,
   424  		IsRegionalized: true,
   425  	},
   426  	{
   427  		ID: "aws-iso-b",
   428  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   429  			{
   430  				Variant: endpoints.FIPSVariant,
   431  			}: {
   432  				Hostname:          "oidc-fips.{region}.sc2s.sgov.gov",
   433  				Protocols:         []string{"https"},
   434  				SignatureVersions: []string{"v4"},
   435  			},
   436  			{
   437  				Variant: 0,
   438  			}: {
   439  				Hostname:          "oidc.{region}.sc2s.sgov.gov",
   440  				Protocols:         []string{"https"},
   441  				SignatureVersions: []string{"v4"},
   442  			},
   443  		},
   444  		RegionRegex:    partitionRegexp.AwsIsoB,
   445  		IsRegionalized: true,
   446  	},
   447  	{
   448  		ID: "aws-iso-e",
   449  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   450  			{
   451  				Variant: endpoints.FIPSVariant,
   452  			}: {
   453  				Hostname:          "oidc-fips.{region}.cloud.adc-e.uk",
   454  				Protocols:         []string{"https"},
   455  				SignatureVersions: []string{"v4"},
   456  			},
   457  			{
   458  				Variant: 0,
   459  			}: {
   460  				Hostname:          "oidc.{region}.cloud.adc-e.uk",
   461  				Protocols:         []string{"https"},
   462  				SignatureVersions: []string{"v4"},
   463  			},
   464  		},
   465  		RegionRegex:    partitionRegexp.AwsIsoE,
   466  		IsRegionalized: true,
   467  	},
   468  	{
   469  		ID: "aws-iso-f",
   470  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   471  			{
   472  				Variant: endpoints.FIPSVariant,
   473  			}: {
   474  				Hostname:          "oidc-fips.{region}.csp.hci.ic.gov",
   475  				Protocols:         []string{"https"},
   476  				SignatureVersions: []string{"v4"},
   477  			},
   478  			{
   479  				Variant: 0,
   480  			}: {
   481  				Hostname:          "oidc.{region}.csp.hci.ic.gov",
   482  				Protocols:         []string{"https"},
   483  				SignatureVersions: []string{"v4"},
   484  			},
   485  		},
   486  		RegionRegex:    partitionRegexp.AwsIsoF,
   487  		IsRegionalized: true,
   488  	},
   489  	{
   490  		ID: "aws-us-gov",
   491  		Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
   492  			{
   493  				Variant: endpoints.DualStackVariant,
   494  			}: {
   495  				Hostname:          "oidc.{region}.api.aws",
   496  				Protocols:         []string{"https"},
   497  				SignatureVersions: []string{"v4"},
   498  			},
   499  			{
   500  				Variant: endpoints.FIPSVariant,
   501  			}: {
   502  				Hostname:          "oidc-fips.{region}.amazonaws.com",
   503  				Protocols:         []string{"https"},
   504  				SignatureVersions: []string{"v4"},
   505  			},
   506  			{
   507  				Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
   508  			}: {
   509  				Hostname:          "oidc-fips.{region}.api.aws",
   510  				Protocols:         []string{"https"},
   511  				SignatureVersions: []string{"v4"},
   512  			},
   513  			{
   514  				Variant: 0,
   515  			}: {
   516  				Hostname:          "oidc.{region}.amazonaws.com",
   517  				Protocols:         []string{"https"},
   518  				SignatureVersions: []string{"v4"},
   519  			},
   520  		},
   521  		RegionRegex:    partitionRegexp.AwsUsGov,
   522  		IsRegionalized: true,
   523  		Endpoints: endpoints.Endpoints{
   524  			endpoints.EndpointKey{
   525  				Region: "us-gov-east-1",
   526  			}: endpoints.Endpoint{
   527  				Hostname: "oidc.us-gov-east-1.amazonaws.com",
   528  				CredentialScope: endpoints.CredentialScope{
   529  					Region: "us-gov-east-1",
   530  				},
   531  			},
   532  			endpoints.EndpointKey{
   533  				Region: "us-gov-west-1",
   534  			}: endpoints.Endpoint{
   535  				Hostname: "oidc.us-gov-west-1.amazonaws.com",
   536  				CredentialScope: endpoints.CredentialScope{
   537  					Region: "us-gov-west-1",
   538  				},
   539  			},
   540  		},
   541  	},
   542  }
   543  

View as plain text