convection 0.2.3 → 0.2.4
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/lib/convection/model/template.rb +1 -0
- data/lib/convection/model/template/resource/aws_ec2_instance.rb +10 -0
- data/lib/convection/model/template/resource_property.rb +62 -0
- data/lib/convection/model/template/resource_property/aws_ec2_network_interface.rb +23 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c43337ad64fde014850460e19d630469be23340
|
4
|
+
data.tar.gz: 93a64a9d5793c8e021b6a1fc0278a782dff927e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0e1c0cc824507129f1ea6e6e3d364e8b77c9dddf76c7b98e29882ea2b4c548e22d74d59a9b1ab91fb49788715fa48628ce767effb5dd3fda5e9311da9570ca6
|
7
|
+
data.tar.gz: 4a1ba0c7feceb96a37e61e3299e9dad8e3fcf33fcfb0ffc16acc482ef0615033f819f861e1938d1bfdced82bbae19a03d1f1ddabb55351e9dc2aba24e30b3abc
|
@@ -20,6 +20,16 @@ module Convection
|
|
20
20
|
property :user_data, 'UserData'
|
21
21
|
property :security_group, 'SecurityGroupIds', :type => :list
|
22
22
|
property :src_dst_checks, 'SourceDestCheck'
|
23
|
+
property :disable_api_termination, 'DisableApiTermination'
|
24
|
+
property :network_interfaces, 'NetworkInterfaces', :type => :list
|
25
|
+
|
26
|
+
# Append a network interface to network_interfaces
|
27
|
+
def network_interface(&block)
|
28
|
+
interface = ResourceProperty::EC2NetworkInterface.new(self)
|
29
|
+
interface.instance_exec(&block) if block
|
30
|
+
interface.device_index = network_interfaces.count.to_s
|
31
|
+
network_interfaces << interface
|
32
|
+
end
|
23
33
|
|
24
34
|
def render(*args)
|
25
35
|
super.tap do |resource|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Convection
|
2
|
+
module Model
|
3
|
+
class Template
|
4
|
+
# Base class for {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-property-reference.html Resource Property Types}
|
5
|
+
class ResourceProperty
|
6
|
+
class << self
|
7
|
+
def properties
|
8
|
+
@properties ||= {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def property(accesor, property_name, options = {})
|
12
|
+
properties[accesor] = Resource::Property.create(accesor, property_name, options)
|
13
|
+
properties[accesor].attach(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
def attach_method(name, &block)
|
17
|
+
define_method(name, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
include DSL::Helpers
|
22
|
+
|
23
|
+
##
|
24
|
+
# Resource Property Instance Methods
|
25
|
+
##
|
26
|
+
attr_reader :template
|
27
|
+
attr_reader :properties
|
28
|
+
attr_reader :exist
|
29
|
+
alias_method :exist?, :exist
|
30
|
+
|
31
|
+
def initialize(parent)
|
32
|
+
@template = parent.template
|
33
|
+
@exist = false
|
34
|
+
|
35
|
+
## Instantiate properties
|
36
|
+
@properties = Model::Collection.new
|
37
|
+
resource = self
|
38
|
+
resource.class.properties.each do |_, property|
|
39
|
+
@properties[property.property_name] = property.instance(resource)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def property(key, *value)
|
44
|
+
return properties[key].value if value.empty?
|
45
|
+
|
46
|
+
## Define a property instance on the fly
|
47
|
+
properties[key] = ScalarPropertyInstance.new(self) unless properties.include?(key)
|
48
|
+
properties[key].set(*value)
|
49
|
+
end
|
50
|
+
|
51
|
+
def render
|
52
|
+
properties.map(true, &:render)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
## Require all resource properties
|
60
|
+
Dir.glob(File.expand_path('../resource_property/*.rb', __FILE__)) do |r|
|
61
|
+
require_relative r
|
62
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../resource_property'
|
2
|
+
|
3
|
+
module Convection
|
4
|
+
module Model
|
5
|
+
class Template
|
6
|
+
class ResourceProperty
|
7
|
+
# Represents an {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html
|
8
|
+
# EC2 NetworkInterface Embedded Property Type}
|
9
|
+
class EC2NetworkInterface < ResourceProperty
|
10
|
+
property :associate_public_ip_address, 'AssociatePublicIpAddress'
|
11
|
+
property :delete_on_termination, 'DeleteOnTermination'
|
12
|
+
property :description, 'Description'
|
13
|
+
property :device_index, 'DeviceIndex'
|
14
|
+
property :group_set, 'GroupSet', :type => :list
|
15
|
+
alias_method :security_group, :group_set
|
16
|
+
property :private_ip_address, 'PrivateIpAddress'
|
17
|
+
property :secondary_private_ip_address_count, 'SecondaryPrivateIpAddressCount'
|
18
|
+
property :subnet, 'SubnetId'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Manero
|
@@ -415,6 +415,8 @@ files:
|
|
415
415
|
- lib/convection/model/template/resource/aws_sns_topic_policy.rb
|
416
416
|
- lib/convection/model/template/resource/aws_sqs_queue.rb
|
417
417
|
- lib/convection/model/template/resource/aws_sqs_queue_policy.rb
|
418
|
+
- lib/convection/model/template/resource_property.rb
|
419
|
+
- lib/convection/model/template/resource_property/aws_ec2_network_interface.rb
|
418
420
|
- lib/convection/version.rb
|
419
421
|
- test/convection/model/test_conditions.rb
|
420
422
|
- test/convection/model/test_elasticache.rb
|