class Fog::Identity::OpenStack::Real

Constants

DEFAULT_SERVICE_TYPE
DEFAULT_SERVICE_TYPE_V3

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/identity/openstack.rb, line 54
def initialize(options = {})
  if options.respond_to?(:config_service?) && options.config_service?
    configure(options)
    return
  end

  initialize_identity(options)

  @openstack_service_type   = options[:openstack_service_type] || default_service_type(options)
  @openstack_service_name   = options[:openstack_service_name]

  @connection_options       = options[:connection_options] || {}

  @openstack_endpoint_type  = options[:openstack_endpoint_type] || 'adminURL'
  initialize_endpoint_path_matches(options)

  authenticate

  if options[:openstack_identity_prefix]
    @path = "/#{options[:openstack_identity_prefix]}/#{@path}"
  end

  @persistent = options[:persistent] || false
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end
not_found_class() click to toggle source
# File lib/fog/identity/openstack.rb, line 50
def self.not_found_class
  Fog::Identity::OpenStack::NotFound
end

Public Instance Methods

config() click to toggle source
# File lib/fog/identity/openstack.rb, line 84
def config
  self
end
config_service?() click to toggle source
# File lib/fog/identity/openstack.rb, line 80
def config_service?
  true
end

Private Instance Methods

configure(source) click to toggle source
# File lib/fog/identity/openstack.rb, line 106
def configure(source)
  source.instance_variables.each do |v|
    instance_variable_set(v, source.instance_variable_get(v))
  end
end
default_service_type(options) click to toggle source
# File lib/fog/identity/openstack.rb, line 90
def default_service_type(options)
  unless options[:openstack_identity_prefix]
    if @openstack_auth_uri.path =~ %r{/v3} ||
       (options[:openstack_endpoint_path_matches] && options[:openstack_endpoint_path_matches] =~ '/v3')
      return DEFAULT_SERVICE_TYPE_V3
    end
  end
  DEFAULT_SERVICE_TYPE
end
initialize_endpoint_path_matches(options) click to toggle source
# File lib/fog/identity/openstack.rb, line 100
def initialize_endpoint_path_matches(options)
  if options[:openstack_endpoint_path_matches]
    @openstack_endpoint_path_matches = options[:openstack_endpoint_path_matches]
  end
end