fog 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.2.17'
11
- s.date = '2010-07-23'
10
+ s.version = '0.2.18'
11
+ s.date = '2010-07-24'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -100,6 +100,7 @@ Gem::Specification.new do |s|
100
100
  lib/fog/aws/parsers/ec2/allocate_address.rb
101
101
  lib/fog/aws/parsers/ec2/attach_volume.rb
102
102
  lib/fog/aws/parsers/ec2/basic.rb
103
+ lib/fog/aws/parsers/ec2/create_image.rb
103
104
  lib/fog/aws/parsers/ec2/create_key_pair.rb
104
105
  lib/fog/aws/parsers/ec2/create_snapshot.rb
105
106
  lib/fog/aws/parsers/ec2/create_volume.rb
@@ -144,6 +145,7 @@ Gem::Specification.new do |s|
144
145
  lib/fog/aws/requests/ec2/associate_address.rb
145
146
  lib/fog/aws/requests/ec2/attach_volume.rb
146
147
  lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb
148
+ lib/fog/aws/requests/ec2/create_image.rb
147
149
  lib/fog/aws/requests/ec2/create_key_pair.rb
148
150
  lib/fog/aws/requests/ec2/create_security_group.rb
149
151
  lib/fog/aws/requests/ec2/create_snapshot.rb
data/lib/fog.rb CHANGED
@@ -40,7 +40,7 @@ require 'fog/vcloud'
40
40
  module Fog
41
41
 
42
42
  unless const_defined?(:VERSION)
43
- VERSION = '0.2.17'
43
+ VERSION = '0.2.18'
44
44
  end
45
45
 
46
46
  module Mock
@@ -33,6 +33,7 @@ module Fog
33
33
  request 'create_key_pair'
34
34
  request 'create_security_group'
35
35
  request 'create_snapshot'
36
+ request 'create_image'
36
37
  request 'create_volume'
37
38
  request 'delete_key_pair'
38
39
  request 'delete_security_group'
@@ -0,0 +1,20 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module EC2
5
+
6
+ class CreateImage < Fog::Parsers::Base
7
+
8
+ def end_element(name)
9
+ case name
10
+ when 'instanceId', 'requestId', 'name', 'description', 'noReboot', 'imageId'
11
+ @response[name] = @value
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,58 @@
1
+ module Fog
2
+ module AWS
3
+ module EC2
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/ec2/create_image'
7
+
8
+ # Create a bootable EBS volume AMI
9
+ #
10
+ # ==== Parameters
11
+ # * instance_id<~String> - Instance used to create image.
12
+ # * name<~Name> - Name to give image.
13
+ # * description<~Name> - Description of image.
14
+ # * no_reboot<~Boolean> - Optional, whether or not to reboot the image when making the snapshot
15
+ #
16
+ # ==== Returns
17
+ # * response<~Excon::Response>:
18
+ # * body<~Hash>:
19
+ # * 'imageId'<~String> - The ID of the created AMI.
20
+ # * 'requestId'<~String> - Id of request.
21
+ def create_image(instance_id, name, description, no_reboot = false)
22
+ request(
23
+ 'Action' => 'CreateImage',
24
+ 'InstanceId' => instance_id,
25
+ 'Name' => name,
26
+ 'Description' => description,
27
+ 'NoReboot' => no_reboot.to_s,
28
+ :parser => Fog::Parsers::AWS::EC2::CreateImage.new
29
+ )
30
+ end
31
+ end
32
+
33
+ class Mock
34
+
35
+ def create_image(instance_id, name, description, no_reboot = false)
36
+ response = Excon::Response.new
37
+ if instance_id && !name.empty?
38
+ response.status = 200
39
+ response.body = {
40
+ 'requestId' => Fog::AWS::Mock.request_id,
41
+ 'imageId' => Fog::AWS::Mock.image_id
42
+ }
43
+ else
44
+ response.status = 400
45
+ response.body = {
46
+ 'Code' => 'InvalidParameterValue'
47
+ }
48
+ if name.empty?
49
+ response.body['Message'] = "Invalid value '' for name. Must be specified."
50
+ end
51
+ end
52
+ response
53
+ end
54
+
55
+ end
56
+ end
57
+ end
58
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 17
9
- version: 0.2.17
8
+ - 18
9
+ version: 0.2.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-23 00:00:00 -07:00
17
+ date: 2010-07-24 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -189,6 +189,7 @@ files:
189
189
  - lib/fog/aws/parsers/ec2/allocate_address.rb
190
190
  - lib/fog/aws/parsers/ec2/attach_volume.rb
191
191
  - lib/fog/aws/parsers/ec2/basic.rb
192
+ - lib/fog/aws/parsers/ec2/create_image.rb
192
193
  - lib/fog/aws/parsers/ec2/create_key_pair.rb
193
194
  - lib/fog/aws/parsers/ec2/create_snapshot.rb
194
195
  - lib/fog/aws/parsers/ec2/create_volume.rb
@@ -233,6 +234,7 @@ files:
233
234
  - lib/fog/aws/requests/ec2/associate_address.rb
234
235
  - lib/fog/aws/requests/ec2/attach_volume.rb
235
236
  - lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb
237
+ - lib/fog/aws/requests/ec2/create_image.rb
236
238
  - lib/fog/aws/requests/ec2/create_key_pair.rb
237
239
  - lib/fog/aws/requests/ec2/create_security_group.rb
238
240
  - lib/fog/aws/requests/ec2/create_snapshot.rb