Class: Miasma::Models::Orchestration::Stack

Inherits:
Types::Model show all
Includes:
Utils::Memoization
Defined in:
lib/miasma/models/orchestration/stack.rb,
lib/miasma/models/orchestration/event.rb,
lib/miasma/models/orchestration/events.rb,
lib/miasma/models/orchestration/resource.rb,
lib/miasma/models/orchestration/resources.rb

Overview

Abstract server

Defined Under Namespace

Classes: Event, Events, Output, Resource, Resources

Instance Attribute Summary

Attributes inherited from Types::Model

#api

Instance Method Summary collapse

Methods included from Utils::Memoization

#_memo, #clear_memoizations!, #memoize, #unmemoize

Methods inherited from Types::Model

#destroy, from_json, #id?, #initialize, #persisted?

Methods inherited from Types::Data

from_json, #from_json, #initialize, #to_json

Methods included from Utils::Lazy

included

Constructor Details

This class inherits a constructor from Miasma::Types::Model

Instance Method Details

#eventsEvents

Returns:



87
88
89
90
91
# File 'lib/miasma/models/orchestration/stack.rb', line 87

def events
  memoize(:events) do
    Events.new(self)
  end
end

#load_data(args = {}) ⇒ Object

Overload the loader so we can extract resources, events, and outputs



53
54
55
56
57
58
59
60
61
62
# File 'lib/miasma/models/orchestration/stack.rb', line 53

def load_data(args={})
  args = args.to_smash
  @resources = (args.delete(:resources) || []).each do |r|
    Resource.new(r)
  end
  @events = (args.delete(:events) || []).each do |e|
    Event.new(e)
  end
  super args
end

#reloadself

Override to scrub custom caches

Returns:

  • (self)


75
76
77
78
79
80
81
82
83
84
# File 'lib/miasma/models/orchestration/stack.rb', line 75

def reload
  clear_memoizations!
  remove = data.keys.find_all do |k|
    ![:id, :name].include?(k.to_sym)
  end
  remove.each do |k|
    data.delete(k)
  end
  super
end

#resourcesResources

Returns:



94
95
96
97
98
# File 'lib/miasma/models/orchestration/stack.rb', line 94

def resources
  memoize(:resources) do
    Resources.new(self)
  end
end

#saveObject

Always perform save. Remove dirty check provided by default.



102
103
104
# File 'lib/miasma/models/orchestration/stack.rb', line 102

def save
  perform_save
end

#validateTrueClass

Validate the stack template

Returns:

  • (TrueClass)


68
69
70
# File 'lib/miasma/models/orchestration/stack.rb', line 68

def validate
  perform_template_validate
end