Class: Cumulus::VPC::DhcpDiff
- Inherits:
-
Common::Diff
- Object
- Common::Diff
- Cumulus::VPC::DhcpDiff
- Includes:
- DhcpChange
- Defined in:
- lib/vpc/models/DhcpDiff.rb
Overview
Public: Represents a single difference between local configuration and an AWS Load Balancer.
Constant Summary
Constants included from DhcpChange
Cumulus::VPC::DhcpChange::DOMAIN_NAME, Cumulus::VPC::DhcpChange::DOMAIN_SERVERS, Cumulus::VPC::DhcpChange::NETBIOS_NODE, Cumulus::VPC::DhcpChange::NETBIOS_SERVERS, Cumulus::VPC::DhcpChange::NTP_SERVERS
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
- .domain_servers(aws, local) ⇒ Object
- .netbios_servers(aws, local) ⇒ Object
- .ntp_servers(aws, local) ⇒ Object
Instance Method Summary collapse
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
Class Method Details
.domain_servers(aws, local) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/vpc/models/DhcpDiff.rb', line 23 def self.domain_servers(aws, local) changes = Common::ListChange.simple_list_diff(aws, local) if changes diff = DhcpDiff.new(DOMAIN_SERVERS, aws, local) diff.changes = changes diff end end |
.netbios_servers(aws, local) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/vpc/models/DhcpDiff.rb', line 41 def self.netbios_servers(aws, local) changes = Common::ListChange.simple_list_diff(aws, local) if changes diff = DhcpDiff.new(NETBIOS_SERVERS, aws, local, servers_diff) diff.changes = changes diff end end |
.ntp_servers(aws, local) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/vpc/models/DhcpDiff.rb', line 32 def self.ntp_servers(aws, local) changes = Common::ListChange.simple_list_diff(aws, local) if changes diff = DhcpDiff.new(NTP_SERVERS, aws, local) diff.changes = changes diff end end |
Instance Method Details
#asset_type ⇒ Object
50 51 52 |
# File 'lib/vpc/models/DhcpDiff.rb', line 50 def asset_type "DHCP Options" end |
#diff_string ⇒ Object
54 55 56 57 58 59 60 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 |
# File 'lib/vpc/models/DhcpDiff.rb', line 54 def diff_string case @type when DOMAIN_SERVERS [ "Domain Name Servers:", @changes.removed.map { |d| Colors.unmanaged("\t#{d}") }, @changes.added.map { |d| Colors.added("\t#{d}") }, ].flatten.join("\n") when DOMAIN_NAME [ "Domain Name:", Colors.aws_changes("\tAWS - #{aws}"), Colors.local_changes("\tLocal - #{local}"), ].join("\n") when NTP_SERVERS [ "NTP Servers:", @changes.removed.map { |n| Colors.unmanaged("\t#{n}") }, @changes.added.map { |n| Colors.added("\t#{n}") }, ].flatten.join("\n") when NETBIOS_SERVERS [ "NETBIOS Name Servers:", @changes.removed.map { |n| Colors.unmanaged("\t#{n}") }, @changes.added.map { |n| Colors.added("\t#{n}") }, ].flatten.join("\n") when NETBIOS_NODE [ "NETBIOS Node Type:", Colors.aws_changes("\tAWS - #{aws}"), Colors.local_changes("\tLocal - #{local}"), ].join("\n") end end |