cloudster 2.19.2 → 2.19.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.19.2
1
+ 2.19.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cloudster"
8
- s.version = "2.19.2"
8
+ s.version = "2.19.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Emil Soman"]
12
- s.date = "2013-01-18"
12
+ s.date = "2013-01-21"
13
13
  s.description = "Cloudster is a Ruby gem that was born to cut the learning curve involved \n in writing your own CloudFormation templates. If you don't know what a CloudFormation template is, \n but know about the AWS Cloud offerings, you can still use cloudster to provision your stack. \n Still in infancy , cloudster can create a very basic stack like a breeze. All kinds of contribution welcome !"
14
14
  s.email = "emil.soman@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -1,6 +1,8 @@
1
1
  module Cloudster
2
2
  #==CloudFront resource
3
+ #Output values : domain_name
3
4
  class CloudFront
5
+ include Cloudster::Output
4
6
 
5
7
  # Initialize CloudFront
6
8
  #
@@ -41,19 +43,27 @@ module Cloudster
41
43
 
42
44
  private
43
45
  def template
44
- return "Resources" => {
45
- @name => {
46
- "Type" => "AWS::CloudFront::Distribution",
47
- "Properties" => {
48
- "DistributionConfig" => {
49
- "S3Origin" => {
50
- "DNSName"=> {"Fn::GetAtt" => [@instance_name, "DomainName"]},
51
- },
52
- "Enabled" => "true"
46
+ template = { "Resources" => {
47
+ @name => {
48
+ "Type" => "AWS::CloudFront::Distribution",
49
+ "Properties" => {
50
+ "DistributionConfig" => {
51
+ "S3Origin" => {
52
+ "DNSName"=> {"Fn::GetAtt" => [@instance_name, "DomainName"]},
53
+ },
54
+ "Enabled" => "true"
55
+ }
53
56
  }
54
- }
57
+ }
58
+ }
59
+ }
60
+ outputs = {
61
+ @name => {
62
+ 'domain_name' => {'Fn::GetAtt' => [@name, 'DomainName']}
55
63
  }
56
64
  }
65
+ template['Outputs'] = output_template(outputs)
66
+ return template
57
67
 
58
68
  end
59
69
 
@@ -1,6 +1,8 @@
1
1
  module Cloudster
2
2
  #==ElasticIp resource
3
+ #Output values : public_ip
3
4
  class ElasticIp
5
+ include Cloudster::Output
4
6
 
5
7
  # Initialize an ElasticIp
6
8
  #
@@ -43,7 +45,7 @@ module Cloudster
43
45
 
44
46
  private
45
47
  def template
46
- return "Resources" => {
48
+ template = { "Resources" => {
47
49
  @name => {
48
50
  "Type" => "AWS::EC2::EIP",
49
51
  "Properties" => {
@@ -51,8 +53,16 @@ module Cloudster
51
53
  "Ref" => @instance_name
52
54
  }
53
55
  }
56
+ }
54
57
  }
55
58
  }
59
+ outputs = {
60
+ @name => {
61
+ 'public_ip' => {'Ref' => @name}
62
+ }
63
+ }
64
+ template['Outputs'] = output_template(outputs)
65
+ return template
56
66
  end
57
67
 
58
68
  end
@@ -1,6 +1,8 @@
1
1
  module Cloudster
2
2
  #==Elb resource
3
+ #Output values : canonical_hosted_zone_name, canonical_hosted_zone_name_id, dns_name, source_security_group_name, source_security_group_owner
3
4
  class Elb
5
+ extend Cloudster::Output
4
6
 
5
7
  # Initialize an Elb instance
6
8
  #
@@ -71,14 +73,24 @@ module Cloudster
71
73
  }
72
74
  }
73
75
  properties.merge!({"Instances" => get_instance_name_list_for_template(options[:instance_names])})
74
- template = {'Resources' => {
75
- options[:name] => {
76
+ template = {'Resources' => {
77
+ options[:name] => {
76
78
  'Type' => 'AWS::ElasticLoadBalancing::LoadBalancer',
77
79
  'Properties' => properties
78
80
  }
79
81
  }
80
82
  }
81
- return template
83
+ outputs = {
84
+ options[:name] => {
85
+ 'canonical_hosted_zone_name' => {'Fn::GetAtt' => [options[:name], 'CanonicalHostedZoneName']},
86
+ 'canonical_hosted_zone_name_id' => {'Fn::GetAtt' => [options[:name], 'CanonicalHostedZoneNameID']},
87
+ 'dns_name' => {'Fn::GetAtt' => [options[:name], 'DNSName']},
88
+ 'source_security_group_name' => {'Fn::GetAtt' => [options[:name], 'SourceSecurityGroup.GroupName']},
89
+ 'source_security_group_owner' => {'Fn::GetAtt' => [options[:name], 'SourceSecurityGroup.OwnerAlias']}
90
+ }
91
+ }
92
+ template['Outputs'] = output_template(outputs)
93
+ return template
82
94
  end
83
95
 
84
96
  private
@@ -1,6 +1,8 @@
1
1
  module Cloudster
2
2
  #==Rds resource
3
+ #Output values : endpoint_address, endpoint_port
3
4
  class Rds
5
+ extend Cloudster::Output
4
6
 
5
7
  # Initialize an Rds instance
6
8
  #
@@ -101,7 +103,7 @@ module Cloudster
101
103
  options[:engine] ||= 'MySQL'
102
104
  options[:instance_class] ||= 'db.t1.micro'
103
105
  options[:multi_az] ||= false
104
- template = {'Resources' => {
106
+ template = {'Resources' => {
105
107
  options[:name] => {
106
108
  "Type" => "AWS::RDS::DBInstance",
107
109
  "Properties" => {
@@ -115,7 +117,14 @@ module Cloudster
115
117
  }
116
118
  }
117
119
  }
118
- return template
120
+ outputs = {
121
+ options[:name] => {
122
+ 'endpoint_address' => {'Fn::GetAtt' => [options[:name], 'Endpoint.Address']},
123
+ 'endpoint_port' => {'Fn::GetAtt' => [options[:name], 'Endpoint.Port']}
124
+ }
125
+ }
126
+ template['Outputs'] = output_template(outputs)
127
+ return template
119
128
  end
120
129
 
121
130
  end
@@ -46,6 +46,15 @@ describe Cloudster::ChefClient do
46
46
  ]
47
47
  ]
48
48
  }
49
+ },
50
+ "CloudFront"=>{
51
+ "Value"=>{
52
+ "Fn::Join"=>[",",
53
+ [
54
+ {"Fn::Join"=>["|", ["domain_name", {"Fn::GetAtt"=>["CloudFront", "DomainName"]}]]}
55
+ ]
56
+ ]
57
+ }
49
58
  }
50
59
  }
51
60
  }
@@ -91,6 +91,29 @@ describe Cloudster::Cloud do
91
91
  ]
