Module: GClouder::Resources::Compute::Addresses

Includes:
GCloud, Logging, GClouder::Resource::Cleaner
Defined in:
lib/gclouder/resources/compute/addresses.rb

Defined Under Namespace

Modules: Address, Local, Remote, Resource

Class Method Summary collapse

Methods included from GClouder::Resource::Cleaner

#clean, #cleaner, included, #undefined

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 GCloud

#gcloud, included, #verify

Methods included from Config::CLIArgs

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 Shell

included, #shell

Class Method Details

.checkObject



37
38
39
40
41
42
# File 'lib/gclouder/resources/compute/addresses.rb', line 37

def self.check
  return if Remote.list.empty?
  return if Local.list.empty?
  header :check
  Resources::Validate::Remote.instances(Local.list, Remote.list)
end

.ensureObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gclouder/resources/compute/addresses.rb', line 15

def self.ensure
  return if Local.list.empty?
  header

  if Local.list.key?("global")
    info "global", indent: 2, heading: true
    info
    Local.list["global"].each { |address| Address.ensure(address["name"], "--global") }
  end

  Local.list.each do |region, addresses|
    next if region == "global"
    next unless addresses

    info region, indent: 2, heading: true
    info
    addresses.each do |address|
      Address.ensure(address["name"], "--region #{region}")
    end
  end
end

.header(stage = :ensure) ⇒ Object



11
12
13
# File 'lib/gclouder/resources/compute/addresses.rb', line 11

def self.header(stage = :ensure)
  info "[#{stage}] compute / addresses", title: true
end

.validateObject



44
45
46
47
48
# File 'lib/gclouder/resources/compute/addresses.rb', line 44

def self.validate
  return if Local.list.empty?
  header :validate
  Local.validate
end