Class: Cumulus::SecurityGroups::RuleDiff

Inherits:
Common::Diff show all
Includes:
RuleChange
Defined in:
lib/security/models/RuleDiff.rb

Overview

Public: Represents a single difference between local rule configuration and AWS configuration of security group rules

Constant Summary

Constants included from RuleChange

Cumulus::SecurityGroups::RuleChange::REMOVED

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common::DiffChange

next_change_id

Methods inherited from Common::Diff

#add_string, #initialize, #local_name, modified, unmanaged, #unmanaged_string

Constructor Details

This class inherits a constructor from Cumulus::Common::Diff

Class Method Details

.added(local) ⇒ Object

Public: Static method that will produce a diff that contains an added rule

local - the local configuration that was added

Returns the diff



23
24
25
# File 'lib/security/models/RuleDiff.rb', line 23

def RuleDiff.added(local)
  RuleDiff.new(ADD, nil, local)
end

.removed(aws) ⇒ Object

Public: Static method that will produce a diff that contains a removed rule

aws - the aws configuration that was removed

Returns the diff



32
33
34
# File 'lib/security/models/RuleDiff.rb', line 32

def RuleDiff.removed(aws)
  RuleDiff.new(REMOVED, aws)
end

Instance Method Details

#to_sObject



36
37
38
39
40
41
42
43
# File 'lib/security/models/RuleDiff.rb', line 36

def to_s
  case @type
  when ADD
    Colors.added("#{to_readable(local)}")
  when REMOVED
    Colors.removed("#{to_readable(aws)}")
  end
end