Class: Fog::Orchestration::OpenStack::Resources

Inherits:
Fog::OpenStack::Collection show all
Defined in:
lib/fog/orchestration/openstack/models/resources.rb

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #load_response, #summary

Instance Method Details

#all(options = {}, deprecated_options = {}) ⇒ Object



14
15
16
17
# File 'lib/fog/orchestration/openstack/models/resources.rb', line 14

def all(options = {}, deprecated_options = {})
  data = service.list_resources(options, deprecated_options)
  load_response(data, 'resources')
end

#get(resource_name, stack = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/fog/orchestration/openstack/models/resources.rb', line 19

def get(resource_name, stack = nil)
  stack = first.stack if stack.nil?
  data  = service.show_resource_data(stack.stack_name, stack.id, resource_name).body['resource']
  new(data)
rescue Fog::Compute::OpenStack::NotFound
  nil
end

#metadata(stack_name, stack_id, resource_name) ⇒ Object



27
28
29
30
31
# File 'lib/fog/orchestration/openstack/models/resources.rb', line 27

def (stack_name, stack_id, resource_name)
  service.(stack_name, stack_id, resource_name).body['resource']
rescue Fog::Compute::OpenStack::NotFound
  nil
end

#typesObject



10
11
12
# File 'lib/fog/orchestration/openstack/models/resources.rb', line 10

def types
  service.list_resource_types.body['resource_types'].sort
end