Sha256: b146e58eeb67393eb9abfeed988892590af30df0436234b5bab517737edc8703

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

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

module Fog
  module OpenStack
    class Baremetal
      class Ports < Fog::OpenStack::Collection
        model Fog::OpenStack::Baremetal::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 get find_by_uuid

        def destroy(uuid)
          port = 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

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.1.2 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-fork-99 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.1.0 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.1.0.pre lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.11 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.10 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.9 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.8 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.7 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.6 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.5 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.4 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.3 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.2 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.1 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-1.0.0 lib/fog/openstack/baremetal/models/ports.rb
fog-openstack-0.3.1 lib/fog/openstack/baremetal/models/ports.rb