draw_cloud 0.0.1
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.
- data/README.md +22 -0
- data/lib/draw_cloud.rb +75 -0
- data/lib/draw_cloud/as_group.rb +104 -0
- data/lib/draw_cloud/as_group.rb~ +54 -0
- data/lib/draw_cloud/as_launch_configuration.rb +71 -0
- data/lib/draw_cloud/as_launch_configuration.rb~ +50 -0
- data/lib/draw_cloud/base.rb +264 -0
- data/lib/draw_cloud/base64_func.rb +30 -0
- data/lib/draw_cloud/configuration.rb +61 -0
- data/lib/draw_cloud/configuration.rb~ +64 -0
- data/lib/draw_cloud/ec2_instance.rb +141 -0
- data/lib/draw_cloud/ec2_instance.rb~ +78 -0
- data/lib/draw_cloud/ec2_instance_template.rb +29 -0
- data/lib/draw_cloud/ec2_instance_template.rb~ +36 -0
- data/lib/draw_cloud/elastic_ip.rb +97 -0
- data/lib/draw_cloud/elastic_ip.rb~ +19 -0
- data/lib/draw_cloud/get_att_func.rb +31 -0
- data/lib/draw_cloud/get_att_func.rb~ +19 -0
- data/lib/draw_cloud/iam_access_key.rb +53 -0
- data/lib/draw_cloud/iam_access_key.rb~ +43 -0
- data/lib/draw_cloud/iam_policy.rb +71 -0
- data/lib/draw_cloud/iam_policy.rb~ +41 -0
- data/lib/draw_cloud/iam_user.rb +53 -0
- data/lib/draw_cloud/iam_user.rb~ +44 -0
- data/lib/draw_cloud/internet_gateway.rb +66 -0
- data/lib/draw_cloud/join_func.rb +31 -0
- data/lib/draw_cloud/join_func.rb~ +24 -0
- data/lib/draw_cloud/locations.rb +25 -0
- data/lib/draw_cloud/locations.rb~ +53 -0
- data/lib/draw_cloud/map.rb +65 -0
- data/lib/draw_cloud/network_acl.rb +91 -0
- data/lib/draw_cloud/network_acl.rb~ +36 -0
- data/lib/draw_cloud/network_acl_entry.rb +110 -0
- data/lib/draw_cloud/network_acl_entry.rb~ +36 -0
- data/lib/draw_cloud/network_interface.rb +71 -0
- data/lib/draw_cloud/network_interface.rb~ +46 -0
- data/lib/draw_cloud/output.rb +38 -0
- data/lib/draw_cloud/output.rb~ +39 -0
- data/lib/draw_cloud/parameter.rb +58 -0
- data/lib/draw_cloud/parameter.rb~ +30 -0
- data/lib/draw_cloud/rds_instance.rb +117 -0
- data/lib/draw_cloud/rds_security_group.rb +57 -0
- data/lib/draw_cloud/route_table.rb +56 -0
- data/lib/draw_cloud/route_table_entry.rb +59 -0
- data/lib/draw_cloud/route_table_entry.rb~ +33 -0
- data/lib/draw_cloud/s3_bucket.rb~ +41 -0
- data/lib/draw_cloud/security_group.rb +85 -0
- data/lib/draw_cloud/security_group.rb~ +71 -0
- data/lib/draw_cloud/service.rb~ +75 -0
- data/lib/draw_cloud/simple_ref.rb +30 -0
- data/lib/draw_cloud/simple_ref.rb~ +17 -0
- data/lib/draw_cloud/sns_topic.rb +58 -0
- data/lib/draw_cloud/sns_topic.rb~ +39 -0
- data/lib/draw_cloud/subnet.rb +104 -0
- data/lib/draw_cloud/subnet.rb~ +56 -0
- data/lib/draw_cloud/utilities.rb +65 -0
- data/lib/draw_cloud/version.rb +3 -0
- data/lib/draw_cloud/vpc.rb +57 -0
- data/lib/draw_cloud/vpc.rb~ +55 -0
- data/lib/draw_cloud/wait_handle.rb +78 -0
- data/lib/draw_cloud/wait_handle.rb~ +10 -0
- metadata +195 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
# License:: All rights reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
module DrawCloud
|
8
|
+
class ElasticIp
|
9
|
+
include Base
|
10
|
+
|
11
|
+
attr_accessor(:name, :domain)
|
12
|
+
def initialize(name, options={}, &block)
|
13
|
+
@name = name
|
14
|
+
@domain = options.fetch(:domain, nil)
|
15
|
+
self.instance_exec(self, &block) if block
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
6
|
+
# may not use this work except in compliance with the License. You may
|
7
|
+
# obtain a copy of the License in the LICENSE file, or at:
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied. See the License for the specific language governing
|
15
|
+
# permissions and limitations under the License.
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module DrawCloud
|
20
|
+
class GetAttFunc
|
21
|
+
attr_accessor :resource, :attribute_name
|
22
|
+
def initialize(resource, attribute_name)
|
23
|
+
@resource = resource
|
24
|
+
@attribute_name = attribute_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def ref
|
28
|
+
{"Fn::GetAtt" => [DrawCloud.resource_name(resource), DrawCloud.resource_style(attribute_name)]}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
# License:: All rights reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
module DrawCloud
|
8
|
+
class GetAttFunc
|
9
|
+
attr_accessor :resource, :attribute_name
|
10
|
+
def initialize(resource, attribute_name)
|
11
|
+
@resource = resource
|
12
|
+
@attribute_name = attribute_name
|
13
|
+
end
|
14
|
+
|
15
|
+
def ref
|
16
|
+
{"Fn::GetAtt" => [DrawCloud.ref(resource), attribute_name]}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
6
|
+
# may not use this work except in compliance with the License. You may
|
7
|
+
# obtain a copy of the License in the LICENSE file, or at:
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied. See the License for the specific language governing
|
15
|
+
# permissions and limitations under the License.
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module DrawCloud
|
20
|
+
class IAMAccessKey < Base
|
21
|
+
attr_accessor( :name, :serial, :status, :user_name )
|
22
|
+
alias :user :user_name
|
23
|
+
alias :user= :user_name=
|
24
|
+
|
25
|
+
def initialize(name, options={}, &block)
|
26
|
+
@name = name
|
27
|
+
@user_name ||= options.fetch(:user, nil)
|
28
|
+
@user_name ||= options.fetch(:user_name, nil)
|
29
|
+
super(options, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def iam_access_key
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def load_into_config(config)
|
37
|
+
config.cf_add_resource resource_name, self
|
38
|
+
super(config)
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_h
|
42
|
+
h = {
|
43
|
+
"Type" => "AWS::IAM::AccessKey",
|
44
|
+
"Properties" => {
|
45
|
+
"Status" => status || "Active"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
h["Properties"]["Serial"] = serial unless serial.nil?
|
49
|
+
h["Properties"]["UserName"] = DrawCloud.ref(user_name) unless user_name.nil?
|
50
|
+
add_standard_properties(h)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
# License:: All rights reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
module DrawCloud
|
8
|
+
class IAMAccessKey < Base
|
9
|
+
attr_accessor( :name, :serial, :status, :user_name )
|
10
|
+
alias :user :user_name
|
11
|
+
alias :user= :user_name=
|
12
|
+
|
13
|
+
def initialize(name, options={}, &block)
|
14
|
+
@name = name
|
15
|
+
@groups = []
|
16
|
+
@policies = []
|
17
|
+
super(options, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def iam_user
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def load_into_config(config)
|
25
|
+
config.cf_add_resource resource_name, self
|
26
|
+
super(config)
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_h
|
30
|
+
h = {
|
31
|
+
"Type" => "AWS::IAM::User",
|
32
|
+
"Properties" => {
|
33
|
+
}
|
34
|
+
}
|
35
|
+
h["Properties"]["Path"] = path if path
|
36
|
+
h["Properties"]["Groups"] = groups.collect {|g| DrawCloud.ref(g)} if (groups && !groups.empty?)
|
37
|
+
h["Properties"]["Policies"] = policies.collect {|p| DrawCloud.ref(p)} if (policies && !policies.empty?)
|
38
|
+
h["Properties"]["LoginProfile"] = login_profile if login_profile
|
39
|
+
h["Properties"]["LoginProfile"] = {"Password" => password} if (password && !h["Properties"].key?("LoginProfile"))
|
40
|
+
add_standard_properties(h)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
6
|
+
# may not use this work except in compliance with the License. You may
|
7
|
+
# obtain a copy of the License in the LICENSE file, or at:
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied. See the License for the specific language governing
|
15
|
+
# permissions and limitations under the License.
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module DrawCloud
|
20
|
+
class IAMPolicy < Base
|
21
|
+
attr_accessor( :name, :policy_document, :groups, :users, :statements )
|
22
|
+
alias :document :policy_document
|
23
|
+
alias :document= :policy_document=
|
24
|
+
|
25
|
+
def initialize(name, options={}, &block)
|
26
|
+
@name = name
|
27
|
+
@groups = []
|
28
|
+
@users = []
|
29
|
+
@statements = []
|
30
|
+
super(options, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def iam_policy
|
34
|
+
self
|
35
|
+
end
|
36
|
+
|
37
|
+
def allow(statement_properties={})
|
38
|
+
@statements << resourcify_statement_property(statement_properties.merge(:effect => "Allow"))
|
39
|
+
end
|
40
|
+
|
41
|
+
def deny(statement_properties={})
|
42
|
+
@statements << resourcify_statement_property(statement_properties.merge(:effect => "Deny"))
|
43
|
+
end
|
44
|
+
|
45
|
+
def resourcify_statement_property(hash)
|
46
|
+
hash.each_with_object({}) {|(k,v),x| x[DrawCloud.resource_style(k)] = v }
|
47
|
+
end
|
48
|
+
|
49
|
+
def load_into_config(config)
|
50
|
+
config.cf_add_resource resource_name, self
|
51
|
+
super(config)
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_h
|
55
|
+
h = {
|
56
|
+
"Type" => "AWS::IAM::Policy",
|
57
|
+
"Properties" => {
|
58
|
+
"PolicyName" => resource_name,
|
59
|
+
"PolicyDocument" => {
|
60
|
+
"Statement" => @statements.collect do |s|
|
61
|
+
DrawCloud.ref(s)
|
62
|
+
end
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
h["Properties"]["Groups"] = groups.collect {|g| DrawCloud.ref(g)} if (groups && !groups.empty?)
|
67
|
+
h["Properties"]["Users"] = users.collect {|u| DrawCloud.ref(u)} if (users && !users.empty?)
|
68
|
+
add_standard_properties(h)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
# License:: All rights reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
module DrawCloud
|
8
|
+
class IAMPolicy < Base
|
9
|
+
attr_accessor( :name, :policy_document, :groups, :users )
|
10
|
+
|
11
|
+
def initialize(name, options={}, &block)
|
12
|
+
@name = name
|
13
|
+
@groups = []
|
14
|
+
@users = []
|
15
|
+
super(options, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def iam_user
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def load_into_config(config)
|
23
|
+
config.cf_add_resource resource_name, self
|
24
|
+
super(config)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_h
|
28
|
+
h = {
|
29
|
+
"Type" => "AWS::IAM::User",
|
30
|
+
"Properties" => {
|
31
|
+
}
|
32
|
+
}
|
33
|
+
h["Properties"]["Path"] = path if path
|
34
|
+
h["Properties"]["Groups"] = groups.collect {|g| DrawCloud.ref(g)} if (groups && !groups.empty?)
|
35
|
+
h["Properties"]["Policies"] = policies.collect {|p| DrawCloud.ref(p)} if (policies && !policies.empty?)
|
36
|
+
h["Properties"]["LoginProfile"] = login_profile if login_profile
|
37
|
+
h["Properties"]["LoginProfile"] = {"Password" => password} if (password && !h["Properties"].key?("LoginProfile"))
|
38
|
+
add_standard_properties(h)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
6
|
+
# may not use this work except in compliance with the License. You may
|
7
|
+
# obtain a copy of the License in the LICENSE file, or at:
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied. See the License for the specific language governing
|
15
|
+
# permissions and limitations under the License.
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module DrawCloud
|
20
|
+
class IAMUser < Base
|
21
|
+
attr_accessor( :name, :path, :groups, :login_profile, :password, :policies )
|
22
|
+
|
23
|
+
def initialize(name, options={}, &block)
|
24
|
+
@name = name
|
25
|
+
@groups = []
|
26
|
+
@policies = []
|
27
|
+
super(options, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def iam_user
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
def load_into_config(config)
|
35
|
+
config.cf_add_resource resource_name, self
|
36
|
+
super(config)
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_h
|
40
|
+
h = {
|
41
|
+
"Type" => "AWS::IAM::User",
|
42
|
+
"Properties" => {
|
43
|
+
}
|
44
|
+
}
|
45
|
+
h["Properties"]["Path"] = path if path
|
46
|
+
h["Properties"]["Groups"] = groups.collect {|g| DrawCloud.ref(g)} if (groups && !groups.empty?)
|
47
|
+
h["Properties"]["Policies"] = policies.collect {|p| DrawCloud.ref(p)} if (policies && !policies.empty?)
|
48
|
+
h["Properties"]["LoginProfile"] = login_profile if login_profile
|
49
|
+
h["Properties"]["LoginProfile"] = {"Password" => password} if (password && !h["Properties"].key?("LoginProfile"))
|
50
|
+
add_standard_properties(h)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
# License:: All rights reserved
|
5
|
+
#
|
6
|
+
|
7
|
+
module DrawCloud
|
8
|
+
class IAMUSer < Base
|
9
|
+
attr_accessor( :name )
|
10
|
+
|
11
|
+
def initialize(name, cidr, options={}, &block)
|
12
|
+
@name = name
|
13
|
+
@cidr = cidr
|
14
|
+
super(options, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def vpc
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def gateway!
|
22
|
+
if gateways.empty?
|
23
|
+
gateways << InternetGateway.new("InternetGateway", :parent => self)
|
24
|
+
end
|
25
|
+
gateways.first
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_into_config(config)
|
29
|
+
config.cf_add_resource resource_name, self
|
30
|
+
super(config)
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_h
|
34
|
+
h = {
|
35
|
+
"Type" => "AWS::EC2::VPC",
|
36
|
+
"Properties" => {
|
37
|
+
"CidrBlock" => cidr,
|
38
|
+
"InstanceTenancy" => "default",
|
39
|
+
}
|
40
|
+
}
|
41
|
+
add_standard_properties(h)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) 2012, SweetSpot Diabetes Care, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
6
|
+
# may not use this work except in compliance with the License. You may
|
7
|
+
# obtain a copy of the License in the LICENSE file, or at:
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
14
|
+
# implied. See the License for the specific language governing
|
15
|
+
# permissions and limitations under the License.
|
16
|
+
|
17
|
+
#
|
18
|
+
|
19
|
+
module DrawCloud
|
20
|
+
class InternetGateway < Base
|
21
|
+
class InternetGatewayAttachment
|
22
|
+
attr_accessor :gateway
|
23
|
+
def initialize(gateway)
|
24
|
+
@gateway = gateway
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_name
|
28
|
+
gateway.resource_name + "Attach"
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_h
|
32
|
+
{ "Type" => "AWS::EC2::VPCGatewayAttachment",
|
33
|
+
"Properties" => {
|
34
|
+
"VpcId" => DrawCloud.ref(gateway.vpc),
|
35
|
+
"InternetGatewayId" => DrawCloud.ref(gateway),
|
36
|
+
},
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :name
|
42
|
+
def initialize(name, options={}, &block)
|
43
|
+
@name = name
|
44
|
+
super(options, &block)
|
45
|
+
end
|
46
|
+
|
47
|
+
def internet_gateway
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def attachment
|
52
|
+
InternetGatewayAttachment.new(self)
|
53
|
+
end
|
54
|
+
|
55
|
+
def load_into_config(config)
|
56
|
+
config.cf_add_resource resource_name, self
|
57
|
+
config.cf_add_resource attachment.resource_name, attachment
|
58
|
+
super(config)
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_h
|
62
|
+
h = {"Type" => "AWS::EC2::InternetGateway"}
|
63
|
+
add_standard_properties(h)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|