def initialize(options={})
@hp_secret_key = options[:hp_secret_key]
@hp_account_id = options[:hp_account_id]
@hp_servicenet = options[:hp_servicenet]
@connection_options = options[:connection_options] || {}
auth_version = options[:hp_auth_version] || :v2
options[:hp_service_type] = "compute"
@hp_tenant_id = options[:hp_tenant_id]
if (auth_version == :v2)
credentials = Fog::HP.authenticate_v2(options, @connection_options)
@hp_compute_uri = credentials[:endpoint_url]
else
credentials = Fog::HP.authenticate_v1(options, @connection_options)
@hp_compute_uri = options[:hp_auth_uri]
end
@auth_token = credentials[:auth_token]
uri = URI.parse(@hp_compute_uri)
@host = @hp_servicenet == true ? "snet-#{uri.host}" : uri.host
@path = uri.path
@persistent = options[:persistent] || false
@port = uri.port
@scheme = uri.scheme
Excon.ssl_verify_peer = false if options[:hp_servicenet] == true
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end