Module: SparkleFormation::SparkleAttribute::Heat

Included in:
Rackspace
Defined in:
lib/sparkle_formation/sparkle_attribute/heat.rb

Overview

Heat specific helper implementations

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Set customized struct behavior



12
13
14
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 12

def self.included(klass)
  klass.const_set(:CAMEL_KEYS, false)
end

Instance Method Details

#_depends_on(*args) ⇒ Array<String> Also known as: depends_on!

Resource dependency generator

Parameters:

  • resource (Symbol, String, Array<Symbol, String>)

    names

Returns:

  • (Array<String>)


156
157
158
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 156

def _depends_on(*args)
  _set('depends_on', [args].flatten.compact.map{|s| __attribute_key(s) })
end

#_digest(value, algorithm = 'sha512') ⇒ Object Also known as: digest!



81
82
83
84
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 81

def _digest(value, algorithm='sha512')
  __t_string(algorithm)
  {'digest' => [algorithm, value]}
end

#_get_attr(*args) ⇒ Hash Also known as: _attr, attr!

get_attr generator

Parameters:

  • pass (Object)

    through arguments

Returns:

  • (Hash)


20
21
22
23
24
25
26
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 20

def _get_attr(*args)
  __t_stringish(args.first)
  args = args.map do |thing|
    __attribute_key(thing)
  end
  {'get_attr' => args}
end

#_get_file(loc) ⇒ Hash Also known as: _file, file!

get_file generator

Parameters:

  • loc (String)

Returns:

  • (Hash)


49
50
51
52
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 49

def _get_file(loc)
  __t_string(loc)
  {'get_file' => loc}
end

#_get_param(*args) ⇒ Hash Also known as: _param, param!

get_param generator

Parameters:

  • args (Object)

Returns:

  • (Hash)


60
61
62
63
64
65
66
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 60

def _get_param(*args)
  __t_stringish(args.first)
  args = args.map do |thing|
    __attribute_key(thing)
  end
  {'get_param' => args.size == 1 ? args.first : args}
end

#_get_resource(r_name) ⇒ Hash Also known as: _resource, resource!

get_resource generator

Parameters:

  • r_name (String, Symbol)

Returns:

  • (Hash)


74
75
76
77
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 74

def _get_resource(r_name)
  __t_stringish(r_name)
  {'get_resource' => __attribute_key(r_name)}
end

#_list_join(*args) ⇒ Hash Also known as: _join, join!

list_join generator

Parameters:

  • args (Object)

Returns:

  • (Hash)


34
35
36
37
38
39
40
41
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 34

def _list_join(*args)
  options = args.detect{|i| i.is_a?(::Hash) && i[:options]} || {:options => {}}
  args.delete(options)
  unless(args.size == 1)
    args = [args]
  end
  {'list_join' => [options[:options][:delimiter] || '', *args]}
end

#_map_merge(*args) ⇒ Hash Also known as: map_merge!

map_merge generator

Parameters:

  • args (Object)

Returns:

  • (Hash)


129
130
131
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 129

def _map_merge(*args)
  {'map_merge' => args}
end

#_project_idHash Also known as: project_id!

Returns:

  • (Hash)


147
148
149
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 147

def _project_id
  _get_param('OS::project_id')
end

#_resource_facade(type) ⇒ Hash Also known as: _facade, facade!, resource_facade!

resource_facade generator

Parameters:

  • type (String, Symbol)

Returns:

  • (Hash)


91
92
93
94
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 91

def _resource_facade(type)
  __t_stringish(type)
  {'resource_facade' => type}
end

#_stack_idHash Also known as: stack_id!

Returns:

  • (Hash)


135
136
137
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 135

def _stack_id
  _get_param('OS::stack_id')
end

#_stack_nameHash Also known as: stack_name!

Returns:

  • (Hash)


141
142
143
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 141

def _stack_name
  _get_param('OS::stack_name')
end

#_stack_output(stack_name, output_name) ⇒ Hash Also known as: stack_output!

Reference output value from nested stack

Parameters:

  • stack_name (String, Symbol)

    logical resource name of stack

  • output_name (String, Symbol)

    stack output name

Returns:

  • (Hash)


166
167
168
169
170
171
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 166

def _stack_output(stack_name, output_name)
  _attr(
    __attribute_key(stack_name),
    __attribute_key(output_name)
  )
end

#_str_replace(template, params) ⇒ Hash Also known as: _replace, replace!

str_replace generator

Parameters:

  • template (String)
  • params (Hash)

Returns:

  • (Hash)


104
105
106
107
108
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 104

def _str_replace(template, params)
  __t_stringish(template)
  __t_hashish(params)
  {'str_replace' => {'template' => template, 'params' => params}}
end

#_str_split(splitter, string, idx = nil) ⇒ Hash Also known as: _split, split!

str_split generator

Parameters:

  • splitter (String)
  • string (Object)
  • idx (Numeric) (defaults to: nil)

Returns:

  • (Hash)


118
119
120
121
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 118

def _str_split(splitter, string, idx=nil)
  __t_string(splitter)
  {'str_split' => [splitter, string, idx].compact}
end