Sha256: cb6592f9eb8099b0d1d396deef90f16083a5e3785775a3c81e6f4b2fc8429fdc

Contents?: true

Size: 1.22 KB

Versions: 20

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.find { |l| l[:type] == "application/vnd.tmrk.cloud.network" }[:href]
          network      = self.service.networks.get(network_href)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-ecloud-0.1.1/lib/fog/compute/ecloud/models/ip_address.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ecloud/models/compute/ip_address.rb
fog-ecloud-0.1.1 lib/fog/compute/ecloud/models/ip_address.rb
fog-ecloud-0.1.0 lib/fog/compute/ecloud/models/ip_address.rb
fog-ecloud-0.0.2 lib/fog/ecloud/models/compute/ip_address.rb
fog-ecloud-0.0.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.25.0 lib/fog/ecloud/models/compute/ip_address.rb
nsidc-fog-1.24.1 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.24.0 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.11 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.10 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.9 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.8 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.7 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.6 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.23.0 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.4 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.3 lib/fog/ecloud/models/compute/ip_address.rb
ns-fog-1.22.2 lib/fog/ecloud/models/compute/ip_address.rb
fog-1.22.1 lib/fog/ecloud/models/compute/ip_address.rb