Sha256: 7083998a2b7763362d4b295af9a99467e7eab7aefc8caf7c71b5028c1d473604

Contents?: true

Size: 1.04 KB

Versions: 43

Compression:

Stored size: 1.04 KB

Contents

require 'fog/core'
require 'fog/json'

module Fog
  module Clodo
    extend Fog::Provider

    service(:compute, 'Compute')

    def self.authenticate(options)
      clodo_auth_url = options[:clodo_auth_url] || "api.clodo.ru"
      url = clodo_auth_url.match(/^https?:/) ? \
                clodo_auth_url : 'https://' + clodo_auth_url
      uri = URI.parse(url)
      connection = Fog::XML::Connection.new(url)
      @clodo_api_key  = options[:clodo_api_key]
      @clodo_username = options[:clodo_username]
      response = connection.request({
        :expects  => [200, 204],
        :headers  => {
          'X-Auth-Key'  => @clodo_api_key,
          'X-Auth-User' => @clodo_username
        },
        :host     => uri.host,
        :method   => 'GET',
        :path     =>  (uri.path and not uri.path.empty?) ? uri.path : 'v1.0'
      })
      response.headers.reject do |key, value|
        !['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
      end
    end # authenticate
  end # module Clodo
end # module Fog

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 lib/fog/clodo/core.rb
fog-ifeel-2.2.0 lib/fog/clodo/core.rb
fog-2.2.0 lib/fog/clodo/core.rb
fog-2.1.0 lib/fog/clodo/core.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/clodo/core.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/clodo/core.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/clodo/core.rb
fog-1.42.1 lib/fog/clodo/core.rb
fog-2.0.0 lib/fog/clodo/core.rb
fog-1.42.0 lib/fog/clodo/core.rb
fog-1.41.0 lib/fog/clodo/core.rb
fog-1.40.0 lib/fog/clodo/core.rb
fog-1.39.0 lib/fog/clodo/core.rb
fog-1.38.0 lib/fog/clodo/core.rb
fog-1.37.0 lib/fog/clodo/core.rb
fog-1.36.0 lib/fog/clodo/core.rb
fog-1.35.0 lib/fog/clodo/core.rb
fog-2.0.0.pre.0 lib/fog/clodo/core.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/clodo/core.rb
fog-1.34.0 lib/fog/clodo/core.rb