Module: GClouder::Resources::Validate::Region

Extended by:
Local
Includes:
Config::CLIArgs, Config::Project, Logging
Defined in:
lib/gclouder/resources/validate/region.rb

Class Method Summary collapse

Methods included from Local

has_required_keys?, has_unknown_keys?, included

Methods included from Logging

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

Methods included from Config::CLIArgs

check, #cli_args, cli_args, included, load, valid_resources

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?

Class Method Details

.instances(data, required_keys: {}, permitted_keys: {}, ignore_keys: [], skip_region: false, indent: 0) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gclouder/resources/validate/region.rb', line 12

def self.instances(data, required_keys: {}, permitted_keys: {}, ignore_keys: [], skip_region: false, indent: 0)
  data.each do |region, instances|
    info region, indent: 2 + indent, heading: true unless skip_region
    instances.each do |instance|
      info instance["name"], indent: 3 + indent, heading: true

      next if !has_unknown_keys?(instance, permitted_keys, ignore_keys, indent: indent) &&
        has_required_keys?(instance, required_keys, ignore_keys, indent: 4 + indent)

      fatal "\nerror: validation failure"
    end
  end
end