cfhighlander 0.5.0.alpha.1535961316 → 0.5.0.alpha.1535961584
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfhighlander.compiler.rb +1 -1
- data/lib/cfhighlander.dsl.params.rb +46 -13
- data/templates/cfndsl.component.template.erb +27 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fffe7543ac877cf4a564748bc368730b6d3f494ec2fbb144d92ebefa30152b7
|
4
|
+
data.tar.gz: d7d6f214ae8af483055cc723f07c494e1155f924283f04bc51baa11157369716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463ccebc895cb0aa7551356604a58ceef5421eb92442d267ec8dc2b386295264903a38c75185365eb0e71310e26722130c7947c0a48104ff4298f1c41262c362
|
7
|
+
data.tar.gz: 2542890fbad5d9df0291823552a3e5f9bcb1ca8050fee5bcd188869caa3b42a2f13a8c94505f5d075c76332a29eb9168cf5877188eb132eccc1683988812f870
|
@@ -84,7 +84,7 @@ module Cfhighlander
|
|
84
84
|
component_cfndsl.gsub!("\n", "\n\t")
|
85
85
|
component_cfndsl.gsub!("\r\n", "\r\n\t")
|
86
86
|
# render cfndsl
|
87
|
-
renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"))
|
87
|
+
renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"), nil, '-')
|
88
88
|
cfn_template = renderer.result(OpenStruct.new({
|
89
89
|
'dsl' => dsl,
|
90
90
|
'component_cfndsl' => component_cfndsl,
|
@@ -35,15 +35,34 @@ module Cfhighlander
|
|
35
35
|
param.provided_value = "#{component}.#{name}"
|
36
36
|
end
|
37
37
|
|
38
|
-
def ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil
|
39
|
-
|
38
|
+
def ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil, allowedPattern: nil,
|
39
|
+
maxLength: nil, maxValue: nil, minLength: nil, minValue: nil, description: nil, constraintDescription: nil)
|
40
|
+
param = Parameter.new(
|
41
|
+
name: name,
|
42
|
+
type: type,
|
43
|
+
defaultValue: defaultValue,
|
44
|
+
noEcho: noEcho,
|
45
|
+
isGlobal: isGlobal,
|
46
|
+
allowedValues: allowedValues,
|
47
|
+
allowedPattern: allowedPattern,
|
48
|
+
maxLength: maxLength,
|
49
|
+
maxValue: maxValue,
|
50
|
+
minLength: minLength,
|
51
|
+
minValue: minValue,
|
52
|
+
description: description,
|
53
|
+
constraintDescription: constraintDescription
|
54
|
+
)
|
40
55
|
param.config = @config
|
41
56
|
addParam param
|
42
57
|
return param
|
43
58
|
end
|
44
59
|
|
45
60
|
def MappingParam(name, defaultValue = '', &block)
|
46
|
-
param = MappingParam.new(
|
61
|
+
param = MappingParam.new(
|
62
|
+
name: name,
|
63
|
+
type: 'String',
|
64
|
+
defaultValue: defaultValue
|
65
|
+
)
|
47
66
|
param.config = @config
|
48
67
|
param.instance_eval(&block)
|
49
68
|
addParam param
|
@@ -60,16 +79,30 @@ module Cfhighlander
|
|
60
79
|
:no_echo,
|
61
80
|
:is_global,
|
62
81
|
:provided_value,
|
63
|
-
:allowed_values
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
82
|
+
:allowed_values,
|
83
|
+
:allowed_pattern,
|
84
|
+
:max_length,
|
85
|
+
:max_value,
|
86
|
+
:min_length,
|
87
|
+
:min_value,
|
88
|
+
:description,
|
89
|
+
:constraint_description
|
90
|
+
|
91
|
+
def initialize(params = {})
|
92
|
+
@no_echo = params.fetch(:noEcho, false)
|
93
|
+
@name = params.fetch(:name)
|
94
|
+
@type = params.fetch(:type)
|
95
|
+
@default_value = params.fetch(:defaultValue)
|
96
|
+
@is_global = params.fetch(:isGlobal, false)
|
97
|
+
@allowed_values = params.fetch(:allowedValues, nil)
|
98
|
+
@provided_value = params.fetch(:providedValue, nil)
|
99
|
+
@allowed_pattern = params.fetch(:allowedPattern, nil)
|
100
|
+
@max_length = params.fetch(:maxLength, nil)
|
101
|
+
@max_value = params.fetch(:maxValue, nil)
|
102
|
+
@min_length = params.fetch(:minLength, nil)
|
103
|
+
@min_value = params.fetch(:minValue, nil)
|
104
|
+
@description = params.fetch(:description, nil)
|
105
|
+
@constraint_description = params.fetch(:constraintDescription, nil)
|
73
106
|
end
|
74
107
|
|
75
108
|
end
|
@@ -35,8 +35,33 @@ CloudFormation do
|
|
35
35
|
Parameter('<%= @param.name %>') do
|
36
36
|
Type '<%= @param.type %>'
|
37
37
|
Default '<%= @param.default_value %>'
|
38
|
-
|
39
|
-
|
38
|
+
<%- unless @param.no_echo.nil? -%>
|
39
|
+
NoEcho <%= @param.no_echo %>
|
40
|
+
<%- end -%>
|
41
|
+
<%- unless @param.allowed_values.nil? -%>
|
42
|
+
AllowedValues <%= @param.allowed_values %>
|
43
|
+
<%- end -%>
|
44
|
+
<%- unless @param.allowed_pattern.nil? -%>
|
45
|
+
AllowedPattern <%= @param.allowed_pattern %>
|
46
|
+
<%- end -%>
|
47
|
+
<%- unless @param.max_length.nil? -%>
|
48
|
+
MaxLength <%= @param.max_length %>
|
49
|
+
<%- end -%>
|
50
|
+
<%- unless @param.max_value.nil? -%>
|
51
|
+
MaxValue <%= @param.max_value %>
|
52
|
+
<%- end -%>
|
53
|
+
<%- unless @param.min_length.nil? -%>
|
54
|
+
MinLength <%= @param.min_length %>
|
55
|
+
<%- end -%>
|
56
|
+
<%- unless @param.min_value.nil? -%>
|
57
|
+
MinValue <%= @param.min_value %>
|
58
|
+
<%- end -%>
|
59
|
+
<%- unless @param.description.nil? -%>
|
60
|
+
Description '<%= @param.description %>'
|
61
|
+
<%- end -%>
|
62
|
+
<%- unless @param.constraint_description.nil? -%>
|
63
|
+
ConstraintDescription '<%= @param.constraint_description %>'
|
64
|
+
<%- end -%>
|
40
65
|
end
|
41
66
|
<% end %>
|
42
67
|
|