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

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

Instance Attribute Summary

Attributes inherited from Collection

#response

Instance Method Summary collapse

Methods inherited from Collection

#destroy, #find_by_id, #load_response, #summary

Instance Method Details

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



14
15
16
17
# File 'lib/fog/openstack/orchestration/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/openstack/orchestration/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::OpenStack::Compute::NotFound
  nil
end

#metadata(stack_name, stack_id, resource_name) ⇒ Object



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

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

#typesObject



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

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