Class: Fog::Baremetal::OpenStack::ChassisCollection

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/baremetal/openstack/models/chassis_collection.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::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/baremetal/openstack/models/chassis_collection.rb', line 34

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

Instance Method Details

#all(options = {}) ⇒ Object



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

def all(options = {})
  load_response(service.list_chassis_detailed(options), 'chassis')
end

#destroy(uuid) ⇒ Object



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

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

#details(options = {}) ⇒ Object



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

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

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



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

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

#summary(options = {}) ⇒ Object



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

def summary(options = {})
  load_response(service.list_chassis(options), 'chassis')
end