def initialize(options = {:retry_auth => true})
@retries = options[:retries] || 3
@authuser = options[:username] || (raise Exception::MissingArgument, "Must supply a :username")
@authkey = options[:api_key] || (raise Exception::MissingArgument, "Must supply an :api_key")
@auth_url = options[:auth_url] || (raise Exception::MissingArgument, "Must supply an :auth_url")
@authtenant = (options[:authtenant_id])? {:type => "tenantId", :value=>options[:authtenant_id]} : {:type=>"tenantName", :value=>(options[:authtenant_name] || options[:authtenant] || @authuser)}
@auth_method = options[:auth_method] || "password"
@service_name = options[:service_name] || nil
@service_type = options[:service_type] || "compute"
@user_domain_id = options[:user_domain_id] || "default"
@user_domain = options[:user_domain] || nil
@project_id = options[:project_id] || nil
@project_name = options[:project_name] || nil
@logger = options[:logger] || nil
@project_domain_name = options[:project_domain_name] || nil
@project_domain_id = options[:project_domain_id] || nil
@domain_name = options[:domain_name] || nil
@domain_id = options[:domain_id] || nil
@region = options[:region] || @region = nil
@regions_list = {}
@is_debug = options[:is_debug]
auth_uri=nil
begin
auth_uri=URI.parse(@auth_url)
rescue Exception => e
raise Exception::InvalidArgument, "Invalid :auth_url parameter: #{e.message}"
end
raise Exception::InvalidArgument, "Invalid :auth_url parameter." if auth_uri.nil? or auth_uri.host.nil?
@auth_host = auth_uri.host
@auth_port = auth_uri.port
@auth_scheme = auth_uri.scheme
@auth_path = auth_uri.path
@retry_auth = options[:retry_auth]
@proxy_host = options[:proxy_host]
@proxy_port = options[:proxy_port]
@ca_cert = options[:ca_cert]
@ssl_version = options[:ssl_version]
@authok = false
@http = {}
@quantum_version = 'v2.0' if @service_type == 'network'
@quantum_version = 'v2' if @service_type == 'metering'
@endpoint_type = options[:endpoint_type] || "publicURL"
@semaphore = Mutex.new
end