Class: Cumulus::S3::NotificationDiff
- Inherits:
-
Common::Diff
- Object
- Common::Diff
- Cumulus::S3::NotificationDiff
- Includes:
- NotificationChange
- Defined in:
- lib/s3/models/NotificationDiff.rb
Overview
Public: Represents a single difference between local configuration and AWS S3 Notification configuration
Constant Summary
Constants included from NotificationChange
Cumulus::S3::NotificationChange::PREFIX, Cumulus::S3::NotificationChange::SUFFIX, Cumulus::S3::NotificationChange::TARGET, Cumulus::S3::NotificationChange::TRIGGERS, Cumulus::S3::NotificationChange::TYPE
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
- #diff_string ⇒ Object
-
#initialize(type, aws = nil, local = nil) ⇒ NotificationDiff
constructor
A new instance of NotificationDiff.
Methods included from Common::DiffChange
Methods inherited from Common::Diff
#add_string, added, #local_name, modified, #to_s, unmanaged, #unmanaged_string
Constructor Details
#initialize(type, aws = nil, local = nil) ⇒ NotificationDiff
Returns a new instance of NotificationDiff.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/s3/models/NotificationDiff.rb', line 23 def initialize(type, aws = nil, local = nil) super(type, aws, local) if aws and local @triggers = Common::ListChange.new( local.triggers - aws.triggers, aws.triggers - local.triggers ) end end |
Instance Method Details
#asset_type ⇒ Object
34 35 36 |
# File 'lib/s3/models/NotificationDiff.rb', line 34 def asset_type "Notification" end |
#aws_name ⇒ Object
38 39 40 |
# File 'lib/s3/models/NotificationDiff.rb', line 38 def aws_name @aws.name end |
#diff_string ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/s3/models/NotificationDiff.rb', line 42 def diff_string case @type when PREFIX "Prefix: AWS - #{Colors.aws_changes(@aws.prefix)}, Local - #{Colors.local_changes(@local.prefix)}" when SUFFIX "Suffix: AWS - #{Colors.aws_changes(@aws.suffix)}, Local - #{Colors.local_changes(@local.suffix)}" when TRIGGERS [ "Triggers:", @triggers.removed.map { |t| Colors.removed("\t#{t}") }, @triggers.added.map { |t| Colors.added("\t#{t}") }, ].flatten.join("\n") when TYPE "Type: AWS - #{Colors.aws_changes(@aws.type)}, Local - #{Colors.local_changes(@local.type)}" when TARGET "Target: AWS - #{Colors.aws_changes(@aws.target)}, Local - #{Colors.local_changes(@local.target)}" end end |