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

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

Instance Attribute Summary

Attributes inherited from Collection

#response

Instance Method Summary collapse

Methods inherited from Collection

#find_by_id, #load_response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



34
35
36
37
38
39
40
# File 'lib/fog/openstack/baremetal/models/ports.rb', line 34

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

#all(options = {}) ⇒ Object



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

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

#destroy(uuid) ⇒ Object



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

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

#details(options = {}) ⇒ Object



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

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

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



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

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

#summary(options = {}) ⇒ Object



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

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