cloudster 2.1.0 → 2.2.0

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 CHANGED
@@ -37,12 +37,14 @@ Now you can do stuff like :
37
37
 
38
38
  stack.template(:resources => [app_server, app_server_2], :description => 'Description of the stack')
39
39
 
40
- And most importantly :
41
-
42
40
  - Provision the stack :
43
41
 
44
42
  stack.provision(:resources => [app_server, app_server_2], :stack_name => 'TestStack', :description => 'Description of the stack')
45
43
 
44
+ - Update the stack :
45
+
46
+ stack.update(:resources => [app_server, app_server_2], :stack_name => 'TestStack', :description => 'Description of the stack')
47
+
46
48
  - You can get the events of a stack using :
47
49
 
48
50
  stack.events(:stack_name => 'TestStack')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.2.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cloudster"
8
- s.version = "2.1.0"
8
+ s.version = "2.2.0"
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"]
@@ -92,6 +92,37 @@ module Cloudster
92
92
  :description => options[:description]))
93
93
  end
94
94
 
95
+ # Updates already created stack
96
+ #
97
+ # ==== Examples
98
+ # cloud = Cloudster::Cloud.new(
99
+ # :access_key_id => 'aws_access_key_id'
100
+ # :secret_access_key => 'aws_secret_access_key',
101
+ # )
102
+ #
103
+ # cloud.update(:resources => [<AWS RESOURCES ARRRAY>],
104
+ # :stack_name => 'Shitty Stack',
105
+ # :description => 'This is the description for the stack template')
106
+ #
107
+ # ==== Notes
108
+ # options parameter must include values for :resources and :stack_name
109
+ #
110
+ # ==== Parameters
111
+ # * options<~Hash>
112
+ # * :resources : An array of Cloudster resource instances. Defaults to {}.
113
+ # * :stack_name : A string which is the name of the CloudFormation stack which will be updated.
114
+ # * :description : A string which will be used as the Description of the CloudFormation template.
115
+ #
116
+ # ==== Returns
117
+ # * response<~Excon::Response>:
118
+ # * body<~Hash>:
119
+ # * 'StackId'<~String> - Id of the new stack
120
+ def update(options = {})
121
+ require_options(options, [:resources, :stack_name])
122
+ return @cloud_formation.update_stack(options[:stack_name], 'TemplateBody' => template(:resources => options[:resources],
123
+ :description => options[:description]))
124
+ end
125
+
95
126
  # Get events related to a stack
96
127
  #
97
128
  # ==== Examples
@@ -34,6 +34,22 @@ describe Cloudster::Cloud do
34
34
  end
35
35
  end
36
36
 
37
+ describe '#update' do
38
+ it "should raise argument error if resources not provided" do
39
+ ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name: 'name')
40
+ cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
41
+ expect { cloud.update(:description => 'test') }.to raise_error(ArgumentError, 'Missing required argument: resources,stack_name' )
42
+ end
43
+ it "should trigger stack creation" do
44
+ cloud_formation = double('CloudFormation')
45
+ Fog::AWS::CloudFormation.should_receive(:new).with(:aws_access_key_id => 'test', :aws_secret_access_key => 'test').and_return cloud_formation
46
+ ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name: 'name')
47
+ cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
48
+ cloud_formation.should_receive('update_stack').with('stack_name', 'TemplateBody' => cloud.template(:resources => [ec2], :description => 'testDescription'))
49
+ cloud.update(:resources => [ec2], :stack_name => 'stack_name', :description => 'testDescription')
50
+ end
51
+ end
52
+
37
53
  describe '#events' do
38
54
  it "should trigger 'describe stack events' request" do
39
55
  cloud_formation = double('CloudFormation')
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.1.0
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
162
  version: '0'
163
163
  segments:
164
164
  - 0
165
- hash: -644821325
165
+ hash: -972857553
166
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  none: false
168
168
  requirements: