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

Inherits:
Types::Model show all
Includes:
Bogo::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 inherited from Types::Model

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

Methods included from Utils::ApiMethoding

#api_method_for

Methods inherited from Types::Data

from_json, #from_json, #initialize, #to_json

Constructor Details

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

Instance Method Details

#eventsEvents

Returns:



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

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



59
60
61
62
63
64
65
66
67
68
# File 'lib/miasma/models/orchestration/stack.rb', line 59

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)


81
82
83
84
85
86
87
88
89
90
# File 'lib/miasma/models/orchestration/stack.rb', line 81

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:



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

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

#saveObject

Always perform save. Remove dirty check provided by default.



108
109
110
# File 'lib/miasma/models/orchestration/stack.rb', line 108

def save
  perform_save
end

#validateTrueClass

Validate the stack template

Returns:

  • (TrueClass)


74
75
76
# File 'lib/miasma/models/orchestration/stack.rb', line 74

def validate
  perform_template_validate
end