Module: GClouder::Resources::Compute::Networks::Local
Class Method Summary
collapse
Methods included from Logging
#add, #bad, #change, #debug, #error, #fatal, #good, included, #info, log, loggers, #remove, report, #resource_state, setup, #warn, #warning
load, #project, project
Methods included from Helpers
#hash_to_args, included, #module_exists?, #to_arg, #to_deep_merge_hash, #valid_json?
check, #cli_args, cli_args, included, load, valid_resources
Class Method Details
.list ⇒ Object
40
41
42
|
# File 'lib/gclouder/resources/compute/networks.rb', line 40
def self.list
{ "global" => resources }.delete_if { |_k, v| v.empty? }
end
|
.resources ⇒ Object
44
45
46
47
48
|
# File 'lib/gclouder/resources/compute/networks.rb', line 44
def self.resources
merged = networks.merge(subnet_networks)["global"]
return [] unless merged
merged.uniq { |network| network["name"] }
end
|
.subnet_networks ⇒ Object
.validate ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/gclouder/resources/compute/networks.rb', line 50
def self.validate
return if list.empty?
failure = false
list.each do |region, networks|
info region, indent: 2, heading: true
networks.each do |network|
info network["name"], indent: 3, heading: true
if !network["name"].is_a?(String)
bad "#{network['name']} is incorrect type #{network['name'].class}, should be: String", indent: 4
failure = true
end
if cli_args[:debug] || !cli_args[:output_validation]
good "network is a String", indent: 4
end
end
end
fatal "\nerror: validation failure" if failure
end
|