Module: GClouder::Resources::PubSub::Topics::Local
- Includes:
- Config::CLIArgs, Config::Project, Logging
- Defined in:
- lib/gclouder/resources/pubsub/topics.rb
Class Method Summary collapse
- .list ⇒ Object
-
.validate ⇒ Object
FIXME: improve validation.
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::Project
Methods included from Helpers
#hash_to_args, included, #module_exists?, #to_arg, #to_deep_merge_hash, #valid_json?
Methods included from Config::CLIArgs
check, #cli_args, cli_args, included, load, valid_resources
Class Method Details
.list ⇒ Object
64 65 66 |
# File 'lib/gclouder/resources/pubsub/topics.rb', line 64 def self.list GClouder::Resources::Global.instances(path: %w(pubsub topics)) end |
.validate ⇒ Object
FIXME: improve validation
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gclouder/resources/pubsub/topics.rb', line 41 def self.validate return if list.empty? failure = false list.each do |region, topics| info region, indent: 2, heading: true topics.each do |topic| info topic["name"], indent: 3, heading: true if !topic["name"].is_a?(String) bad "#{topic['name']} is incorrect type #{topic['name'].class}, should be: String", indent: 4 failure = true end if cli_args[:debug] || !cli_args[:output_validation] good "name is a String", indent: 4 end end end fatal "\nerror: validation failure" if failure end |