Class: Cumulus::VPC::SubnetDiff

Inherits:
Common::Diff show all
Includes:
Common::TagsDiff, SubnetChange
Defined in:
lib/vpc/models/SubnetDiff.rb

Overview

Public: Represents a single difference between local configuration and AWS configuration

Constant Summary

Constants included from SubnetChange

Cumulus::VPC::SubnetChange::AZ, Cumulus::VPC::SubnetChange::CIDR, Cumulus::VPC::SubnetChange::NETWORK_ACL, Cumulus::VPC::SubnetChange::PUBLIC, Cumulus::VPC::SubnetChange::ROUTE_TABLE, Cumulus::VPC::SubnetChange::TAGS

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

Methods included from Common::TagsDiff

#tags_diff_string, #tags_to_add, #tags_to_remove

Methods included from Common::DiffChange

next_change_id

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_typeObject



32
33
34
# File 'lib/vpc/models/SubnetDiff.rb', line 32

def asset_type
  "Subnet"
end

#aws_nameObject



36
37
38
# File 'lib/vpc/models/SubnetDiff.rb', line 36

def aws_name
  @aws.name
end

#aws_tagsObject



28
29
30
# File 'lib/vpc/models/SubnetDiff.rb', line 28

def aws_tags
  @aws
end

#diff_stringObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/vpc/models/SubnetDiff.rb', line 40

def diff_string
  case @type
  when CIDR
    [
      "CIDR Block:",
      Colors.aws_changes("\tAWS - #{aws}"),
      Colors.local_changes("\tLocal - #{local}"),
    ].join("\n")
  when PUBLIC
    [
      "Map Public Ip:",
      Colors.aws_changes("\tAWS - #{aws}"),
      Colors.local_changes("\tLocal - #{local}"),
    ].join("\n")
  when ROUTE_TABLE
    [
      "Route Table:",
      Colors.aws_changes("\tAWS - #{aws}"),
      Colors.local_changes("\tLocal - #{local}"),
    ].join("\n")
  when NETWORK_ACL
    [
      "Network ACL:",
      Colors.aws_changes("\tAWS - #{aws}"),
      Colors.local_changes("\tLocal - #{local}"),
    ].join("\n")
  when AZ
    [
      "Availability Zone:",
      Colors.aws_changes("\tAWS - #{aws}"),
      Colors.local_changes("\tLocal - #{local}"),
    ].join("\n")
  when TAGS
    tags_diff_string
  end
end

#local_tagsObject



24
25
26
# File 'lib/vpc/models/SubnetDiff.rb', line 24

def local_tags
  @local
end