Class: Cfhighlander::Dsl::Parameters

Inherits:
DslBase
  • Object
show all
Defined in:
lib/cfhighlander.dsl.params.rb

Overview

dsl statements

Instance Attribute Summary collapse

Attributes inherited from DslBase

#config

Instance Method Summary collapse

Methods inherited from DslBase

#AWSAccountId, #AWSNoValue, #AWSNotificationARNs, #AWSPartition, #AWSStackName, #AWSStackRegion, #AWSURLSuffix, #FindInMap, #FnAnd, #FnBase64, #FnCidr, #FnEquals, #FnFindInMap, #FnGetAZs, #FnGetAtt, #FnIf, #FnImportValue, #FnJoin, #FnNot, #FnOr, #FnSelect, #FnSplit, #FnSub, #GetAtt, #Ref, #cfmap, #cfout, #method_missing

Constructor Details

#initializeParameters

Returns a new instance of Parameters.



12
13
14
# File 'lib/cfhighlander.dsl.params.rb', line 12

def initialize()
  @param_list = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cfhighlander::Dsl::DslBase

Instance Attribute Details

#param_listObject

Returns the value of attribute param_list.



10
11
12
# File 'lib/cfhighlander.dsl.params.rb', line 10

def param_list
  @param_list
end

Instance Method Details

#addParam(param) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/cfhighlander.dsl.params.rb', line 16

def addParam(param)
  existing_param = @param_list.find {|p| p.name == param.name}
  if not existing_param.nil?
    puts "Parameter being overwritten. Updating parameter #{param.name} with new definition..."
    @param_list[@param_list.index(existing_param)] = param
  else
    @param_list << param
  end
end

#ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil, allowedPattern: nil, maxLength: nil, maxValue: nil, minLength: nil, minValue: nil, description: nil, constraintDescription: nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cfhighlander.dsl.params.rb', line 38

def ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil, allowedPattern: nil,
                    maxLength: nil, maxValue: nil, minLength: nil, minValue: nil, description: nil, constraintDescription: nil)
  param = Parameter.new(
    name: name,
    type: type,
    defaultValue: defaultValue,
    noEcho: noEcho,
    isGlobal: isGlobal,
    allowedValues: allowedValues,
    allowedPattern: allowedPattern,
    maxLength: maxLength,
    maxValue: maxValue,
    minLength: minLength,
    minValue: minValue,
    description: description,
    constraintDescription: constraintDescription
  )
  param.config = @config
  addParam param
  return param
end

#MappingParam(name, defaultValue = '', &block) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/cfhighlander.dsl.params.rb', line 60

def MappingParam(name, defaultValue = '', &block)
  param = MappingParam.new(
    name: name,
    type: 'String',
    defaultValue: defaultValue
  )
  param.config = @config
  param.instance_eval(&block)
  addParam param
end

#OutputParam(component:, name:, isGlobal: false, noEcho: false, type: 'String') ⇒ Object



31
32
33
34
35
36
# File 'lib/cfhighlander.dsl.params.rb', line 31

def OutputParam(component:, name:, isGlobal: false, noEcho: false, type: 'String')
  STDERR.puts ("DEPRECATED: OutputParam #{name} - Use ComponentParam instead. Outputut params are " +
      "autorwired by name only, with component disregarded")
  param = ComponentParam(name, '', isGlobal: isGlobal, noEcho: noEcho, type: type)
  param.provided_value = "#{component}.#{name}"
end

#StackParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String') ⇒ Object



26
27
28
29
# File 'lib/cfhighlander.dsl.params.rb', line 26

def StackParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String')
  STDERR.puts "DEPRECATED: StackParam #{name} - Use ComponentParam instead"
  ComponentParam(name, defaultValue, isGlobal: isGlobal, noEcho: noEcho, type: type)
end