Module: GClouder::Resource::Find

Includes:
GCloud
Defined in:
lib/gclouder/resource.rb

Class Method Summary collapse

Methods included from GCloud

#gcloud, included, #verify

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?

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 Shell

included, #shell

Class Method Details

.zone(resource, name, region, project_id: nil) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/gclouder/resource.rb', line 63

def self.zone(resource, name, region, project_id: nil)
  zones = %w(b c d).map { |zone| region + "-" + zone }

  zones.each do |zone|
    return zone if gcloud "#{resource} describe #{name} --zone=#{zone}", force: true, failure: false, silent: true, project_id: project_id
  end

  false
end