Class: Bosh::Director::ExistingNetworkReservation

Inherits:
NetworkReservation show all
Defined in:
lib/bosh/director/network_reservation.rb

Instance Attribute Summary collapse

Attributes inherited from NetworkReservation

#instance_model, #ip, #network, #type

Instance Method Summary collapse

Methods inherited from NetworkReservation

#dynamic?, #mark_reserved, #reserved?, #resolve_network, #static?

Methods included from IpUtil

#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr

Constructor Details

#initialize(instance_model, network, ip, network_type) ⇒ ExistingNetworkReservation

Returns a new instance of ExistingNetworkReservation.



44
45
46
47
48
# File 'lib/bosh/director/network_reservation.rb', line 44

def initialize(instance_model, network, ip, network_type)
  super(instance_model, network)
  @ip = ip_to_i(ip) if ip
  @network_type = network_type
end

Instance Attribute Details

#network_typeObject (readonly)

Returns the value of attribute network_type.



42
43
44
# File 'lib/bosh/director/network_reservation.rb', line 42

def network_type
  @network_type
end

Instance Method Details

#descObject



54
55
56
# File 'lib/bosh/director/network_reservation.rb', line 54

def desc
  "existing reservation#{@ip.nil? ? '' : " with IP '#{formatted_ip}' for instance #{@instance_model}"}"
end

#resolve_type(type) ⇒ Object



50
51
52
# File 'lib/bosh/director/network_reservation.rb', line 50

def resolve_type(type)
  @type = type
end

#to_sObject



58
59
60
# File 'lib/bosh/director/network_reservation.rb', line 58

def to_s
  "{ip=#{formatted_ip}, network=#{@network.name}, instance=#{@instance_model}, reserved=#{reserved?}, type=#{type}}"
end