Sha256: 990fc499ba08470e8a56af71ac9cb06e6a304ce9936c521b5769b98c374a07aa

Contents?: true

Size: 1.22 KB

Versions: 17

Compression:

Stored size: 1.22 KB

Contents

require 'fog/openstack/models/collection'
require 'fog/openstack/models/baremetal/port'

module Fog
  module Baremetal
    class OpenStack
      class Ports < Fog::OpenStack::Collection
        model Fog::Baremetal::OpenStack::Port

        def all(options = {})
          load_response(service.list_ports_detailed(options), 'ports')
        end

        def summary(options = {})
          load_response(service.list_ports(options), 'ports')
        end

        def details(options = {})
          Fog::Logger.deprecation("Calling OpenStack[:baremetal].ports.details will be removed, "\
                                  " call .ports.all for detailed list.")
          load(service.list_ports_detailed(options).body['ports'])
        end

        def find_by_uuid(uuid)
          new(service.get_port(uuid).body)
        end
        alias_method :get, :find_by_uuid

        def destroy(uuid)
          port = self.find_by_id(uuid)
          port.destroy
        end

        def method_missing(method_sym, *arguments, &block)
          if method_sym.to_s =~ /^find_by_(.*)$/
            load(service.list_ports_detailed({$1 => arguments.first}).body['ports'])
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.9 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.8 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.7 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.6 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.5 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.4 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.3 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.2 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.1 lib/fog/openstack/models/baremetal/ports.rb
fog-openstack-0.1.0 lib/fog/openstack/models/baremetal/ports.rb
fog-1.37.0 lib/fog/openstack/models/baremetal/ports.rb
fog-1.36.0 lib/fog/openstack/models/baremetal/ports.rb
fog-1.35.0 lib/fog/openstack/models/baremetal/ports.rb
fog-2.0.0.pre.0 lib/fog/openstack/models/baremetal/ports.rb
fog-1.34.0 lib/fog/openstack/models/baremetal/ports.rb
fog-1.33.0 lib/fog/openstack/models/baremetal/ports.rb