Module: GClouder::Resources::Validate::Global

Includes:
Config::CLIArgs, Config::Project, Logging, Local
Defined in:
lib/gclouder/resources/validate/global.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: []) ⇒ Object



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

def self.instances(data, required_keys: {}, permitted_keys: {}, ignore_keys: [])
  return unless data.key?("global")

  data["global"].each do |instance|
    info instance["name"], heading: true, indent: 3

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

    fatal "\nerror: validation failure"
  end
end