Class: Cumulus::S3::GrantDiff
- Inherits:
-
Common::Diff
- Object
- Common::Diff
- Cumulus::S3::GrantDiff
- Includes:
- GrantChange
- Defined in:
- lib/s3/models/GrantDiff.rb
Overview
Public: Represents a single difference between local configuration and an AWS Grant.
Constant Summary
Constants included from GrantChange
Cumulus::S3::GrantChange::PERMISSIONS
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) ⇒ GrantDiff
constructor
A new instance of GrantDiff.
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) ⇒ GrantDiff
Returns a new instance of GrantDiff.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/s3/models/GrantDiff.rb', line 19 def initialize(type, aws = nil, local = nil) super(type, aws, local) if aws and local @permissions = Common::ListChange.new( local. - aws., aws. - local. ) end end |
Instance Method Details
#asset_type ⇒ Object
30 31 32 |
# File 'lib/s3/models/GrantDiff.rb', line 30 def asset_type "Grant" end |
#aws_name ⇒ Object
34 35 36 |
# File 'lib/s3/models/GrantDiff.rb', line 34 def aws_name @aws.name end |
#diff_string ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/s3/models/GrantDiff.rb', line 38 def diff_string case @type when PERMISSIONS [ "#{@local.name}:", @permissions.removed.map { |p| Colors.removed("\t#{p}") }, @permissions.added.map { |p| Colors.added("\t#{p}") }, ].flatten.join("\n") end end |