Class: Fog::Orchestration::OpenStack::Stacks

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

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #load_response

Instance Method Details

#adopt(options = {}) ⇒ Object



45
46
47
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 45

def adopt(options = {})
  service.create_stack(options)
end

#all(options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 10

def all(options = {})
  # TODO(lsmola) we can uncomment this when https://bugs.launchpad.net/heat/+bug/1468318 is fixed, till then
  # we will use non detailed list
  # data = service.list_stack_data_detailed(options).body['stacks']
  data = service.list_stack_data(options)
  load_response(data, 'stacks')
end

#build_infoObject



58
59
60
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 58

def build_info
  service.build_info.body
end

#create(options = {}) ⇒ Object



49
50
51
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 49

def create(options = {})
  service.create_stack(options).body['stack']
end

#find_by_id(id) ⇒ Object

Deprecated



24
25
26
27
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 24

def find_by_id(id)
  Fog::Logger.deprecation("#find_by_id(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
  find { |stack| stack.id == id }
end

#get(arg1, arg2 = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 29

def get(arg1, arg2 = nil)
  if arg2.nil?
    # Deprecated: get(id)
    Fog::Logger.deprecation("#get(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
    return find_by_id(arg1)
  end

  # Normal use: get(name, id)
  name = arg1
  id = arg2
  data = service.show_stack_details(name, id).body['stack']
  new(data)
rescue Fog::Compute::OpenStack::NotFound
  nil
end

#preview(options = {}) ⇒ Object



53
54
55
56
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 53

def preview(options = {})
  data = service.preview_stack(options).body['stack']
  new(data)
end

#summary(options = {}) ⇒ Object



18
19
20
21
# File 'lib/fog/orchestration/openstack/models/stacks.rb', line 18

def summary(options = {})
  data = service.list_stack_data(options)
  load_response(data, 'stacks')
end