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)


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

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



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

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)


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

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



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

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



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

def store_template(*_)
end

#template_content(thing, *_) ⇒ Hash

Override template content extraction to disable scrub behavior

Parameters:

  • thing (SparkleFormation, Hash)

Returns:

  • (Hash)


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

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



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

def validate_nesting_bucket!
  true
end

#validate_stack_parameter(*_) ⇒ Object

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



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

def validate_stack_parameter(*_)
  true
end