Class: Fog::Orchestration::OpenStack::Stack

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ Stack

Returns a new instance of Stack.



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

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#createObject



32
33
34
35
36
# File 'lib/fog/openstack/models/orchestration/stack.rb', line 32

def create
  requires :stack_name
  service.create_stack(stack_name, self.attributes)
  self
end

#destroyObject



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

def destroy
  requires :id
  service.delete_stack(self.stack_name, self.id)
  true
end

#saveObject



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

def save
  requires :stack_name
  identity ? update : create
end

#updateObject



38
39
40
41
42
# File 'lib/fog/openstack/models/orchestration/stack.rb', line 38

def update
  requires :stack_name
  service.update_stack(stack_name, self.attributes)
  self
end