class Deltacloud::InstanceAddress

Attributes

address[RW]
address_type[RW]
port[RW]

Public Class Methods

new(address, opts={}) click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 25
def initialize(address, opts={})
  self.address = address
  self.port = opts[:port] if opts[:port]
  self.address_type = opts[:type] || :ipv4
  self
end

Public Instance Methods

is_hostname?() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 62
def is_hostname?
  address_type == :hostname
end
is_ipv4?() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 54
def is_ipv4?
  address_type == :ipv4
end
is_ipv6?() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 58
def is_ipv6?
  address_type == :ipv6
end
is_mac?() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 50
def is_mac?
  address_type == :mac
end
is_vnc?() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 66
def is_vnc?
  address_type == :vnc
end
to_hash(context) click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 41
def to_hash(context)
  r = {
    :address => address,
    :type => address_type
  }
  r.merge!(:port => port) if !port.nil?
  r
end
to_s() click to toggle source
# File lib/deltacloud/models/instance_address.rb, line 36
def to_s
  return ['VNC', address, port].join(':') if is_vnc?
  address
end