Sha256: d6dd14cbb10dfdea7e32f1d634acff975c718e562be32836bb7a227ac1127e98

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

module Yao::Resources
  class Port < Base

    include NetworkAssociationable
    include ProjectAssociationable

    friendly_attributes :name, :mac_address, :status, :allowed_address_pairs,
                        :device_owner, :fixed_ips, :security_groups, :device_id,
                        :admin_state_up
    map_attribute_to_attribute "binding:host_id" => :host_id

    # @return [String]
    def primary_ip
      fixed_ips.first["ip_address"]
    end

    # @return [Yao::Resources::Subnet]
    def primary_subnet
      @subnet ||= Yao::Subnet.find fixed_ips.first["subnet_id"]
    end

    self.service        = "network"
    self.resource_name  = "port"
    self.resources_name = "ports"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yao-0.17.0 lib/yao/resources/port.rb
yao-0.16.0 lib/yao/resources/port.rb