module GClouder::Resources::PubSub::Topics::Local

Public Class Methods

list() click to toggle source
# File lib/gclouder/resources/pubsub/topics.rb, line 64
def self.list
  GClouder::Resources::Global.instances(path: %w(pubsub topics))
end
validate() click to toggle source

FIXME: improve validation

# 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