Class: Fog::Baremetal::OpenStack::Ports

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/openstack/models/baremetal/ports.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/fog/openstack/models/baremetal/ports.rb', line 28

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

Instance Method Details

#allObject



10
11
12
# File 'lib/fog/openstack/models/baremetal/ports.rb', line 10

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

#destroy(uuid) ⇒ Object



23
24
25
26
# File 'lib/fog/openstack/models/baremetal/ports.rb', line 23

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

#details(parameters = nil) ⇒ Object



14
15
16
# File 'lib/fog/openstack/models/baremetal/ports.rb', line 14

def details(parameters=nil)
  load(service.list_ports_detailed(parameters).body['ports'])
end

#find_by_uuid(uuid) ⇒ Object Also known as: get



18
19
20
# File 'lib/fog/openstack/models/baremetal/ports.rb', line 18

def find_by_uuid(uuid)
  new(service.get_port(uuid).body)
end