Module: PuppetX::IntechWIFI::Constants

Defined in:
lib/puppet_x/intechwifi/constants.rb

Constant Summary

@@regions =

possible later feature to override this list from an environment variable as an optimisation

[
  "us-east-1",
  "us-east-2",
  "us-west-1",
  "us-west-2",
  "ca-central-1",
  "eu-west-1",
  "eu-central-1",
  "eu-west-2",
  "ap-northeast-1",
  "ap-northeast-2",
  "ap-southeast-1",
  "ap-southeast-2",
  "ap-south-1",
  "sa-east-1"
]
@@zone_map =
[
    {:az => 'a', :zone => "a" },
    {:az => 'b', :zone => "b" },
    {:az => 'c', :zone => "c" },
    {:az => 'd', :zone => "d" },
    {:az => 'e', :zone => "e" }
]
@@OS_Description_Map =
[
    { :label => 'windows2012r2', :description => 'Microsoft Windows Server 2012 R2 RTM 64-bit Locale English AMI provided by Amazon'},
    { :label => 'windows2016', :description => ''},
    { :label => 'centos7', :description => ''},
    { :label => 'amzn-linux', :description => ''},
]
@@principal_map =
[
    {:key => 'ec2', :value => "ec2.amazonaws.com" },
]
@@rds_engines =
[
    "mysql",
    "mariadb",
    "oracle-se1",
    "oracle-se2",
    "oracle-se",
    "oracle-ee",
    "sqlserver-ee",
    "sqlserver-se",
    "sqlserver-ex",
    "sqlserver-web",
    "postgres",
    "aurora"
]
@@license_models =
[
    "license-included",
    "bring-your-own-license",
    "general-public-license"
]

Class Method Summary collapse

Class Method Details

.AvailabilityZone(region, zone) ⇒ Object



62
63
64
# File 'lib/puppet_x/intechwifi/constants.rb', line 62

def self.AvailabilityZone region, zone
  "#{region}#{@@zone_map.select{|zm| zm[:zone] == zone}.collect{|zm| zm[:az]}[0]}"
end

.AvailabilityZonesObject



50
51
52
# File 'lib/puppet_x/intechwifi/constants.rb', line 50

def self.AvailabilityZones
  @@zone_map.collect{|zm| zm[:zone] }
end

.License_ModelsObject



115
116
117
# File 'lib/puppet_x/intechwifi/constants.rb', line 115

def self.License_Models
  @@license_models
end

.PrincipalKey(value) ⇒ Object



77
78
79
# File 'lib/puppet_x/intechwifi/constants.rb', line 77

def self.PrincipalKey value
  @@principal_map.select{|p| p[:value] == value}[0][:key]
end

.PrincipalKeysObject



85
86
87
# File 'lib/puppet_x/intechwifi/constants.rb', line 85

def self.PrincipalKeys
  @@principal_map.keys
end

.PrincipalValue(key) ⇒ Object



81
82
83
# File 'lib/puppet_x/intechwifi/constants.rb', line 81

def self.PrincipalValue key
  @@principal_map.select{|p| p[:key] == key}[0][:value]
end

.RDS_EnginesObject



105
106
107
# File 'lib/puppet_x/intechwifi/constants.rb', line 105

def self.RDS_Engines
  @@rds_engines
end

.RegionsObject



46
47
48
# File 'lib/puppet_x/intechwifi/constants.rb', line 46

def self.Regions
  @@regions
end

.ZoneName(aws_az) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/puppet_x/intechwifi/constants.rb', line 54

def self.ZoneName aws_az
  if aws_az.length > 1
    region = aws_az.chop
    fail("Unsupported region (#{region} detected.") if !self.Regions.include? region
  end
  @@zone_map.select{|zm| zm[:az] == aws_az[-1]}.collect{|zm| zm[:zone]}[0]
end