Module: GClouder::Resources::Compute::Addresses::Local

Includes:
Config::Project
Defined in:
lib/gclouder/resources/compute/addresses.rb

Class Method Summary collapse

Methods included from Config::Project

load, #project, project

Methods included from Helpers

#hash_to_args, included, #module_exists?, #to_arg, #to_deep_merge_hash, #valid_json?

Methods included from Logging

#add, #bad, #change, #debug, #error, #fatal, #good, included, #info, log, loggers, #remove, report, #resource_state, setup, #warn, #warning

Class Method Details

.globalObject



58
59
60
# File 'lib/gclouder/resources/compute/addresses.rb', line 58

def self.global
  Resources::Global.instances(path: ["addresses"])
end

.listObject



53
54
55
56
# File 'lib/gclouder/resources/compute/addresses.rb', line 53

def self.list
  addresses = global.merge regional
  addresses.delete_if { |_k, v| v.empty? }
end

.regionalObject



74
75
76
77
78
79
80
# File 'lib/gclouder/resources/compute/addresses.rb', line 74

def self.regional
  resources = Resources::Region.instances(path: ["addresses"])

  # get_instances_from_region assumes all keys have configs.. this normalizes
  # the data to match self.global
  resources.each { |k, v| resources[k] = v.to_a.flatten.delete_if(&:nil?) }
end

.sectionObject



62
63
64
# File 'lib/gclouder/resources/compute/addresses.rb', line 62

def self.section
  %w(compute addresses)
end

.validateObject



66
67
68
69
70
71
72
# File 'lib/gclouder/resources/compute/addresses.rb', line 66

def self.validate
  Resources::Validate::Region.instances(
    list,
    required_keys:  GClouder::Config::Arguments.required(section),
    permitted_keys: GClouder::Config::Arguments.permitted(section)
  )
end