Sha256: 34adf78cdda2659c5851a8d12b4bd74a602e72846a65486fd7bb4c82cc281ea1

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 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 = filters)
          self.filters = filters
          load(connection.list_ports(filters).body['ports'])
        end

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

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 5 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/openstack/models/network/ports.rb
fog-nirvanix-1.8.1 lib/fog/openstack/models/network/ports.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/models/network/ports.rb
fog-sgonyea-1.8.1 lib/fog/openstack/models/network/ports.rb
fog-1.8.0 lib/fog/openstack/models/network/ports.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/openstack/models/network/ports.rb
fog-1.7.0 lib/fog/openstack/models/network/ports.rb