Sha256: 54e867e549966e4dee8a3e55e83ef4c004deab6db08e0f5c15d616127364e15f

Contents?: true

Size: 1.04 KB

Versions: 83

Compression:

Stored size: 1.04 KB

Contents

require 'fog/core'

module Fog
  module Clodo

    extend Fog::Provider

    service(:compute, 'clodo/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::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

83 entries across 83 versions & 15 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/clodo.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/clodo.rb
fog-1.19.0 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/clodo.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/clodo.rb