class Fog::Identity::HuaweiCloud::Real

Constants

DEFAULT_SERVICE_TYPE
DEFAULT_SERVICE_TYPE_V3

Public Class Methods

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

  initialize_identity(options)

  @huaweicloud_service_type   = options[:huaweicloud_service_type] || default_service_type(options)
  @huaweicloud_service_name   = options[:huaweicloud_service_name]

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

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

  authenticate

  if options[:huaweicloud_identity_prefix]
    @path = "/#{options[:huaweicloud_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/huaweicloud.rb, line 53
def self.not_found_class
  Fog::Identity::HuaweiCloud::NotFound
end

Public Instance Methods

config() click to toggle source
# File lib/fog/identity/huaweicloud.rb, line 87
def config
  self
end
config_service?() click to toggle source
# File lib/fog/identity/huaweicloud.rb, line 83
def config_service?
  true
end

Private Instance Methods

configure(source) click to toggle source
# File lib/fog/identity/huaweicloud.rb, line 109
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/huaweicloud.rb, line 93
def default_service_type(options)
  unless options[:huaweicloud_identity_prefix]
    if @huaweicloud_auth_uri.path =~ %r{/v3} ||
       (options[:huaweicloud_endpoint_path_matches] && options[:huaweicloud_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/huaweicloud.rb, line 103
def initialize_endpoint_path_matches(options)
  if options[:huaweicloud_endpoint_path_matches]
    @huaweicloud_endpoint_path_matches = options[:huaweicloud_endpoint_path_matches]
  end
end