Sha256: 80e8b9252e38703fb91c13f65ac9b72b15d6173da0b1aa6a65c9ec8618e42e8c

Contents?: true

Size: 841 Bytes

Versions: 4

Compression:

Stored size: 841 Bytes

Contents

require 'fog/ecloud/models/compute/public_ip'

module Fog
  module Compute
    class Ecloud
      class PublicIps < Fog::Ecloud::Collection

        identity :href

        model Fog::Compute::Ecloud::PublicIp

        def all
          data = service.get_public_ips(href).body
          data = data[:PublicIp] ? data[:PublicIp] : data
          load(data)
        end

        def get(uri)
          data = service.get_public_ip(uri).body
          if data == ""
            new({})
          else
            new(data)
          end
        rescue Fog::Errors::NotFound
          nil
        end

        def activate
          data = service.public_ip_activate(href + "/action/activatePublicIp").body
          ip = Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => data[:href])[0]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-1.9.0 lib/fog/ecloud/models/compute/public_ips.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/ecloud/models/compute/public_ips.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/ecloud/models/compute/public_ips.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/ecloud/models/compute/public_ips.rb