Sha256: a2f72a2375cc3df51fb7ba37aa6f4ae81b20714277aa6d2671cd6b2c46055e64

Contents?: true

Size: 1.22 KB

Versions: 62

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Compute
    class Ecloud
      class IpAddress < Fog::Ecloud::Model
        identity :href

        attribute :name, :aliases => :Name
        attribute :type, :aliases => :Type
        attribute :other_links, :aliases => :Links, :squash => :Link
        attribute :host, :aliases => :Host
        attribute :detected_on, :aliases => :DetectedOn
        attribute :rnat, :aliases => :RnatAddress
        attribute :reserved, :aliases => :Reserved, :type => :boolean

        def status
          (detected_on || host) ? "Assigned" : "Available"
        end

        def id
          href.match(/((\d+{1,3}\.){3}(\d+{1,3}))$/)[1]
        end

        def server
          @server ||= begin
                        reload unless other_links
                        server_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.virtualMachine"}
                        self.service.servers.get(server_link[:href])
                      end
        end

        def network
          reload if other_links.nil?
          network_href = other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.network" }[:href]
          network      = self.service.networks.get(network_href)
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 6 rubygems

Version Path
fog-1.22.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.21.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.20.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.19.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/ecloud/models/compute/ip_address.rb