Module: Sfn::ApiProvider::Google

Defined in:
lib/sfn/api_provider/google.rb

Instance Method Summary collapse

Instance Method Details

#extract_current_nested_template_parameters(stack, stack_name, c_stack) ⇒ Hash

Extract current parameters from parent template

Parameters:

  • stack (SparkleFormation)
  • stack_name (String)
  • c_stack (Miasma::Models::Orchestration::Stack)

Returns:

  • (Hash)


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sfn/api_provider/google.rb', line 22

def extract_current_nested_template_parameters(stack, stack_name, c_stack)
  if c_stack && c_stack.data[:parent_stack]
    c_stack.data[:parent_stack].sparkleish_template(:remove_wrapper).fetch(
      :resources, stack_name, :properties, :parameters, Smash.new
    )
  elsif stack.parent
    val = stack.parent.compile.resources.set!(stack_name).properties
    val.nil? ? Smash.new : val._dump
  else
    Smash.new
  end
end

#format_nested_stack_results(*_) ⇒ Object

No formatting required on stack results



12
13
14
# File 'lib/sfn/api_provider/google.rb', line 12

def format_nested_stack_results(*_)
  {}
end

#function_set_parameter?(val) ⇒ TrueClass, FalseClass

Determine if parameter was set via intrinsic function

Parameters:

  • val (Object)

Returns:

  • (TrueClass, FalseClass)


44
45
46
47
48
# File 'lib/sfn/api_provider/google.rb', line 44

def function_set_parameter?(val)
  if val
    val.start_with?("$(") || val.start_with?("{{")
  end
end

#populate_parameters!(template, opts = {}) ⇒ Object

Set parameters into parent resource properites



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sfn/api_provider/google.rb', line 51

def populate_parameters!(template, opts = {})
  result = super
  result.each_pair do |key, value|
    if template.parent
      template.parent.compile.resources.set!(template.name).properties.set!(key, value)
    else
      template.compile.resources.set!(template.name).properties.set!(key, value)
    end
  end
  {}
end

#store_template(*_) ⇒ Object

Disable remote template storage



8
9
# File 'lib/sfn/api_provider/google.rb', line 8

def store_template(*_)
end

#template_content(thing, *_) ⇒ Hash

Override template content extraction to disable scrub behavior

Parameters:

  • thing (SparkleFormation, Hash)

Returns:

  • (Hash)


72
73
74
75
76
77
78
# File 'lib/sfn/api_provider/google.rb', line 72

def template_content(thing, *_)
  if thing.is_a?(SparkleFormation)
    config[:sparkle_dump] ? thing.sparkle_dump : thing.dump
  else
    thing
  end
end

#validate_nesting_bucket!Object

Override requirement of nesting bucket



64
65
66
# File 'lib/sfn/api_provider/google.rb', line 64

def validate_nesting_bucket!
  true
end

#validate_stack_parameter(*_) ⇒ Object

Disable parameter validate as we can't adjust them without template modifications



36
37
38
# File 'lib/sfn/api_provider/google.rb', line 36

def validate_stack_parameter(*_)
  true
end