Sha256: f9e2c1fc7a71e5bdf64e7663338c012f0c685393be6004408d61fcb78ddc77e1
Contents?: true
Size: 1.47 KB
Versions: 26
Compression:
Stored size: 1.47 KB
Contents
require 'stacco/base' class Stacco::Layer def self.load(stack, name) self.new(stack, name, Stacco::Resources::LayerTemplates[name]) end def initialize(stack, name, config) @stack = stack @name = name.gsub(/^task-/, '') @is_task = (not name.scan(/^task-/).empty?) @config = config end def enabled? @stack.enabled_layer_names.include? self.name end attr_reader :stack, :name, :config def task? @is_task end def service? not @is_task end def to_s [('task' if @is_task), @name].compact.join('-') end def full_name [@stack.name, self.name].join('/') end def inspect "#<layer #{self.full_name}: #{self.resource_definitions.length} resource(s) defined>" end def has_live_resources? not self.resource_summaries.empty? end def state case [self.enabled?, self.has_live_resources?] when [false, false] :down when [false, true] :zombie when [true, false] :queued when [true, true] :healthy end end def condition_definitions @config['Conditions'] || {} end def resource_definitions @config['Resources'] || {} end def resource_summaries provided_resource_names = self.resource_definitions.keys @stack.resource_summaries.find_all{ |rsum| provided_resource_names.include? rsum[:logical_resource_id] } end def output_definitions @config['Outputs'] || {} end def parameter_definitions @config['Parameters'] || {} end end
Version data entries
26 entries across 26 versions & 1 rubygems