Class: Aws::Partitions::EndpointProvider Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-partitions/endpoint_provider.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

STS_LEGACY_REGIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

When sts_regional_endpoint is set to ‘legacy`, the endpoint pattern stays global for the following regions:

%w[
  ap-northeast-1
  ap-south-1
  ap-southeast-1
  ap-southeast-2
  aws-global
  ca-central-1
  eu-central-1
  eu-north-1
  eu-west-1
  eu-west-2
  eu-west-3
  sa-east-1
  us-east-1
  us-east-2
  us-west-1
  us-west-2
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rules) ⇒ EndpointProvider

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Intentionally marked private. The format of the endpoint rules is an implementation detail.



31
32
33
# File 'lib/aws-partitions/endpoint_provider.rb', line 31

def initialize(rules)
  @rules = rules
end

Class Method Details

.dns_suffix_for(region, service = nil, variants = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



256
257
258
# File 'lib/aws-partitions/endpoint_provider.rb', line 256

def dns_suffix_for(region, service = nil, variants = {})
  default_provider.dns_suffix_for(region, service, variants)
end

.resolve(region, service, sts_endpoint = 'regional', variants = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



244
245
246
# File 'lib/aws-partitions/endpoint_provider.rb', line 244

def resolve(region, service, sts_endpoint = 'regional', variants = {})
  default_provider.resolve(region, service, sts_endpoint, variants)
end

.signing_region(region, service, sts_regional_endpoints = 'regional') ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



248
249
250
# File 'lib/aws-partitions/endpoint_provider.rb', line 248

def signing_region(region, service, sts_regional_endpoints = 'regional')
  default_provider.signing_region(region, service, sts_regional_endpoints)
end

.signing_service(region, service) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



252
253
254
# File 'lib/aws-partitions/endpoint_provider.rb', line 252

def signing_service(region, service)
  default_provider.signing_service(region, service)
end

Instance Method Details

#dns_suffix_for(region, service, variants) ⇒ Object

Parameters:

  • region (String)

    The region used to fetch the partition.

  • service (String)

    Used only if dualstack is true. Used to find a DNS suffix for a specific service.

  • variants (Hash)

    Endpoint variants such as ‘fips’ or ‘dualstack’

Options Hash (variants):

  • :dualstack (Boolean)

    When true, resolve a dualstack endpoint.

  • :fips (Boolean)

    When true, resolve a FIPS endpoint.



73
74
75
76
77
78
79
# File 'lib/aws-partitions/endpoint_provider.rb', line 73

def dns_suffix_for(region, service, variants)
  if configured_variants?(variants)
    resolve_variant(region, service, variants)['dnsSuffix']
  else
    get_partition(region)['dnsSuffix']
  end
end

#resolve(region, service, sts_regional_endpoints, variants) ⇒ Object

Parameters:

  • region (String)

    The region for the client.

  • service (String)

    The endpoint prefix for the service, e.g. “monitoring” for cloudwatch.

  • sts_regional_endpoints (String)
    STS only

    Whether to use

    ‘legacy` (global endpoint for legacy regions) or `regional` mode for using regional endpoint for supported regions except ’aws-global’

  • variants (Hash)

    Endpoint variants such as ‘fips’ or ‘dualstack’

Options Hash (variants):

  • :dualstack (Boolean)

    When true, resolve a dualstack endpoint.

  • :fips (Boolean)

    When true, resolve a FIPS endpoint.



46
47
48
# File 'lib/aws-partitions/endpoint_provider.rb', line 46

def resolve(region, service, sts_regional_endpoints, variants)
  'https://' + endpoint_for(region, service, build_is_global_fn(sts_regional_endpoints), variants)
end

#signing_region(region, service, sts_regional_endpoints) ⇒ Object



51
52
53
54
# File 'lib/aws-partitions/endpoint_provider.rb', line 51

def signing_region(region, service, sts_regional_endpoints)
  credential_scope(region, service, build_is_global_fn(sts_regional_endpoints))
    .fetch('region', region)
end

#signing_service(region, service) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/aws-partitions/endpoint_provider.rb', line 57

def signing_service(region, service)
  # don't default to the service name
  # signers should prefer the api metadata's signingName
  # if no service is set in the credentialScope
  credential_scope(region, service, build_is_global_fn('regional'))
    .fetch('service', nil)
end