Sha256: 68bd5469bec49f3ebd1149d1a54fda52442c13ca4c98cd0892b4735178c719e5

Contents?: true

Size: 875 Bytes

Versions: 59

Compression:

Stored size: 875 Bytes

Contents

require 'fog/core'
require 'uri'

module Fog
  module Cloudstack

    extend Fog::Provider

    service(:compute, 'cloudstack/compute','Compute')

    @@digest  = OpenSSL::Digest::Digest.new('sha1')

    def self.escape(string)
      string = CGI::escape(string)
      string = string.gsub("+","%20")
      string
    end

    def self.signed_params(key,params)
      query = params.map{|k,v| [k.to_s, v]}.sort.collect{|c| "#{c[0]}=#{escape(c[1].to_s)}"}.join('&').downcase

      signed_string = Base64.encode64(OpenSSL::HMAC.digest(@@digest,key,query)).strip

      signed_string
    end

    def self.uuid
      [8,4,4,4,12].map{|i| Fog::Mock.random_hex(i)}.join("-")
    end

    def self.ip_address
      4.times.map{ Fog::Mock.random_numbers(3) }.join(".")
    end

    def self.mac_address
      6.times.map{ Fog::Mock.random_numbers(2) }.join(":")
    end
  end
end

Version data entries

59 entries across 59 versions & 11 rubygems

Version Path
fog-maestrodev-1.18.0.20131209091424 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/cloudstack.rb
gapinc-fog-1.12.1.2.1 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/cloudstack.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/cloudstack.rb
fog-1.18.0 lib/fog/cloudstack.rb
fog-1.17.0 lib/fog/cloudstack.rb