Sha256: 0f3d89e0e87590f9be2d3f18fbb8bcb4dcf80537c4d5dd77e98130b136b788c5
Contents?: true
Size: 911 Bytes
Versions: 1
Compression:
Stored size: 911 Bytes
Contents
require 'json' module Convection module Model ## # CloudFormation ResourceTag set ## class Tags < Hash def render map do |t| { :Key => t[0].to_s, :Value => t[1] } end end end module Mixin ## # Add tag helpers to taddable resources ## module Taggable def tags @tags ||= Tags.new end def tag(key, value) tags[key] = value end ## Helper for Asgard def immutable_metadata(purpose, target = '') tag('immutable_metadata', JSON.generate( :purpose => purpose, :target => target )) end def render_tags(resource) resource.tap do |r| r['Properties']['Tags'] = tags.render unless tags.empty? end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
convection-0.0.1 | lib/convection/model/mixin/taggable.rb |