Module: Convection::Model::Mixin::Taggable

Overview

Add tag helpers to taddable resources

Instance Method Summary collapse

Instance Method Details

#immutable_metadata(purpose, target = '') ⇒ Object

Helper for Asgard



33
34
35
36
37
38
# File 'lib/convection/model/mixin/taggable.rb', line 33

def (purpose, target = '')
  tag('immutable_metadata', JSON.generate(
    :purpose => purpose,
    :target => target
  ))
end

#render_tags(resource) ⇒ Object



40
41
42
43
44
# File 'lib/convection/model/mixin/taggable.rb', line 40

def render_tags(resource)
  resource.tap do |r|
    r['Properties']['Tags'] = tags.render unless tags.empty?
  end
end

#tag(key, value) ⇒ Object



28
29
30
# File 'lib/convection/model/mixin/taggable.rb', line 28

def tag(key, value)
  tags[key] = value
end

#tagsObject



24
25
26
# File 'lib/convection/model/mixin/taggable.rb', line 24

def tags
  @tags ||= Tags.new
end