92
92
  ]
93
93
  }
94
+ },
95
+ "MySqlDB"=> {
96
+ "Value" => {
97
+ "Fn::Join" => ["," ,
98
+ [
99
+ {"Fn::Join" => ["|", ["endpoint_address", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Address']}]]},
100
+ {"Fn::Join" => ["|", ["endpoint_port", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Port']}]]}
101
+ ]
102
+ ]
103
+ }
104
+ },
105
+ "ELB"=> {
106
+ "Value" => {
107
+ "Fn::Join" => ["," ,
108
+ [
109
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name", {'Fn::GetAtt' => ['ELB', 'CanonicalHostedZoneName']}]]},
110
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name_id", {'Fn::GetAtt' => ['ELB', 'CanonicalHostedZoneNameID']}]]},
111
+ {"Fn::Join" => ["|", ["dns_name", {'Fn::GetAtt' => ['ELB', 'DNSName']}]]},
112
+ {"Fn::Join" => ["|", ["source_security_group_name", {'Fn::GetAtt' => ['ELB', 'SourceSecurityGroup.GroupName']}]]},
113
+ {"Fn::Join" => ["|", ["source_security_group_owner", {'Fn::GetAtt' => ['ELB', 'SourceSecurityGroup.OwnerAlias']}]]}
114
+ ]
115
+ ]
116
+ }
94
117
  }
95
118
  }
96
119
  }.to_json
@@ -37,7 +37,7 @@ describe Cloudster::ChefClient do
37
37
  "Outputs" => {
38
38
  "AppServer"=>{
39
39
  "Value"=>{
40
- "Fn::Join"=>[",",
40
+ "Fn::Join"=>[",",
41
41
  [
42
42
  {"Fn::Join"=>["|", ["availablity_zone", {"Fn::GetAtt"=>["AppServer", "AvailabilityZone"]}]]},
43
43
  {"Fn::Join"=>["|", ["private_dns_name", {"Fn::GetAtt"=>["AppServer", "PrivateDnsName"]}]]},
@@ -47,6 +47,15 @@ describe Cloudster::ChefClient do
47
47
  ]
48
48
  ]
49
49
  }
50
+ },
51
+ "ElasticIp"=>{
52
+ "Value"=>{
53
+ "Fn::Join"=>[",",
54
+ [
55
+ {"Fn::Join"=>["|", ["public_ip", {"Ref"=> "ElasticIp"}]]}
56
+ ]
57
+ ]
58
+ }
50
59
  }
51
60
  }
52
61
  }
@@ -12,13 +12,99 @@ describe Cloudster::Elb do
12
12
  describe '#template with default listener' do
13
13
  it "should return a ruby hash for the resource cloudformation template with default listener" do
14
14
  elb = Cloudster::Elb.new(:name => 'LoadBalancer', :instance_names => ['AppServer', 'AppServer2'])
15
- elb.template.should == {"Resources" => {"LoadBalancer"=>{"Type"=>"AWS::ElasticLoadBalancing::LoadBalancer", "Properties"=>{"AvailabilityZones"=>{"Fn::GetAZs"=>""}, "Listeners"=>[{"LoadBalancerPort"=>"80", "InstancePort"=>"80", "Protocol"=>"HTTP"}], "HealthCheck"=>{"Target"=>{"Fn::Join"=>["", ["HTTP:", "80", "/"]]}, "HealthyThreshold"=>"3", "UnhealthyThreshold"=>"5", "Interval"=>"30", "Timeout"=>"5"}, "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]}}}}
15
+ elb.template.should == {
16
+ "Resources" => {
17
+ "LoadBalancer"=>{
18
+ "Type"=>"AWS::ElasticLoadBalancing::LoadBalancer",
19
+ "Properties"=>{
20
+ "AvailabilityZones"=>{
21
+ "Fn::GetAZs"=>""
22
+ },
23
+ "Listeners"=>[
24
+ {
25
+ "LoadBalancerPort"=>"80",
26
+ "InstancePort"=>"80",
27
+ "Protocol"=>"HTTP"
28
+ }
29
+ ],
30
+ "HealthCheck"=>{
31
+ "Target"=>{
32
+ "Fn::Join"=>["", ["HTTP:", "80", "/"]]
33
+ },
34
+ "HealthyThreshold"=>"3",
35
+ "UnhealthyThreshold"=>"5",
36
+ "Interval"=>"30",
37
+ "Timeout"=>"5"
38
+ },
39
+ "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]
40
+ }
41
+ }
42
+ },
43
+ "Outputs" => {
44
+ "LoadBalancer"=>{
45
+ "Value"=>{
46
+ "Fn::Join"=>[",",
47
+ [
48
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneName']}]]},
49
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name_id", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneNameID']}]]},
50
+ {"Fn::Join" => ["|", ["dns_name", {'Fn::GetAtt' => ['LoadBalancer', 'DNSName']}]]},
51
+ {"Fn::Join" => ["|", ["source_security_group_name", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.GroupName']}]]},
52
+ {"Fn::Join" => ["|", ["source_security_group_owner", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.OwnerAlias']}]]}
53
+ ]
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ }
16
59
  end
17
60
  end
18
61
  describe '#template with custom listener' do
19
62
  it "should return a ruby hash for the resource cloudformation template with the custom listener" do
20
- elb = Cloudster::Elb.new(:name => 'LoadBalancer', :instance_names => ['AppServer', 'AppServer2'], :listeners => [{:port => 80, :instance_port => 3333, :protocol => 'HTTP'}])
21
- elb.template.should == {"Resources" => {"LoadBalancer"=>{"Type"=>"AWS::ElasticLoadBalancing::LoadBalancer", "Properties"=>{"AvailabilityZones"=>{"Fn::GetAZs"=>""}, "Listeners"=>[{"LoadBalancerPort"=>"80", "InstancePort"=>"3333", "Protocol"=>"HTTP"}], "HealthCheck"=>{"Target"=>{"Fn::Join"=>["", ["HTTP:", "80", "/"]]}, "HealthyThreshold"=>"3", "UnhealthyThreshold"=>"5", "Interval"=>"30", "Timeout"=>"5"}, "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]}}}}
63
+ elb = Cloudster::Elb.new(:name => 'LoadBalancer', :instance_names => ['AppServer', 'AppServer2'], :listeners => [{:port => 80, :instance_port => 3333, :protocol => 'HTTP'}])
64
+ elb.template.should == {
65
+ "Resources" => {
66
+ "LoadBalancer"=>{
67
+ "Type"=>"AWS::ElasticLoadBalancing::LoadBalancer",
68
+ "Properties"=>{
69
+ "AvailabilityZones"=>{
70
+ "Fn::GetAZs"=>""
71
+ },
72
+ "Listeners"=>[
73
+ {
74
+ "LoadBalancerPort"=>"80",
75
+ "InstancePort"=>"3333",
76
+ "Protocol"=>"HTTP"
77
+ }
78
+ ],
79
+ "HealthCheck"=>{
80
+ "Target"=>{
81
+ "Fn::Join"=>["", ["HTTP:", "80", "/"]]
82
+ },
83
+ "HealthyThreshold"=>"3",
84
+ "UnhealthyThreshold"=>"5",
85
+ "Interval"=>"30",
86
+ "Timeout"=>"5"
87
+ },
88
+ "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]
89
+ }
90
+ }
91
+ },
92
+ "Outputs" => {
93
+ "LoadBalancer"=>{
94
+ "Value"=>{
95
+ "Fn::Join"=>[",",
96
+ [
97
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneName']}]]},
98
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name_id", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneNameID']}]]},
99
+ {"Fn::Join" => ["|", ["dns_name", {'Fn::GetAtt' => ['LoadBalancer', 'DNSName']}]]},
100
+ {"Fn::Join" => ["|", ["source_security_group_name", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.GroupName']}]]},
101
+ {"Fn::Join" => ["|", ["source_security_group_owner", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.OwnerAlias']}]]}
102
+ ]
103
+ ]
104
+ }
105
+ }
106
+ }
107
+ }
22
108
  end
23
109
  end
24
110
  describe '.template' do
@@ -27,7 +113,50 @@ describe Cloudster::Elb do
27
113
  end
28
114
  it "should return a ruby hash for the resource cloudformation template" do
29
115
  hash = Cloudster::Elb.template(:name => 'LoadBalancer', :instance_names => ['AppServer', 'AppServer2'])
30
- hash.should == {"Resources" => {"LoadBalancer"=>{"Type"=>"AWS::ElasticLoadBalancing::LoadBalancer", "Properties"=>{"AvailabilityZones"=>{"Fn::GetAZs"=>""}, "Listeners"=>[{"LoadBalancerPort"=>"80", "InstancePort"=>"80", "Protocol"=>"HTTP"}], "HealthCheck"=>{"Target"=>{"Fn::Join"=>["", ["HTTP:", "80", "/"]]}, "HealthyThreshold"=>"3", "UnhealthyThreshold"=>"5", "Interval"=>"30", "Timeout"=>"5"}, "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]}}}}
116
+ hash.should == {
117
+ "Resources" => {
118
+ "LoadBalancer"=>{
119
+ "Type"=>"AWS::ElasticLoadBalancing::LoadBalancer",
120
+ "Properties"=>{
121
+ "AvailabilityZones"=>{
122
+ "Fn::GetAZs"=>""
123
+ },
124
+ "Listeners"=>[
125
+ {
126
+ "LoadBalancerPort"=>"80",
127
+ "InstancePort"=>"80",
128
+ "Protocol"=>"HTTP"
129
+ }
130
+ ],
131
+ "HealthCheck"=>{
132
+ "Target"=>{
133
+ "Fn::Join"=>["", ["HTTP:", "80", "/"]]
134
+ },
135
+ "HealthyThreshold"=>"3",
136
+ "UnhealthyThreshold"=>"5",
137
+ "Interval"=>"30",
138
+ "Timeout"=>"5"
139
+ },
140
+ "Instances"=>[{"Ref"=>"AppServer"}, {"Ref"=>"AppServer2"}]
141
+ }
142
+ }
143
+ },
144
+ "Outputs" => {
145
+ "LoadBalancer"=>{
146
+ "Value"=>{
147
+ "Fn::Join"=>[",",
148
+ [
149
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneName']}]]},
150
+ {"Fn::Join" => ["|", ["canonical_hosted_zone_name_id", {'Fn::GetAtt' => ['LoadBalancer', 'CanonicalHostedZoneNameID']}]]},
151
+ {"Fn::Join" => ["|", ["dns_name", {'Fn::GetAtt' => ['LoadBalancer', 'DNSName']}]]},
152
+ {"Fn::Join" => ["|", ["source_security_group_name", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.GroupName']}]]},
153
+ {"Fn::Join" => ["|", ["source_security_group_owner", {'Fn::GetAtt' => ['LoadBalancer', 'SourceSecurityGroup.OwnerAlias']}]]}
154
+ ]
155
+ ]
156
+ }
157
+ }
158
+ }
159
+ }
31
160
  end
32
161
  end
33
162
  end
@@ -12,7 +12,7 @@ describe Cloudster::Rds do
12
12
  describe '#template' do
13
13
  it "should return a ruby hash for the resource cloudformation template" do
14
14
  rds = Cloudster::Rds.new(:name => 'MySqlDB', :storage_size => '10', :multi_az => true)
15
- template = {'Resources' => {
15
+ template = {'Resources' => {
16
16
  'MySqlDB' => {
17
17
  "Type" => "AWS::RDS::DBInstance",
18
18
  "Properties" => {
@@ -24,6 +24,18 @@ describe Cloudster::Rds do
24
24
  "MultiAZ" => true
25
25
  }
26
26
  }
27
+ },
28
+ "Outputs" => {
29
+ "MySqlDB"=>{
30
+ "Value"=>{
31
+ "Fn::Join"=>[",",
32
+ [
33
+ {"Fn::Join" => ["|", ["endpoint_address", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Address']}]]},
34
+ {"Fn::Join" => ["|", ["endpoint_port", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Port']}]]}
35
+ ]
36
+ ]
37
+ }
38
+ }
27
39
  }
28
40
  }
29
41
  rds.template.should == template
@@ -35,7 +47,7 @@ describe Cloudster::Rds do
35
47
  end
36
48
  it "should return a ruby hash for the resource cloudformation template" do
37
49
  hash = Cloudster::Rds.template(:name => 'MySqlDB', :storage_size => '10')
38
- template = {'Resources' => {
50
+ template = {'Resources' => {
39
51
  'MySqlDB' => {
40
52
  "Type" => "AWS::RDS::DBInstance",
41
53
  "Properties" => {
@@ -47,6 +59,18 @@ describe Cloudster::Rds do
47
59
  "MultiAZ" => false
48
60
  }
49
61
  }
62
+ },
63
+ "Outputs" => {
64
+ "MySqlDB"=>{
65
+ "Value"=>{
66
+ "Fn::Join"=>[",",
67
+ [
68
+ {"Fn::Join" => ["|", ["endpoint_address", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Address']}]]},
69
+ {"Fn::Join" => ["|", ["endpoint_port", {'Fn::GetAtt' => ['MySqlDB', 'Endpoint.Port']}]]}
70
+ ]
71
+ ]
72
+ }
73
+ }
50
74
  }
51
75
  }
52
76
  hash.should == template
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.2
4
+ version: 2.19.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -169,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  segments:
171
171
  - 0
172
- hash: 773599183
172
+ hash: -732779757
173
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  none: false
175
175
  requirements: