sparkle_formation 3.0.30 → 3.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/sparkle_formation.rb +23 -23
- data/lib/sparkle_formation/aws.rb +1 -1
- data/lib/sparkle_formation/composition.rb +7 -7
- data/lib/sparkle_formation/error.rb +2 -2
- data/lib/sparkle_formation/function_struct.rb +22 -22
- data/lib/sparkle_formation/provider.rb +7 -7
- data/lib/sparkle_formation/provider/aws.rb +28 -28
- data/lib/sparkle_formation/provider/azure.rb +7 -7
- data/lib/sparkle_formation/provider/google.rb +16 -16
- data/lib/sparkle_formation/provider/heat.rb +6 -6
- data/lib/sparkle_formation/provider/terraform.rb +7 -7
- data/lib/sparkle_formation/resources.rb +18 -18
- data/lib/sparkle_formation/resources/aws.rb +216 -126
- data/lib/sparkle_formation/resources/aws_resources.json +3463 -1601
- data/lib/sparkle_formation/resources/azure.rb +6 -6
- data/lib/sparkle_formation/resources/google.rb +7 -7
- data/lib/sparkle_formation/resources/heat.rb +2 -2
- data/lib/sparkle_formation/resources/rackspace.rb +2 -2
- data/lib/sparkle_formation/resources/terraform.rb +6 -6
- data/lib/sparkle_formation/sparkle.rb +32 -32
- data/lib/sparkle_formation/sparkle_attribute.rb +10 -10
- data/lib/sparkle_formation/sparkle_attribute/aws.rb +30 -30
- data/lib/sparkle_formation/sparkle_attribute/azure.rb +39 -39
- data/lib/sparkle_formation/sparkle_attribute/google.rb +19 -19
- data/lib/sparkle_formation/sparkle_attribute/heat.rb +16 -16
- data/lib/sparkle_formation/sparkle_attribute/rackspace.rb +1 -1
- data/lib/sparkle_formation/sparkle_attribute/terraform.rb +41 -41
- data/lib/sparkle_formation/sparkle_collection.rb +4 -4
- data/lib/sparkle_formation/sparkle_collection/rainbow.rb +3 -3
- data/lib/sparkle_formation/sparkle_formation.rb +31 -31
- data/lib/sparkle_formation/sparkle_struct.rb +5 -5
- data/lib/sparkle_formation/translation.rb +32 -32
- data/lib/sparkle_formation/translation/heat.rb +126 -126
- data/lib/sparkle_formation/translation/rackspace.rb +118 -118
- data/lib/sparkle_formation/utils.rb +5 -5
- data/lib/sparkle_formation/version.rb +1 -1
- data/sparkle_formation.gemspec +1 -1
- metadata +7 -7
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -9,9 +9,9 @@ class SparkleFormation
|
|
9
9
|
class Azure < Resources
|
10
10
|
|
11
11
|
# Characters to be removed from supplied key on matching
|
12
|
-
RESOURCE_TYPE_TR =
|
12
|
+
RESOURCE_TYPE_TR = "/._"
|
13
13
|
# String to split for resource namespacing
|
14
|
-
RESOURCE_TYPE_NAMESPACE_SPLITTER = [
|
14
|
+
RESOURCE_TYPE_NAMESPACE_SPLITTER = [".", "/"]
|
15
15
|
|
16
16
|
class << self
|
17
17
|
include Bogo::Memoization
|
@@ -24,7 +24,7 @@ class SparkleFormation
|
|
24
24
|
load(
|
25
25
|
File.join(
|
26
26
|
File.dirname(__FILE__),
|
27
|
-
|
27
|
+
"azure_resources.json"
|
28
28
|
)
|
29
29
|
)
|
30
30
|
true
|
@@ -44,10 +44,10 @@ class SparkleFormation
|
|
44
44
|
# @return [SparkleStruct]
|
45
45
|
def resource_customizer(struct, lookup_key)
|
46
46
|
info = registry[lookup_key]
|
47
|
-
if info[:required].include?(
|
47
|
+
if info[:required].include?("apiVersion") && struct.api_version.nil?
|
48
48
|
struct.api_version info[:api_version]
|
49
49
|
end
|
50
|
-
if info[:required].include?(
|
50
|
+
if info[:required].include?("location") && struct.location.nil?
|
51
51
|
struct.location struct.resource_group!.location
|
52
52
|
end
|
53
53
|
struct
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -9,9 +9,9 @@ class SparkleFormation
|
|
9
9
|
class Google < Resources
|
10
10
|
|
11
11
|
# Characters to be removed from supplied key on matching
|
12
|
-
RESOURCE_TYPE_TR =
|
12
|
+
RESOURCE_TYPE_TR = "._"
|
13
13
|
# String to split for resource namespacing
|
14
|
-
RESOURCE_TYPE_NAMESPACE_SPLITTER = [
|
14
|
+
RESOURCE_TYPE_NAMESPACE_SPLITTER = ["."]
|
15
15
|
|
16
16
|
class << self
|
17
17
|
include Bogo::Memoization
|
@@ -24,13 +24,13 @@ class SparkleFormation
|
|
24
24
|
load(
|
25
25
|
File.join(
|
26
26
|
File.dirname(__FILE__),
|
27
|
-
|
27
|
+
"google_resources.json"
|
28
28
|
)
|
29
29
|
)
|
30
30
|
# NOTE: Internal resource type used for nesting
|
31
|
-
registry[
|
32
|
-
|
33
|
-
|
31
|
+
registry["sparkleformation.stack"] = {
|
32
|
+
"properties" => [],
|
33
|
+
"full_properties" => {},
|
34
34
|
}
|
35
35
|
true
|
36
36
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -18,7 +18,7 @@ class SparkleFormation
|
|
18
18
|
load(
|
19
19
|
File.join(
|
20
20
|
File.dirname(__FILE__),
|
21
|
-
|
21
|
+
"rackspace_resources.json"
|
22
22
|
)
|
23
23
|
)
|
24
24
|
true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -9,7 +9,7 @@ class SparkleFormation
|
|
9
9
|
class Terraform < Resources
|
10
10
|
|
11
11
|
# String to split for resource namespacing
|
12
|
-
RESOURCE_TYPE_NAMESPACE_SPLITTER = [
|
12
|
+
RESOURCE_TYPE_NAMESPACE_SPLITTER = ["_"]
|
13
13
|
|
14
14
|
class << self
|
15
15
|
include Bogo::Memoization
|
@@ -22,13 +22,13 @@ class SparkleFormation
|
|
22
22
|
load(
|
23
23
|
File.join(
|
24
24
|
File.dirname(__FILE__),
|
25
|
-
|
25
|
+
"terraform_resources.json"
|
26
26
|
)
|
27
27
|
)
|
28
28
|
# NOTE: Internal resource type used for nesting
|
29
|
-
register(
|
30
|
-
|
31
|
-
|
29
|
+
register("module",
|
30
|
+
"properties" => [],
|
31
|
+
"full_properties" => {})
|
32
32
|
true
|
33
33
|
end
|
34
34
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
# Unicorns and rainbows
|
4
4
|
class SparkleFormation
|
@@ -20,14 +20,14 @@ class SparkleFormation
|
|
20
20
|
idx = idx ? idx.next : 0
|
21
21
|
# Trim from the end to determine path allowing windows paths
|
22
22
|
# to not be improperly truncated
|
23
|
-
file = caller[idx].split(
|
24
|
-
path = File.join(File.dirname(file),
|
23
|
+
file = caller[idx].split(":").reverse.drop(2).reverse.join(":")
|
24
|
+
path = File.join(File.dirname(file), "sparkleformation")
|
25
25
|
unless File.directory?(path)
|
26
26
|
path = nil
|
27
27
|
end
|
28
28
|
unless name
|
29
29
|
name = File.basename(file)
|
30
|
-
name.sub!(File.extname(name),
|
30
|
+
name.sub!(File.extname(name), "")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
unless name
|
@@ -36,10 +36,10 @@ class SparkleFormation
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
unless path
|
39
|
-
raise ArgumentError.new(
|
39
|
+
raise ArgumentError.new("No SparklePack path provided and failed to auto-detect!")
|
40
40
|
end
|
41
41
|
unless name
|
42
|
-
raise ArgumentError.new(
|
42
|
+
raise ArgumentError.new("No SparklePack name provided and failed to auto-detect!")
|
43
43
|
end
|
44
44
|
@@_pack_registry[name] = path
|
45
45
|
[name, path]
|
@@ -65,7 +65,7 @@ class SparkleFormation
|
|
65
65
|
# Evaluation context wrapper for loading SparkleFormation files
|
66
66
|
Class.new(BasicObject).new.instance_exec do
|
67
67
|
wrapper = ::Class.new(BasicObject)
|
68
|
-
wrapper.class_eval
|
68
|
+
wrapper.class_eval "
|
69
69
|
class SparkleFormation
|
70
70
|
attr_accessor :sparkle_path
|
71
71
|
|
@@ -187,7 +187,7 @@ class SparkleFormation
|
|
187
187
|
def __sfn_registry_id
|
188
188
|
SfnRegistry.object_id
|
189
189
|
end
|
190
|
-
|
190
|
+
"
|
191
191
|
wrapper.new
|
192
192
|
end
|
193
193
|
end
|
@@ -196,26 +196,26 @@ class SparkleFormation
|
|
196
196
|
|
197
197
|
# Valid directories from cwd to set as root
|
198
198
|
VALID_ROOT_DIRS = [
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
"sparkleformation",
|
200
|
+
"sfn",
|
201
|
+
"cloudformation",
|
202
|
+
"cfn",
|
203
|
+
".",
|
204
204
|
]
|
205
205
|
|
206
206
|
# Reserved directories
|
207
207
|
DIRS = [
|
208
|
-
|
209
|
-
|
210
|
-
|
208
|
+
"components",
|
209
|
+
"registry",
|
210
|
+
"dynamics",
|
211
211
|
]
|
212
212
|
|
213
213
|
# Valid types
|
214
214
|
TYPES = Smash.new(
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
"component" => "components",
|
216
|
+
"registry" => "registries",
|
217
|
+
"dynamic" => "dynamics",
|
218
|
+
"template" => "templates",
|
219
219
|
)
|
220
220
|
|
221
221
|
# @return [String] path to sparkle directories
|
@@ -247,7 +247,7 @@ class SparkleFormation
|
|
247
247
|
:registry => [],
|
248
248
|
:template => [],
|
249
249
|
)
|
250
|
-
@provider = Bogo::Utility.snake(args.fetch(:provider,
|
250
|
+
@provider = Bogo::Utility.snake(args.fetch(:provider, "aws").to_s).to_sym
|
251
251
|
@wrapper = eval_wrapper
|
252
252
|
wrapper.part_data(raw_data)
|
253
253
|
load_parts! unless @root == :none
|
@@ -290,19 +290,19 @@ class SparkleFormation
|
|
290
290
|
# @raises [NameError, Error::NotFound]
|
291
291
|
def get(type, name, target_provider = nil)
|
292
292
|
unless TYPES.keys.include?(type.to_s)
|
293
|
-
raise NameError.new "Invalid type requested (#{type})! Valid types: #{TYPES.keys.join(
|
293
|
+
raise NameError.new "Invalid type requested (#{type})! Valid types: #{TYPES.keys.join(", ")}"
|
294
294
|
end
|
295
295
|
unless target_provider
|
296
296
|
target_provider = provider
|
297
297
|
end
|
298
298
|
result = send(TYPES[type]).get(target_provider, name)
|
299
|
-
if result.nil? && TYPES[type] ==
|
299
|
+
if result.nil? && TYPES[type] == "templates"
|
300
300
|
result = (send(TYPES[type]).fetch(target_provider, Smash.new).detect { |_, v|
|
301
301
|
name = name.to_s
|
302
|
-
short_name = v[:path].sub(%r{#{Regexp.escape(root)}/?},
|
302
|
+
short_name = v[:path].sub(%r{#{Regexp.escape(root)}/?}, "")
|
303
303
|
v[:path] == name ||
|
304
304
|
short_name == name ||
|
305
|
-
short_name.sub(
|
305
|
+
short_name.sub(".rb", "").gsub(File::SEPARATOR, "__").tr("-", "_") == name ||
|
306
306
|
v[:path].end_with?(name)
|
307
307
|
} || []).last
|
308
308
|
end
|
@@ -338,18 +338,18 @@ class SparkleFormation
|
|
338
338
|
# Load all sparkle parts
|
339
339
|
def load_parts!
|
340
340
|
memoize(:load_parts) do
|
341
|
-
Dir.glob(File.join(root,
|
342
|
-
slim_path = file.sub("#{root}/",
|
343
|
-
if file.end_with?(
|
341
|
+
Dir.glob(File.join(root, "**", "**", "*.{json,rb}")).each do |file|
|
342
|
+
slim_path = file.sub("#{root}/", "")
|
343
|
+
if file.end_with?(".rb")
|
344
344
|
begin
|
345
345
|
wrapper.instance_eval(IO.read(file), file, 1)
|
346
346
|
rescue TypeError
|
347
347
|
end
|
348
348
|
end
|
349
|
-
if file.end_with?(
|
349
|
+
if file.end_with?(".json") || raw_data[:template].first
|
350
350
|
data = raw_data[:template].pop || Smash.new
|
351
351
|
unless data[:name]
|
352
|
-
data[:name] = slim_path.tr(
|
352
|
+
data[:name] = slim_path.tr("/", "__").sub(/\.(rb|json)$/, "")
|
353
353
|
end
|
354
354
|
t_provider = data.fetch(:args, :provider, :aws)
|
355
355
|
if templates.get(t_provider, data[:name])
|
@@ -359,7 +359,7 @@ class SparkleFormation
|
|
359
359
|
data.merge(
|
360
360
|
:type => :template,
|
361
361
|
:path => file,
|
362
|
-
:serialized => !file.end_with?(
|
362
|
+
:serialized => !file.end_with?(".rb"),
|
363
363
|
))
|
364
364
|
end
|
365
365
|
end
|
@@ -369,7 +369,7 @@ class SparkleFormation
|
|
369
369
|
collection = send(TYPES[key])
|
370
370
|
name = item.delete(:name)
|
371
371
|
else
|
372
|
-
path = item[:block].source_location.first.sub(
|
372
|
+
path = item[:block].source_location.first.sub(".rb", "").split(File::SEPARATOR)
|
373
373
|
type, name = path.slice(path.size - 2, 2)
|
374
374
|
collection = send(type)
|
375
375
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
5
5
|
# Provides template helper methods
|
6
6
|
module SparkleAttribute
|
7
|
-
autoload :Aws,
|
8
|
-
autoload :Azure,
|
9
|
-
autoload :Google,
|
10
|
-
autoload :Heat,
|
11
|
-
autoload :OpenStack,
|
12
|
-
autoload :Rackspace,
|
13
|
-
autoload :Terraform,
|
7
|
+
autoload :Aws, "sparkle_formation/sparkle_attribute/aws"
|
8
|
+
autoload :Azure, "sparkle_formation/sparkle_attribute/azure"
|
9
|
+
autoload :Google, "sparkle_formation/sparkle_attribute/google"
|
10
|
+
autoload :Heat, "sparkle_formation/sparkle_attribute/heat"
|
11
|
+
autoload :OpenStack, "sparkle_formation/sparkle_attribute/heat"
|
12
|
+
autoload :Rackspace, "sparkle_formation/sparkle_attribute/rackspace"
|
13
|
+
autoload :Terraform, "sparkle_formation/sparkle_attribute/terraform"
|
14
14
|
|
15
15
|
# Return current resource name
|
16
16
|
#
|
@@ -28,7 +28,7 @@ class SparkleFormation
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
unless result
|
31
|
-
::Kernel.raise NameError.new
|
31
|
+
::Kernel.raise NameError.new "Failed to determine current resource name! (Check call location)"
|
32
32
|
end
|
33
33
|
if result.is_a?(::SparkleFormation::FunctionStruct)
|
34
34
|
result = result._clone
|
@@ -43,7 +43,7 @@ class SparkleFormation
|
|
43
43
|
# @param command [String]
|
44
44
|
# @return [String] result
|
45
45
|
def _system(command)
|
46
|
-
::Kernel.send(
|
46
|
+
::Kernel.send("`", command)
|
47
47
|
end
|
48
48
|
|
49
49
|
alias_method :system!, :_system
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -21,7 +21,7 @@ class SparkleFormation
|
|
21
21
|
unless args.size == 1
|
22
22
|
args = [args]
|
23
23
|
end
|
24
|
-
{
|
24
|
+
{"Fn::Join" => [options[:options][:delimiter] || "", *args]}
|
25
25
|
end
|
26
26
|
|
27
27
|
alias_method :join!, :_cf_join
|
@@ -34,7 +34,7 @@ class SparkleFormation
|
|
34
34
|
def _cf_split(string, delimiter)
|
35
35
|
__t_stringish(string) unless string.is_a?(Hash)
|
36
36
|
__t_stringish(delimiter) unless delimiter.is_a?(Hash)
|
37
|
-
{
|
37
|
+
{"Fn::Split" => [delimiter, string]}
|
38
38
|
end
|
39
39
|
|
40
40
|
alias_method :split!, :_cf_split
|
@@ -46,10 +46,10 @@ class SparkleFormation
|
|
46
46
|
# @return [Hash]
|
47
47
|
def _cf_sub(string, variables = nil)
|
48
48
|
if variables.nil?
|
49
|
-
{
|
49
|
+
{"Fn::Sub" => string}
|
50
50
|
else
|
51
51
|
__t_hashish(variables)
|
52
|
-
{
|
52
|
+
{"Fn::Sub" => [string, variables]}
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -63,7 +63,7 @@ class SparkleFormation
|
|
63
63
|
# @note Symbol value will force key processing
|
64
64
|
def _cf_ref(thing)
|
65
65
|
__t_stringish(thing)
|
66
|
-
{
|
66
|
+
{"Ref" => __attribute_key(thing)}
|
67
67
|
end
|
68
68
|
|
69
69
|
alias_method :_ref, :_cf_ref
|
@@ -75,7 +75,7 @@ class SparkleFormation
|
|
75
75
|
# @return [Hash]
|
76
76
|
def _cf_value_import(thing)
|
77
77
|
__t_stringish(thing) unless thing.is_a?(Hash)
|
78
|
-
{
|
78
|
+
{"Fn::ImportValue" => __attribute_key(thing)}
|
79
79
|
end
|
80
80
|
|
81
81
|
alias_method :_import_value, :_cf_value_import
|
@@ -100,7 +100,7 @@ class SparkleFormation
|
|
100
100
|
if key.is_a?(Symbol)
|
101
101
|
key = ref!(key)
|
102
102
|
end
|
103
|
-
{
|
103
|
+
{"Fn::FindInMap" => [thing, key, *suffix]}
|
104
104
|
end
|
105
105
|
|
106
106
|
alias_method :_cf_find_in_map, :_cf_map
|
@@ -123,7 +123,7 @@ class SparkleFormation
|
|
123
123
|
thing
|
124
124
|
end
|
125
125
|
end
|
126
|
-
{
|
126
|
+
{"Fn::GetAtt" => [__attribute_key(r_name), *args]}
|
127
127
|
end
|
128
128
|
|
129
129
|
alias_method :_cf_get_att, :_cf_attr
|
@@ -135,7 +135,7 @@ class SparkleFormation
|
|
135
135
|
# @param arg [Object] argument to be encoded
|
136
136
|
# @return [Hash]
|
137
137
|
def _cf_base64(arg)
|
138
|
-
{
|
138
|
+
{"Fn::Base64" => arg}
|
139
139
|
end
|
140
140
|
|
141
141
|
alias_method :base64!, :_cf_base64
|
@@ -149,11 +149,11 @@ class SparkleFormation
|
|
149
149
|
when Symbol
|
150
150
|
_cf_ref(region)
|
151
151
|
when NilClass
|
152
|
-
|
152
|
+
""
|
153
153
|
else
|
154
154
|
region
|
155
155
|
end
|
156
|
-
{
|
156
|
+
{"Fn::GetAZs" => region}
|
157
157
|
end
|
158
158
|
|
159
159
|
alias_method :get_azs!, :_cf_get_azs
|
@@ -167,7 +167,7 @@ class SparkleFormation
|
|
167
167
|
def _cf_select(index, item)
|
168
168
|
index = index.is_a?(Symbol) ? _cf_ref(index) : index
|
169
169
|
item = _cf_ref(item) if item.is_a?(Symbol)
|
170
|
-
{
|
170
|
+
{"Fn::Select" => [index, item]}
|
171
171
|
end
|
172
172
|
|
173
173
|
alias_method :select!, :_cf_select
|
@@ -178,7 +178,7 @@ class SparkleFormation
|
|
178
178
|
# @return [Hash]
|
179
179
|
def _condition(name)
|
180
180
|
__t_stringish(name)
|
181
|
-
{
|
181
|
+
{"Condition" => __attribute_key(name)}
|
182
182
|
end
|
183
183
|
|
184
184
|
alias_method :condition!, :_condition
|
@@ -202,7 +202,7 @@ class SparkleFormation
|
|
202
202
|
# @param false_value [Object] item to be used when false
|
203
203
|
# @return [Hash]
|
204
204
|
def _if(cond, true_value, false_value)
|
205
|
-
{
|
205
|
+
{"Fn::If" => _array(__attribute_key(cond), true_value, false_value)}
|
206
206
|
end
|
207
207
|
|
208
208
|
alias_method :if!, :_if
|
@@ -215,7 +215,7 @@ class SparkleFormation
|
|
215
215
|
# will be set as condition directly. procs will be evaluated
|
216
216
|
def _and(*args)
|
217
217
|
{
|
218
|
-
|
218
|
+
"Fn::And" => _array(
|
219
219
|
*args.map { |v|
|
220
220
|
if v.is_a?(Symbol) || v.is_a?(String)
|
221
221
|
_condition(v)
|
@@ -235,7 +235,7 @@ class SparkleFormation
|
|
235
235
|
# @param v2 [Object]
|
236
236
|
# @return [Hash]
|
237
237
|
def _equals(v1, v2)
|
238
|
-
{
|
238
|
+
{"Fn::Equals" => _array(v1, v2)}
|
239
239
|
end
|
240
240
|
|
241
241
|
alias_method :equals!, :_equals
|
@@ -250,7 +250,7 @@ class SparkleFormation
|
|
250
250
|
else
|
251
251
|
arg = _array(arg).first
|
252
252
|
end
|
253
|
-
{
|
253
|
+
{"Fn::Not" => [arg]}
|
254
254
|
end
|
255
255
|
|
256
256
|
alias_method :not!, :_not
|
@@ -262,7 +262,7 @@ class SparkleFormation
|
|
262
262
|
# @return [Hash]
|
263
263
|
def _or(*args)
|
264
264
|
{
|
265
|
-
|
265
|
+
"Fn::Or" => _array(
|
266
266
|
*args.map { |v|
|
267
267
|
if v.is_a?(Symbol) || v.is_a?(String)
|
268
268
|
_condition(v)
|
@@ -280,7 +280,7 @@ class SparkleFormation
|
|
280
280
|
#
|
281
281
|
# @return [Hash]
|
282
282
|
def _no_value
|
283
|
-
_ref(
|
283
|
+
_ref("AWS::NoValue")
|
284
284
|
end
|
285
285
|
|
286
286
|
alias_method :no_value!, :_no_value
|
@@ -289,7 +289,7 @@ class SparkleFormation
|
|
289
289
|
#
|
290
290
|
# @return [Hash]
|
291
291
|
def _region
|
292
|
-
_ref(
|
292
|
+
_ref("AWS::Region")
|
293
293
|
end
|
294
294
|
|
295
295
|
alias_method :region!, :_region
|
@@ -298,7 +298,7 @@ class SparkleFormation
|
|
298
298
|
#
|
299
299
|
# @return [Hash]
|
300
300
|
def _notification_arns
|
301
|
-
_ref(
|
301
|
+
_ref("AWS::NotificationARNs")
|
302
302
|
end
|
303
303
|
|
304
304
|
alias_method :notification_arns!, :_notification_arns
|
@@ -307,7 +307,7 @@ class SparkleFormation
|
|
307
307
|
#
|
308
308
|
# @return [Hash]
|
309
309
|
def _account_id
|
310
|
-
_ref(
|
310
|
+
_ref("AWS::AccountId")
|
311
311
|
end
|
312
312
|
|
313
313
|
alias_method :account_id!, :_account_id
|
@@ -316,7 +316,7 @@ class SparkleFormation
|
|
316
316
|
#
|
317
317
|
# @return [Hash]
|
318
318
|
def _stack_id
|
319
|
-
_ref(
|
319
|
+
_ref("AWS::StackId")
|
320
320
|
end
|
321
321
|
|
322
322
|
alias_method :stack_id!, :_stack_id
|
@@ -325,7 +325,7 @@ class SparkleFormation
|
|
325
325
|
#
|
326
326
|
# @return [Hash]
|
327
327
|
def _stack_name
|
328
|
-
_ref(
|
328
|
+
_ref("AWS::StackName")
|
329
329
|
end
|
330
330
|
|
331
331
|
alias_method :stack_name!, :_stack_name
|
@@ -340,7 +340,7 @@ class SparkleFormation
|
|
340
340
|
# @return [Array<String>]
|
341
341
|
# @note this will directly modify the struct at its current context to inject depends on structure
|
342
342
|
def _depends_on(*args)
|
343
|
-
_set(
|
343
|
+
_set("DependsOn", [args].flatten.compact.map { |s| __attribute_key(s) })
|
344
344
|
end
|
345
345
|
|
346
346
|
alias_method :depends_on!, :_depends_on
|
@@ -358,8 +358,8 @@ class SparkleFormation
|
|
358
358
|
# @return [TrueClass, FalseClass] resource can be tagged
|
359
359
|
def taggable?
|
360
360
|
if self[:type]
|
361
|
-
resource = _self._provider._resources.lookup(self[:type].gsub(
|
362
|
-
resource && resource[:properties].include?(
|
361
|
+
resource = _self._provider._resources.lookup(self[:type].gsub("::", "_").downcase)
|
362
|
+
resource && resource[:properties].include?("Tags")
|
363
363
|
else
|
364
364
|
if _parent
|
365
365
|
_parent.taggable?
|
@@ -373,9 +373,9 @@ class SparkleFormation
|
|
373
373
|
# @return [SparkleStruct]
|
374
374
|
def _tags(hash)
|
375
375
|
__t_hashish(hash)
|
376
|
-
_set(
|
376
|
+
_set("Tags",
|
377
377
|
hash.map { |k, v|
|
378
|
-
{
|
378
|
+
{"Key" => __attribute_key(k), "Value" => v}
|
379
379
|
})
|
380
380
|
end
|
381
381
|
|