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 (collapse)

Instance Method Summary (collapse)

Constructor Details

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

Instance Attribute Details

- (Miasma::Types::Api) api (readonly) Originally defined in class Types::Model

Returns underlying service API

Returns:

Instance Method Details

- (Object) _memo Originally defined in module Utils::Memoization

- (TrueClass) clear_memoizations! Originally defined in module Utils::Memoization

Remove all memoized values

Returns:

  • (TrueClass)

- (Events) events

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

- (Object) load_data(args = {})

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

- (Object) memoize(key, direct = false) { ... } Originally defined in module Utils::Memoization

Memoize data

Parameters:

  • key (String, Symbol)

    identifier for data

  • direct (Truthy, Falsey) (defaults to: false)

    direct skips key prepend of object id

Yields:

  • block to create data

Yield Returns:

  • data to memoize

Returns:

  • (Object)

    data

- (self) reload

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

- (Resources) resources

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

- (Object) save

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

- (NilClass) unmemoize(key, direct = false) Originally defined in module Utils::Memoization

Remove memoized value

Parameters:

  • key (String, Symbol)

    identifier for data

  • direct (Truthy, Falsey) (defaults to: false)

    direct skips key prepend of object id

Returns:

  • (NilClass)

- (TrueClass) validate

Validate the stack template

Returns:

  • (TrueClass)


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

def validate
  perform_template_validate
end