class Yao::Resources::Port

Public Instance Methods

floating_ip() click to toggle source

@return [Yao::FloatingIP]

# File lib/yao/resources/port.rb, line 23
def floating_ip
  # notice: port が floating_ip を持たない場合has_floating_ip? を呼び出す度に
  # Yao::FloatingIP.list を評価しなくていいように defined? を入れている
  if defined?(@floating_ip)
    @floating_ip
  else
    @floating_ip = Yao::FloatingIP.list(port_id: id).first
  end
end
has_floating_ip?() click to toggle source

@return [Bool]

# File lib/yao/resources/port.rb, line 34
def has_floating_ip?
  !!floating_ip
end
primary_ip() click to toggle source

@return [String]

# File lib/yao/resources/port.rb, line 13
def primary_ip
  fixed_ips.first["ip_address"]
end
primary_subnet() click to toggle source

@return [Yao::Resources::Subnet]

# File lib/yao/resources/port.rb, line 18
def primary_subnet
  @subnet ||= Yao::Subnet.find fixed_ips.first["subnet_id"]
end