Module: GClouder::Resources::Functions::Function::Function

Includes:
GCloud
Defined in:
lib/gclouder/resources/functions/function.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

.ensure(region, function) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/gclouder/resources/functions/function.rb', line 64

def self.ensure(region, function)
  filter_value = "projects/#{project['project_id']}/locations/#{region}/functions/#{function["name"]}"
  type = Resource::resource?("beta functions", function["name"], filter_value: filter_value) ? "change" : "add"

  Resource::feedback(type, "beta functions", function["name"])
  gcloud "beta functions deploy #{function["name"]} #{hash_to_args(function)} --region=#{region}", config_relative: true
end

.purge(region, function) ⇒ Object



72
73
74
# File 'lib/gclouder/resources/functions/function.rb', line 72

def self.purge(region, function)
  Resource.purge :"beta functions", function["name"], "--region=#{region}"
end