Module: GClouder::Resources::Compute::Networks::Subnets

Includes:
Config::Arguments, Config::CLIArgs, Config::Project, Logging, GClouder::Resource::Cleaner
Defined in:
lib/gclouder/resources/compute/networks/subnets.rb

Defined Under Namespace

Modules: Local, Remote, Subnet

Class Method Summary collapse

Methods included from GClouder::Resource::Cleaner

#clean, #cleaner, included, #undefined

Methods included from Config::Arguments

arguments, #arguments, included, load, permitted, required

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

load, #project, project

Methods included from Helpers

#hash_to_args, included, #module_exists?, #to_arg, #to_deep_merge_hash, #valid_json?

Methods included from Config::CLIArgs

cli_args, #cli_args, included, load, valid_resources

Class Method Details

.checkObject



38
39
40
41
42
43
# File 'lib/gclouder/resources/compute/networks/subnets.rb', line 38

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



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gclouder/resources/compute/networks/subnets.rb', line 24

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

  Local.list.each do |region, subnets|
    next if subnets.empty?
    info region, heading: true, indent: 2
    info
    subnets.each do |subnet|
      Subnet.ensure(region, subnet["network"], subnet["name"], subnet["range"])
    end
  end
end

.header(stage = :ensure) ⇒ Object



14
15
16
# File 'lib/gclouder/resources/compute/networks/subnets.rb', line 14

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

.validateObject



18
19
20
21
22
# File 'lib/gclouder/resources/compute/networks/subnets.rb', line 18

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