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-maestrodev-1.15.0.20130927082724 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.15.0 lib/fog/ecloud/models/compute/ip_address.rb
gapinc-fog-1.14.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.14.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.13.0 lib/fog/ecloud/models/compute/ip_address.rb
gapinc-fog-1.12.1.2 lib/fog/ecloud/models/compute/ip_address.rb
gapinc-fog-1.12.1.1 lib/fog/ecloud/models/compute/ip_address.rb
gapinc-fog-1.12.1a lib/fog/ecloud/models/compute/ip_address.rb
gapinc-fog-1.12.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.12.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.12.0 lib/fog/ecloud/models/compute/ip_address.rb
hpfog-0.0.20 lib/fog/ecloud/models/compute/ip_address.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/ip_address.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/ip_address.rb
fog-1.11.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.11.0 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.10.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-test-me-1.10.0 lib/fog/ecloud/models/compute/ip_address.rb