module SparkleFormation::SparkleAttribute::OpenStack

Heat specific helper implementations

Public Class Methods

included(klass) click to toggle source

Set customized struct behavior

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 12
def self.included(klass)
  if klass.const_defined?(:CAMEL_KEYS)
    klass.send(:remove_const, :CAMEL_KEYS)
  end
  klass.const_set(:CAMEL_KEYS, false)
end

Public Instance Methods

_attr(*args)
Alias for: _get_attr
_depends_on(*args) click to toggle source

Resource dependency generator @overload _depends_on(resource_name)

@param resource_name [String, Symbol] logical resource name

@overload _depends_on(resource_names)

@param resource_names [Array<String, Symbol>] list of logical resource names

@overload _depends_on(*resource_names)

@param resource_names [Array<String, Symbol>] list of logical resource names

@return [Array<String>] @note this will directly modify the struct at its current context to inject depends on structure

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 191
def _depends_on(*args)
  _set("depends_on", [args].flatten.compact.map { |s| __attribute_key(s) })
end
Also aliased as: depends_on!
_digest(value, algorithm = "sha512") click to toggle source

digest generator

@param value [String, Hash] thing to be hashed @param algorithm [String] algorithm to use (defaults to 'sha512')

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 102
def _digest(value, algorithm = "sha512")
  __t_stringish(algorithm)
  {"digest" => [algorithm, value]}
end
Also aliased as: digest!
_facade(type)
Alias for: _resource_facade
_file(loc)
Alias for: _get_file
_get_attr(*args) click to toggle source

@overload _get_attr(logical_id, attribute_name)

get_attr generator
@param logical_id [String, Symbol] logical resource name
@param attribute_name [String, Symbol] name of desired resource attribute

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 24
def _get_attr(*args)
  __t_stringish(args.first)
  args = args.map do |thing|
    __attribute_key(thing)
  end
  {"get_attr" => args}
end
Also aliased as: _attr, attr!
_get_file(loc) click to toggle source

get_file generator

@param loc [String] @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 58
def _get_file(loc)
  __t_stringish(loc)
  {"get_file" => loc}
end
Also aliased as: _file, file!
_get_param(*args) click to toggle source

@overload _get_param(name)

get_param generator
@param name [String, Symbol] name of parameter

@overload _get_param(name, index1, index2, …)

get_param generator accessing complex data
@param name [String, Symbol] name of parameter
@param index1 [Object] value for key/index
@param index2 [Object] value for key/index

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 75
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
Also aliased as: _param, param!
_get_resource(r_name) click to toggle source

get_resource generator

@param r_name [String, Symbol] @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 90
def _get_resource(r_name)
  __t_stringish(r_name)
  {"get_resource" => __attribute_key(r_name)}
end
Also aliased as: _resource, resource!
_join(*args)
Alias for: _list_join
_list_join(*args) click to toggle source

@overload _list_join(*args, opts={})

list_join generator
@param args [String, Hash] list of items to join
@param opts [Hash]
@option opts [Hash] :options options for join function
@option options [String] :delimiter value used for joining items. Defaults to ''

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 42
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
Also aliased as: _join, join!
_map_merge(*args) click to toggle source

@overload _map_merge(hash1, hash2, …)

map_merge generator
@param hash1 [Hash] item to merge
@param hash2 [Hash] item to merge

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 155
def _map_merge(*args)
  {"map_merge" => args}
end
Also aliased as: map_merge!
_param(*args)
Alias for: _get_param
_project_id() click to toggle source

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 176
def _project_id
  _get_param("OS::project_id")
end
Also aliased as: project_id!
_replace(template, params)
Alias for: _str_replace
_resource(r_name)
Alias for: _get_resource
_resource_facade(type) click to toggle source

resource_facade generator

@param type [String, Symbol] @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 113
def _resource_facade(type)
  __t_stringish(type)
  {"resource_facade" => type}
end
Also aliased as: _facade, facade!, resource_facade!
_split(splitter, string, idx = nil)
Alias for: _str_split
_stack_id() click to toggle source

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 162
def _stack_id
  _get_param("OS::stack_id")
end
Also aliased as: stack_id!
_stack_name() click to toggle source

@return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 169
def _stack_name
  _get_param("OS::stack_name")
end
Also aliased as: stack_name!
_stack_output(stack_name, output_name) click to toggle source

Reference output value from nested stack

@param stack_name [String, Symbol] logical resource name of stack @param output_name [String, Symbol] stack output name @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 202
def _stack_output(stack_name, output_name)
  _attr(
    __attribute_key(stack_name),
    __attribute_key(output_name)
  )
end
Also aliased as: stack_output!
_str_replace(template, params) click to toggle source

str_replace generator

@param template [String] @param params [Hash] @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 127
def _str_replace(template, params)
  __t_stringish(template)
  __t_hashish(params)
  {"str_replace" => {"template" => template, "params" => params}}
end
Also aliased as: _replace, replace!
_str_split(splitter, string, idx = nil) click to toggle source

str_split generator

@param splitter [String] @param string [Object] @param idx [Numeric] @return [Hash]

# File lib/sparkle_formation/sparkle_attribute/heat.rb, line 142
def _str_split(splitter, string, idx = nil)
  __t_stringish(splitter) unless splitter.is_a?(Hash)
  {"str_split" => [splitter, string, idx].compact}
end
Also aliased as: _split, split!
attr!(*args)
Alias for: _get_attr
depends_on!(*args)
Alias for: _depends_on
digest!(value, algorithm = "sha512")
Alias for: _digest
facade!(type)
Alias for: _resource_facade
file!(loc)
Alias for: _get_file
join!(*args)
Alias for: _list_join
map_merge!(*args)
Alias for: _map_merge
param!(*args)
Alias for: _get_param
project_id!()
Alias for: _project_id
replace!(template, params)
Alias for: _str_replace
resource!(r_name)
Alias for: _get_resource
resource_facade!(type)
Alias for: _resource_facade
split!(splitter, string, idx = nil)
Alias for: _str_split
stack_id!()
Alias for: _stack_id
stack_name!()
Alias for: _stack_name
stack_output!(stack_name, output_name)
Alias for: _stack_output