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
-
.included(klass) ⇒ Object
Set customized struct behavior.
Instance Method Summary collapse
-
#_depends_on(*args) ⇒ Array<String>
(also: #depends_on!)
Resource dependency generator.
-
#_digest(value, algorithm = 'sha512') ⇒ Object
(also: #digest!)
digest generator.
-
#_get_attr(logical_id, attribute_name) ⇒ Hash
(also: #_attr, #attr!)
get_attr generator.
-
#_get_file(loc) ⇒ Hash
(also: #_file, #file!)
get_file generator.
- #_get_param(*args) ⇒ Hash (also: #_param, #param!)
-
#_get_resource(r_name) ⇒ Hash
(also: #_resource, #resource!)
get_resource generator.
-
#_list_join(*args, opts = {}) ⇒ Hash
(also: #_join, #join!)
list_join generator.
-
#_map_merge(hash1, hash2, ...) ⇒ Hash
(also: #map_merge!)
map_merge generator.
- #_project_id ⇒ Hash (also: #project_id!)
-
#_resource_facade(type) ⇒ Hash
(also: #_facade, #facade!, #resource_facade!)
resource_facade generator.
- #_stack_id ⇒ Hash (also: #stack_id!)
- #_stack_name ⇒ Hash (also: #stack_name!)
-
#_stack_output(stack_name, output_name) ⇒ Hash
(also: #stack_output!)
Reference output value from nested stack.
-
#_str_replace(template, params) ⇒ Hash
(also: #_replace, #replace!)
str_replace generator.
-
#_str_split(splitter, string, idx = nil) ⇒ Hash
(also: #_split, #split!)
str_split generator.
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(resource_name) ⇒ Array<String> #_depends_on(resource_names) ⇒ Array<String> #_depends_on(*resource_names) ⇒ Array<String> Also known as: depends_on!
Note:
this will directly modify the struct at its current context to inject depends on structure
Resource dependency generator
175 176 177 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 175 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!
digest generator
94 95 96 97 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 94 def _digest(value, algorithm='sha512') __t_string(algorithm) {'digest' => [algorithm, value]} end |
#_get_attr(logical_id, attribute_name) ⇒ Hash Also known as: _attr, attr!
21 22 23 24 25 26 27 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 21 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
53 54 55 56 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 53 def _get_file(loc) __t_string(loc) {'get_file' => loc} end |
#_get_param(name) ⇒ Hash #_get_param(name, index1, index2, ...) ⇒ Hash Also known as: _param, param!
69 70 71 72 73 74 75 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 69 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
83 84 85 86 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 83 def _get_resource(r_name) __t_stringish(r_name) {'get_resource' => __attribute_key(r_name)} end |
#_list_join(*args, opts = {}) ⇒ Hash Also known as: _join, join!
38 39 40 41 42 43 44 45 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 38 def _list_join(*args) = args.detect{|i| i.is_a?(::Hash) && i[:options]} || {:options => {}} args.delete() unless(args.size == 1) args = [args] end {'list_join' => [[:options][:delimiter] || '', *args]} end |
#_map_merge(hash1, hash2, ...) ⇒ Hash Also known as: map_merge!
143 144 145 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 143 def _map_merge(*args) {'map_merge' => args} end |
#_project_id ⇒ Hash Also known as: project_id!
161 162 163 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 161 def _project_id _get_param('OS::project_id') end |
#_resource_facade(type) ⇒ Hash Also known as: _facade, facade!, resource_facade!
resource_facade generator
104 105 106 107 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 104 def _resource_facade(type) __t_stringish(type) {'resource_facade' => type} end |
#_stack_id ⇒ Hash Also known as: stack_id!
149 150 151 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 149 def _stack_id _get_param('OS::stack_id') end |
#_stack_name ⇒ Hash Also known as: stack_name!
155 156 157 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 155 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
185 186 187 188 189 190 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 185 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
117 118 119 120 121 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 117 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
131 132 133 134 |
# File 'lib/sparkle_formation/sparkle_attribute/heat.rb', line 131 def _str_split(splitter, string, idx=nil) __t_string(splitter) {'str_split' => [splitter, string, idx].compact} end |