module Aws

Constants

API_DIR

@api private

EmptyStructure
SERVICE_MODULE_NAMES

@api private services

VERSION

Attributes

config[R]

@return [Hash] Returns a hash of default configuration options shared

by all constructed clients.

Public Class Methods

add_service(svc_name, options = {}) click to toggle source

Registers a new service.

Aws.add_service('SvcName',
  api: '/path/to/svc.api.json',
  paginators: '/path/to/svc.paginators.json',
  waiters: '/path/to/svc.waiters.json',
  resources: '/path/to/svc.resources.json')

Aws::SvcName::Client.new
#=> #<Aws::SvcName::Client>

@param [String] svc_name The name of the service. This will also be

the namespace under {Aws}. This must be a valid constant name.

@option options :api @option options :paginators @option options :waiters @option options :resources @return [Module<Service>] Returns the new service module.

# File lib/aws-sdk-core.rb, line 344
def add_service(svc_name, options = {})
  svc_module = Module.new { extend Service }
  const_set(svc_name, svc_module)
  @services[svc_name] = [svc_module, options]
  @service_added_callbacks.each do |callback|
    callback.call(svc_name.to_s, *@services[svc_name])
  end
  svc_module
end
config=(config) click to toggle source

@param [Hash] config

# File lib/aws-sdk-core.rb, line 248
def config=(config)
  if Hash === config
    @config = config
  else
    raise ArgumentError, 'configuration object must be a hash'
  end
end
eager_autoload!(options = {}) click to toggle source

Loads modules that are normally loaded with Ruby's `autoload`. This can avoid thread-safety issues that some Ruby versions have with `autoload`.

# loads ALL services
Aws.eager_autoload!

Loading all services can be slow. You can specify what services you want to load with the `:services` option. All services not named will continue to autoload as normal.

Aws.eager_auotload(services: %w(S3 EC2))

@return [void]

# File lib/aws-sdk-core.rb, line 291
def eager_autoload!(options = {})
  eager_loader = EagerLoader.new
  eager_loader.load(JMESPath)
  eager_loader.load(Seahorse)
  sub_modules(options).each do |module_or_class|
    eager_loader.load(module_or_class)
  end
  eager_loader
end
service_added() { |svc_name, svc_module, options| ... } click to toggle source

Yields to the given block for each service that has already been defined via {add_service}. Also yields to the given block for each new service added after the callback is registered. @api private

# File lib/aws-sdk-core.rb, line 318
def service_added(&block)
  callback = Proc.new
  @services.each do |svc_name, (svc_module, options)|
    yield(svc_name, svc_module, options)
  end
  @service_added_callbacks << callback
end
sub_modules(options = {}) click to toggle source
# File lib/aws-sdk-core.rb, line 301
def sub_modules(options = {})
  constants = Aws.constants.map(&:to_s)
  if options[:services]
    constants -= SERVICE_MODULE_NAMES
    constants += options[:services] || SERVICE_MODULE_NAMES
  end
  constants.inject([]) do |modules, const_name|
    constant = Aws.const_get(const_name)
    modules << constant if Module === constant
    modules
  end
end
use_bundled_cert!() click to toggle source

The SDK ships with a ca certificate bundle to use when verifying SSL peer certificates. By default, this cert bundle is NOT used. The SDK will rely on the default cert available to OpenSSL. This ensures the cert provided by your OS is used.

For cases where the default cert is unavailable, e.g. Windows, you can call this method.

Aws.use_bundled_cert!

@return [String] Returns the path to the bundled cert.

# File lib/aws-sdk-core.rb, line 267
def use_bundled_cert!
  config.delete(:ssl_ca_directory)
  config.delete(:ssl_ca_store)
  config[:ssl_ca_bundle] = File.expand_path(File.join(
    File.dirname(__FILE__),
    '..',
    'ca-bundle.crt'
  ))
end