Module: Cumulus::Common::TagsDiff
- Included in:
- AutoScaling::AutoScalingDiff, EC2::InstanceDiff, Kinesis::StreamDiff, S3::BucketDiff, SecurityGroups::SecurityGroupDiff, VPC::NetworkAclDiff, VPC::RouteTableDiff, VPC::SubnetDiff, VPC::VpcDiff
- Defined in:
- lib/common/models/TagsDiff.rb
Overview
Public: A module to be mixed in to Diff classes that have tags
Instance Method Summary collapse
-
#tags_diff_string ⇒ Object
Public: Get the diff string for tag differences.
-
#tags_to_add ⇒ Object
Public: Get the tags that are in local configuration but not in AWS.
-
#tags_to_remove ⇒ Object
Public: Get the tags that are in AWS that are not in local configuration.
Instance Method Details
#tags_diff_string ⇒ Object
Public: Get the diff string for tag differences
Returns the string to display
8 9 10 11 12 13 |
# File 'lib/common/models/TagsDiff.rb', line 8 def lines = ["Tags:"] lines << .map { |k, v| "\t#{Colors.removed("#{k} => #{v}")}" } lines << .map { |k, v| "\t#{Colors.added("#{k} => #{v}")}" } lines.flatten.join("\n") end |
#tags_to_add ⇒ Object
Public: Get the tags that are in local configuration but not in AWS
Returns a hash of tags
25 26 27 |
# File 'lib/common/models/TagsDiff.rb', line 25 def .reject { |t, v| .include?(t) and [t] == v } end |
#tags_to_remove ⇒ Object
Public: Get the tags that are in AWS that are not in local configuration
Returns a hash of tags
18 19 20 |
# File 'lib/common/models/TagsDiff.rb', line 18 def .reject { |t, v| .include?(t) and [t] == v } end |