Sha256: 6eb6286c73399e30263c66041f636e68c88bbb5733444039a67295f81ac7ae49

Contents?: true

Size: 691 Bytes

Versions: 5

Compression:

Stored size: 691 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/network/port'

module Fog
  module Network
    class OpenStack
      class Ports < Fog::Collection
        attribute :filters

        model Fog::Network::OpenStack::Port

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load(service.list_ports(filters).body['ports'])
        end

        def get(port_id)
          if port = service.get_port(port_id).body['port']
            new(port)
          end
        rescue Fog::Network::OpenStack::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-1.31.0 lib/fog/openstack/models/network/ports.rb
fog-1.30.0 lib/fog/openstack/models/network/ports.rb
fog-1.29.0 lib/fog/openstack/models/network/ports.rb
fog-1.28.0 lib/fog/openstack/models/network/ports.rb
fog-1.27.0 lib/fog/openstack/models/network/ports.rb