Class: Aws::DefaultsModeConfigResolver Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-defaults/defaults_mode_config_resolver.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

CFG_OPTIONS =

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.

mappings from Ruby SDK configuration names to the sdk defaults option names and (optional) scale modifiers

{
  retry_mode: { name: "retryMode" },
  sts_regional_endpoints: { name: "stsRegionalEndpoints" },
  s3_us_east_1_regional_endpoint: { name: "s3UsEast1RegionalEndpoints" },
  http_open_timeout: { name: "connectTimeoutInMillis", scale: 0.001 },
  http_read_timeout: { name: "timeToFirstByteTimeoutInMillis", scale: 0.001 },
  ssl_timeout: { name: "tlsNegotiationTimeoutInMillis", scale: 0.001 }
}.freeze
@@application_region =

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

nil
@@application_region_mutex =

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

Mutex.new
@@imds_client =

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

EC2Metadata.new(retries: 0, http_open_timeout: 0.01)

Instance Method Summary collapse

Constructor Details

#initialize(sdk_defaults, cfg) ⇒ DefaultsModeConfigResolver

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.

Returns a new instance of DefaultsModeConfigResolver.


22
23
24
25
26
27
# File 'lib/aws-defaults/defaults_mode_config_resolver.rb', line 22

def initialize(sdk_defaults, cfg)
  @sdk_defaults = sdk_defaults
  @cfg = cfg
  @resolved_mode = nil
  @mutex = Mutex.new
end

Instance Method Details

#resolve(option_name) ⇒ 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.

option_name should be the symbolized ruby name to resolve returns the ruby appropriate value or nil if none are resolved


31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aws-defaults/defaults_mode_config_resolver.rb', line 31

def resolve(option_name)
  return unless (std_option = CFG_OPTIONS[option_name])
  mode = resolved_mode.downcase

  return nil if mode == 'legacy'

  value = resolve_for_mode(std_option[:name], mode)
  value = value * std_option[:scale] if value && std_option[:scale]

  value
end