Class: Cumulus::EC2::InstanceDiff
- Inherits:
-
Common::Diff
- Object
- Common::Diff
- Cumulus::EC2::InstanceDiff
- Includes:
- Common::TagsDiff, InstanceChange
- Defined in:
- lib/ec2/models/InstanceDiff.rb
Overview
Public: Represents a single difference between local configuration and AWS configuration
Constant Summary
Constants included from InstanceChange
Cumulus::EC2::InstanceChange::EBS, Cumulus::EC2::InstanceChange::INTERFACES, Cumulus::EC2::InstanceChange::MONITORING, Cumulus::EC2::InstanceChange::PROFILE, Cumulus::EC2::InstanceChange::SDCHECK, Cumulus::EC2::InstanceChange::SECURITY_GROUPS, Cumulus::EC2::InstanceChange::SUBNET, Cumulus::EC2::InstanceChange::TAGS, Cumulus::EC2::InstanceChange::TENANCY, Cumulus::EC2::InstanceChange::TYPE, Cumulus::EC2::InstanceChange::VOLUME_GROUPS
Constants included from Common::DiffChange
Common::DiffChange::ADD, Common::DiffChange::MODIFIED, Common::DiffChange::UNMANAGED
Instance Attribute Summary
Attributes inherited from Common::Diff
#aws, #changes, #info_only, #local, #type
Instance Method Summary collapse
- #asset_type ⇒ Object
- #aws_name ⇒ Object
- #aws_tags ⇒ Object
- #diff_string ⇒ Object
- #local_tags ⇒ Object
Methods included from Common::TagsDiff
#tags_diff_string, #tags_to_add, #tags_to_remove
Methods included from Common::DiffChange
Methods inherited from Common::Diff
#add_string, added, #initialize, #local_name, modified, #to_s, unmanaged, #unmanaged_string
Constructor Details
This class inherits a constructor from Cumulus::Common::Diff
Instance Method Details
#asset_type ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ec2/models/InstanceDiff.rb', line 31 def asset_type case @type when EBS then "EBS Optimized" when PROFILE then "Instance Profile" when MONITORING then "Monitoring" when INTERFACES then "Network Interfaces" when SDCHECK then "Source Dest Check" when SECURITY_GROUPS then "Security Groups" when SUBNET then "Subnet" when TYPE then "Type" when TENANCY then "Tenancy" when VOLUME_GROUPS then "Volume Groups" when TAGS then "Tags" else "EC2 Instance" end end |
#aws_name ⇒ Object
49 50 51 |
# File 'lib/ec2/models/InstanceDiff.rb', line 49 def aws_name @aws.name end |
#aws_tags ⇒ Object
57 58 59 |
# File 'lib/ec2/models/InstanceDiff.rb', line 57 def @aws end |
#diff_string ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/ec2/models/InstanceDiff.rb', line 61 def diff_string case @type when EBS, PROFILE, MONITORING, INTERFACES, SDCHECK, SUBNET, TYPE, TENANCY [ "#{asset_type}:", Colors.aws_changes("\tAWS - #{aws}"), Colors.local_changes("\tLocal - #{local}"), ].join("\n") when SECURITY_GROUPS [ "#{asset_type}:", @changes.removed.map { |sg| Colors.unmanaged("\t#{sg}") }, @changes.added.map { |sg| Colors.added("\t#{sg}") } ].flatten.join("\n") when VOLUME_GROUPS [ "#{asset_type}:", @changes.removed.map { |vg, _| Colors.unmanaged("\t#{vg} is attached but not managed by Cumulus") }, @changes.added.map { |vg, _| Colors.added("\t#{vg} will be attached to the instance") }, @changes.modified.map do |vg, diff| [ "\t#{vg}:", diff.changes.map do |diff| diff.to_s.lines.map { |l| "\t\t#{l}".chomp("\n") } end ] end ].flatten.join("\n") when TAGS end end |
#local_tags ⇒ Object
53 54 55 |
# File 'lib/ec2/models/InstanceDiff.rb', line 53 def @local end |