fog 0.0.91 → 0.0.92

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.
Files changed (91) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +39 -39
  3. data/fog.gemspec +17 -16
  4. data/lib/fog.rb +1 -1
  5. data/lib/fog/aws/elb.rb +4 -0
  6. data/lib/fog/aws/models/ec2/snapshot.rb +3 -0
  7. data/lib/fog/aws/parsers/ec2/create_snapshot.rb +5 -1
  8. data/lib/fog/aws/parsers/ec2/describe_snapshots.rb +5 -1
  9. data/lib/fog/aws/parsers/elb/create_load_balancer.rb +26 -0
  10. data/lib/fog/aws/parsers/elb/delete_load_balancer.rb +24 -0
  11. data/lib/fog/aws/parsers/s3/access_control_list.rb +46 -0
  12. data/lib/fog/aws/requests/ec2/create_snapshot.rb +11 -7
  13. data/lib/fog/aws/requests/ec2/describe_snapshots.rb +3 -0
  14. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +0 -1
  15. data/lib/fog/aws/requests/ec2/run_instances.rb +0 -2
  16. data/lib/fog/aws/requests/ec2/terminate_instances.rb +0 -1
  17. data/lib/fog/aws/requests/elb/create_load_balancer.rb +57 -0
  18. data/lib/fog/aws/requests/elb/delete_load_balancer.rb +40 -0
  19. data/lib/fog/aws/requests/s3/copy_object.rb +0 -1
  20. data/lib/fog/aws/requests/s3/get_bucket.rb +2 -3
  21. data/lib/fog/aws/requests/s3/get_bucket_acl.rb +53 -0
  22. data/lib/fog/aws/requests/s3/get_object.rb +1 -31
  23. data/lib/fog/aws/requests/s3/get_object_acl.rb +58 -0
  24. data/lib/fog/aws/requests/s3/get_object_torrent.rb +55 -0
  25. data/lib/fog/aws/requests/s3/get_object_url.rb +54 -0
  26. data/lib/fog/aws/requests/s3/put_bucket_acl.rb +80 -0
  27. data/lib/fog/aws/s3.rb +8 -2
  28. data/lib/fog/collection.rb +1 -1
  29. data/lib/fog/connection.rb +7 -5
  30. data/lib/fog/model.rb +5 -2
  31. data/lib/fog/rackspace/files.rb +2 -2
  32. data/lib/fog/rackspace/requests/files/get_object.rb +1 -1
  33. data/lib/fog/terremark/parsers/shared/get_internet_services.rb +2 -2
  34. data/lib/fog/terremark/parsers/shared/get_node_services.rb +3 -0
  35. data/lib/fog/terremark/parsers/shared/vapp.rb +33 -3
  36. data/lib/fog/terremark/requests/shared/delete_internet_service.rb +0 -12
  37. data/lib/fog/terremark/requests/shared/delete_node_service.rb +0 -12
  38. data/lib/fog/terremark/requests/shared/delete_vapp.rb +0 -12
  39. data/lib/fog/terremark/shared.rb +0 -1
  40. data/spec/aws/models/s3/file_spec.rb +2 -2
  41. data/spec/aws/models/s3/files_spec.rb +2 -2
  42. data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
  43. data/spec/aws/requests/s3/get_bucket_spec.rb +9 -9
  44. data/tests/aws/helper.rb +105 -0
  45. data/tests/aws/requests/ec2/address_tests.rb +88 -0
  46. data/tests/aws/requests/ec2/snapshot_tests.rb +50 -0
  47. data/tests/aws/requests/ec2/volume_tests.rb +84 -0
  48. data/tests/helper.rb +21 -6
  49. data/tests/helper_tests.rb +38 -7
  50. data/tests/rackspace/requests/servers/create_image_tests.rb +1 -1
  51. data/tests/rackspace/requests/servers/create_server_tests.rb +1 -1
  52. data/tests/rackspace/requests/servers/delete_image_tests.rb +1 -4
  53. data/tests/rackspace/requests/servers/delete_server_tests.rb +1 -4
  54. data/tests/rackspace/requests/servers/get_flavor_details_tests.rb +2 -5
  55. data/tests/rackspace/requests/servers/get_image_details_tests.rb +2 -5
  56. data/tests/rackspace/requests/servers/get_server_details_tests.rb +2 -5
  57. data/tests/rackspace/requests/servers/list_addresses_tests.rb +2 -5
  58. data/tests/rackspace/requests/servers/list_flavors_detail_tests.rb +1 -1
  59. data/tests/rackspace/requests/servers/list_flavors_tests.rb +1 -1
  60. data/tests/rackspace/requests/servers/list_images_detail_tests.rb +1 -1
  61. data/tests/rackspace/requests/servers/list_images_tests.rb +1 -1
  62. data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +2 -5
  63. data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +2 -5
  64. data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +1 -1
  65. data/tests/rackspace/requests/servers/list_servers_tests.rb +1 -1
  66. data/tests/rackspace/requests/servers/reboot_server_tests.rb +1 -4
  67. data/tests/rackspace/requests/servers/update_server_tests.rb +2 -5
  68. data/tests/slicehost/requests/create_slice_tests.rb +1 -1
  69. data/tests/slicehost/requests/delete_slice_tests.rb +1 -4
  70. data/tests/slicehost/requests/get_backups_tests.rb +1 -2
  71. data/tests/slicehost/requests/get_flavor_tests.rb +2 -5
  72. data/tests/slicehost/requests/get_flavors_tests.rb +1 -1
  73. data/tests/slicehost/requests/get_image_tests.rb +2 -5
  74. data/tests/slicehost/requests/get_images_tests.rb +1 -1
  75. data/tests/slicehost/requests/get_slice_tests.rb +2 -5
  76. data/tests/slicehost/requests/get_slices_tests.rb +1 -1
  77. data/tests/slicehost/requests/reboot_slice_tests.rb +2 -5
  78. metadata +19 -18
  79. data/spec/aws/requests/ec2/allocate_address_spec.rb +0 -18
  80. data/spec/aws/requests/ec2/associate_address_spec.rb +0 -43
  81. data/spec/aws/requests/ec2/attach_volume_spec.rb +0 -51
  82. data/spec/aws/requests/ec2/create_snapshot_spec.rb +0 -36
  83. data/spec/aws/requests/ec2/create_volume_spec.rb +0 -23
  84. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +0 -34
  85. data/spec/aws/requests/ec2/delete_volume_spec.rb +0 -26
  86. data/spec/aws/requests/ec2/describe_addresses_spec.rb +0 -38
  87. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +0 -50
  88. data/spec/aws/requests/ec2/describe_volumes_spec.rb +0 -50
  89. data/spec/aws/requests/ec2/detach_volume_spec.rb +0 -41
  90. data/spec/aws/requests/ec2/disassociate_address_spec.rb +0 -36
  91. data/spec/aws/requests/ec2/release_address_spec.rb +0 -26
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://gemcutter.org'
2
2
 
3
3
  gem 'rake'
4
- gem 'excon', '>= 0.0.21'
4
+ gem 'excon', '>= 0.0.22'
5
5
  gem 'formatador', ">= 0.0.10"
6
6
  gem 'json', ">= 0"
7
7
  gem 'mime-types', ">= 0"
data/Gemfile.lock CHANGED
@@ -1,69 +1,69 @@
1
1
  ---
2
- specs:
3
- - rake:
4
- version: 0.8.7
5
- - excon:
6
- version: 0.0.21
7
- - formatador:
8
- version: 0.0.14
9
- - gestalt:
10
- version: 0.0.6
11
- - json:
12
- version: 1.4.2
13
- - mime-types:
14
- version: "1.16"
15
- - net-ssh:
16
- version: 2.0.22
17
- - nokogiri:
18
- version: 1.4.1
19
- - rspec:
20
- version: 1.3.0
21
- - ruby-hmac:
22
- version: 0.4.0
23
- - shindo:
24
- version: 0.0.18
25
- hash: e443f12a9a7794f2ff4fc8e8d201b12b1e8b30bb
26
- sources:
27
- - Rubygems:
28
- uri: http://gemcutter.org
29
2
  dependencies:
30
3
  formatador:
31
- version: ">= 0.0.10"
32
- group:
33
- - :default
34
- nokogiri:
35
- version: ">= 0"
36
4
  group:
37
5
  - :default
6
+ version: ">= 0.0.10"
38
7
  rake:
39
- version: ">= 0"
40
8
  group:
41
9
  - :default
42
- rspec:
43
10
  version: ">= 0"
11
+ ruby-hmac:
44
12
  group:
45
13
  - :default
46
- ruby-hmac:
47
14
  version: ">= 0"
15
+ mime-types:
48
16
  group:
49
17
  - :default
50
- mime-types:
51
18
  version: ">= 0"
19
+ rspec:
52
20
  group:
53
21
  - :default
54
- net-ssh:
55
22
  version: ">= 0"
23
+ net-ssh:
56
24
  group:
57
25
  - :default
58
- json:
59
26
  version: ">= 0"
27
+ json:
60
28
  group:
61
29
  - :default
30
+ version: ">= 0"
62
31
  excon:
63
- version: ">= 0.0.21"
64
32
  group:
65
33
  - :default
34
+ version: ">= 0.0.22"
66
35
  shindo:
36
+ group:
37
+ - :default
67
38
  version: ">= 0"
39
+ nokogiri:
68
40
  group:
69
41
  - :default
42
+ version: ">= 0"
43
+ specs:
44
+ - rake:
45
+ version: 0.8.7
46
+ - excon:
47
+ version: 0.0.22
48
+ - formatador:
49
+ version: 0.0.14
50
+ - gestalt:
51
+ version: 0.0.6
52
+ - json:
53
+ version: 1.4.3
54
+ - mime-types:
55
+ version: "1.16"
56
+ - net-ssh:
57
+ version: 2.0.22
58
+ - nokogiri:
59
+ version: 1.4.1
60
+ - rspec:
61
+ version: 1.3.0
62
+ - ruby-hmac:
63
+ version: 0.4.0
64
+ - shindo:
65
+ version: 0.0.18
66
+ hash: a39d842433b002231eebfd269d32fe72b489b62f
67
+ sources:
68
+ - Rubygems:
69
+ uri: http://gemcutter.org
data/fog.gemspec CHANGED
@@ -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.0.91'
11
- s.date = '2010-05-05'
10
+ s.version = '0.0.92'
11
+ s.date = '2010-05-10'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
 
43
43
  ## List your runtime dependencies here. Runtime dependencies are those
44
44
  ## that are needed for an end user to actually USE your code.
45
- s.add_dependency('excon', '>=0.0.21')
45
+ s.add_dependency('excon', '>=0.0.23')
46
46
  s.add_dependency('formatador', '>=0.0.10')
47
47
  s.add_dependency('json')
48
48
  s.add_dependency('mime-types')
@@ -114,12 +114,15 @@ Gem::Specification.new do |s|
114
114
  lib/fog/aws/parsers/ec2/get_console_output.rb
115
115
  lib/fog/aws/parsers/ec2/run_instances.rb
116
116
  lib/fog/aws/parsers/ec2/terminate_instances.rb
117
+ lib/fog/aws/parsers/elb/create_load_balancer.rb
118
+ lib/fog/aws/parsers/elb/delete_load_balancer.rb
117
119
  lib/fog/aws/parsers/elb/deregister_instances_from_load_balancer.rb
118
120
  lib/fog/aws/parsers/elb/describe_instance_health.rb
119
121
  lib/fog/aws/parsers/elb/describe_load_balancers.rb
120
122
  lib/fog/aws/parsers/elb/disable_availability_zones_for_load_balancer.rb
121
123
  lib/fog/aws/parsers/elb/enable_availability_zones_for_load_balancer.rb
122
124
  lib/fog/aws/parsers/elb/register_instances_with_load_balancer.rb
125
+ lib/fog/aws/parsers/s3/access_control_list.rb
123
126
  lib/fog/aws/parsers/s3/copy_object.rb
124
127
  lib/fog/aws/parsers/s3/get_bucket.rb
125
128
  lib/fog/aws/parsers/s3/get_bucket_location.rb
@@ -161,6 +164,8 @@ Gem::Specification.new do |s|
161
164
  lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb
162
165
  lib/fog/aws/requests/ec2/run_instances.rb
163
166
  lib/fog/aws/requests/ec2/terminate_instances.rb
167
+ lib/fog/aws/requests/elb/create_load_balancer.rb
168
+ lib/fog/aws/requests/elb/delete_load_balancer.rb
164
169
  lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb
165
170
  lib/fog/aws/requests/elb/describe_instance_health.rb
166
171
  lib/fog/aws/requests/elb/describe_load_balancers.rb
@@ -171,12 +176,17 @@ Gem::Specification.new do |s|
171
176
  lib/fog/aws/requests/s3/delete_bucket.rb
172
177
  lib/fog/aws/requests/s3/delete_object.rb
173
178
  lib/fog/aws/requests/s3/get_bucket.rb
179
+ lib/fog/aws/requests/s3/get_bucket_acl.rb
174
180
  lib/fog/aws/requests/s3/get_bucket_location.rb
175
181
  lib/fog/aws/requests/s3/get_object.rb
182
+ lib/fog/aws/requests/s3/get_object_acl.rb
183
+ lib/fog/aws/requests/s3/get_object_torrent.rb
184
+ lib/fog/aws/requests/s3/get_object_url.rb
176
185
  lib/fog/aws/requests/s3/get_request_payment.rb
177
186
  lib/fog/aws/requests/s3/get_service.rb
178
187
  lib/fog/aws/requests/s3/head_object.rb
179
188
  lib/fog/aws/requests/s3/put_bucket.rb
189
+ lib/fog/aws/requests/s3/put_bucket_acl.rb
180
190
  lib/fog/aws/requests/s3/put_object.rb
181
191
  lib/fog/aws/requests/s3/put_request_payment.rb
182
192
  lib/fog/aws/requests/simpledb/batch_put_attributes.rb
@@ -351,32 +361,19 @@ Gem::Specification.new do |s|
351
361
  spec/aws/models/s3/directory_spec.rb
352
362
  spec/aws/models/s3/file_spec.rb
353
363
  spec/aws/models/s3/files_spec.rb
354
- spec/aws/requests/ec2/allocate_address_spec.rb
355
- spec/aws/requests/ec2/associate_address_spec.rb
356
- spec/aws/requests/ec2/attach_volume_spec.rb
357
364
  spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb
358
365
  spec/aws/requests/ec2/create_key_pair_spec.rb
359
366
  spec/aws/requests/ec2/create_security_group_spec.rb
360
- spec/aws/requests/ec2/create_snapshot_spec.rb
361
- spec/aws/requests/ec2/create_volume_spec.rb
362
367
  spec/aws/requests/ec2/delete_key_pair_spec.rb
363
368
  spec/aws/requests/ec2/delete_security_group_spec.rb
364
- spec/aws/requests/ec2/delete_snapshot_spec.rb
365
- spec/aws/requests/ec2/delete_volume_spec.rb
366
- spec/aws/requests/ec2/describe_addresses_spec.rb
367
369
  spec/aws/requests/ec2/describe_availability_zones_spec.rb
368
370
  spec/aws/requests/ec2/describe_images_spec.rb
369
371
  spec/aws/requests/ec2/describe_instances_spec.rb
370
372
  spec/aws/requests/ec2/describe_key_pairs_spec.rb
371
373
  spec/aws/requests/ec2/describe_regions_spec.rb
372
374
  spec/aws/requests/ec2/describe_security_groups_spec.rb
373
- spec/aws/requests/ec2/describe_snapshots_spec.rb
374
- spec/aws/requests/ec2/describe_volumes_spec.rb
375
- spec/aws/requests/ec2/detach_volume_spec.rb
376
- spec/aws/requests/ec2/disassociate_address_spec.rb
377
375
  spec/aws/requests/ec2/get_console_output_spec.rb
378
376
  spec/aws/requests/ec2/reboot_instances_spec.rb
379
- spec/aws/requests/ec2/release_address_spec.rb
380
377
  spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb
381
378
  spec/aws/requests/ec2/run_instances_spec.rb
382
379
  spec/aws/requests/ec2/terminate_instances_spec.rb
@@ -423,6 +420,10 @@ Gem::Specification.new do |s|
423
420
  spec/slicehost/models/server_spec.rb
424
421
  spec/slicehost/models/servers_spec.rb
425
422
  spec/spec_helper.rb
423
+ tests/aws/helper.rb
424
+ tests/aws/requests/ec2/address_tests.rb
425
+ tests/aws/requests/ec2/snapshot_tests.rb
426
+ tests/aws/requests/ec2/volume_tests.rb
426
427
  tests/helper.rb
427
428
  tests/helper_tests.rb
428
429
  tests/rackspace/helper.rb
data/lib/fog.rb CHANGED
@@ -34,7 +34,7 @@ require 'fog/terremark'
34
34
  module Fog
35
35
 
36
36
  unless const_defined?(:VERSION)
37
- VERSION = '0.0.91'
37
+ VERSION = '0.0.92'
38
38
  end
39
39
 
40
40
  module Mock
data/lib/fog/aws/elb.rb CHANGED
@@ -5,12 +5,16 @@ module Fog
5
5
  def self.new(options={})
6
6
 
7
7
  unless @required
8
+ require 'fog/aws/parsers/elb/create_load_balancer'
9
+ require 'fog/aws/parsers/elb/delete_load_balancer'
8
10
  require 'fog/aws/parsers/elb/deregister_instances_from_load_balancer'
9
11
  require 'fog/aws/parsers/elb/describe_instance_health'
10
12
  require 'fog/aws/parsers/elb/describe_load_balancers'
11
13
  require 'fog/aws/parsers/elb/disable_availability_zones_for_load_balancer'
12
14
  require 'fog/aws/parsers/elb/enable_availability_zones_for_load_balancer'
13
15
  require 'fog/aws/parsers/elb/register_instances_with_load_balancer'
16
+ require 'fog/aws/requests/elb/create_load_balancer'
17
+ require 'fog/aws/requests/elb/delete_load_balancer'
14
18
  require 'fog/aws/requests/elb/deregister_instances_from_load_balancer'
15
19
  require 'fog/aws/requests/elb/describe_instance_health'
16
20
  require 'fog/aws/requests/elb/describe_load_balancers'
@@ -10,10 +10,13 @@ module Fog
10
10
 
11
11
  identity :id, 'snapshotId'
12
12
 
13
+ attribute :description
13
14
  attribute :progress
14
15
  attribute :created_at, 'startTime'
16
+ attribute :owner_id, 'ownerId'
15
17
  attribute :state, 'status'
16
18
  attribute :volume_id, 'volumeId'
19
+ attribute :volume_size, 'volumeSize'
17
20
 
18
21
  def destroy
19
22
  requires :id
@@ -7,10 +7,14 @@ module Fog
7
7
 
8
8
  def end_element(name)
9
9
  case name
10
- when 'progress', 'snapshotId', 'status', 'volumeId'
10
+ when 'description', 'ownerId', 'progress', 'snapshotId', 'status', 'volumeId'
11
+ @response[name] = @value
12
+ when 'requestId'
11
13
  @response[name] = @value
12
14
  when 'startTime'
13
15
  @response[name] = Time.parse(@value)
16
+ when 'volumeSize'
17
+ @response[name] = @value.to_i
14
18
  end
15
19
  end
16
20
 
@@ -15,10 +15,14 @@ module Fog
15
15
  when 'item'
16
16
  @response['snapshotSet'] << @snapshot
17
17
  @snapshot = {}
18
- when 'progress', 'snapshotId', 'status', 'volumeId'
18
+ when 'description', 'ownerId', 'progress', 'snapshotId', 'status', 'volumeId'
19
19
  @snapshot[name] = @value
20
+ when 'requestId'
21
+ @response[name] = @value
20
22
  when 'startTime'
21
23
  @snapshot[name] = Time.parse(@value)
24
+ when 'volumeSize'
25
+ @snapshot[name] = @value.to_i
22
26
  end
23
27
  end
24
28
 
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ELB
5
+
6
+ class CreateLoadBalancer < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'CreateLoadBalancerResult' => {}, 'ResponseMetadata' => {} }
10
+ end
11
+
12
+ def end_element(name)
13
+ case name
14
+ when 'DNSName'
15
+ @response['CreateLoadBalancerResult'][name] = @value
16
+ when 'RequestId'
17
+ @response['ResponseMetadata'][name] = @value
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module ELB
5
+
6
+ class DeleteLoadBalancer < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'DeleteLoadBalancerResult' => nil, 'ResponseMetadata' => {} }
10
+ end
11
+
12
+ def end_element(name)
13
+ case name
14
+ when 'RequestId'
15
+ @response['ResponseMetadata'][name] = @value
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Parsers
3
+ module AWS
4
+ module S3
5
+
6
+ class AccessControlList < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @in_access_control_list = false
10
+ @grant = { 'Grantee' => {} }
11
+ @response = { 'Owner' => {}, 'AccessControlList' => [] }
12
+ end
13
+
14
+ def start_element(name, attrs = [])
15
+ super
16
+ if name == 'AccessControlList'
17
+ @in_access_control_list = true
18
+ end
19
+ end
20
+
21
+ def end_element(name)
22
+ case name
23
+ when 'AccessControlList'
24
+ @in_access_control_list = false
25
+ when 'Grant'
26
+ @response['AccessControlList'] << @grant
27
+ @grant = { 'Grantee' => {} }
28
+ when 'DisplayName', 'ID'
29
+ if @in_access_control_list
30
+ @grant['Grantee'][name] = @value
31
+ else
32
+ @response['Owner'][name] = @value
33
+ end
34
+ when 'Permission'
35
+ @grant[name] = @value
36
+ when 'URI'
37
+ @grant['Grantee'][name] = @value
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -17,11 +17,12 @@ module Fog
17
17
  # * 'startTime'<~Time> - timestamp when snapshot was initiated
18
18
  # * 'status'<~String> - state of snapshot
19
19
  # * 'volumeId'<~String> - id of volume snapshot targets
20
- def create_snapshot(volume_id)
20
+ def create_snapshot(volume_id, description = nil)
21
21
  request(
22
- 'Action' => 'CreateSnapshot',
23
- 'VolumeId' => volume_id,
24
- :parser => Fog::Parsers::AWS::EC2::CreateSnapshot.new
22
+ 'Action' => 'CreateSnapshot',
23
+ 'Description' => description,
24
+ 'VolumeId' => volume_id,
25
+ :parser => Fog::Parsers::AWS::EC2::CreateSnapshot.new
25
26
  )
26
27
  end
27
28
 
@@ -29,17 +30,20 @@ module Fog
29
30
 
30
31
  class Mock
31
32
 
32
- def create_snapshot(volume_id)
33
+ def create_snapshot(volume_id, description = nil)
33
34
  response = Excon::Response.new
34
- if @data[:volumes][volume_id]
35
+ if volume = @data[:volumes][volume_id]
35
36
  response.status = 200
36
37
  snapshot_id = Fog::AWS::Mock.snapshot_id
37
38
  data = {
39
+ 'description' => description,
40
+ 'ownerId' => @owner_id,
38
41
  'progress' => nil,
39
42
  'snapshotId' => snapshot_id,
40
43
  'startTime' => Time.now,
41
44
  'status' => 'pending',
42
- 'volumeId' => volume_id
45
+ 'volumeId' => volume_id,
46
+ 'volumeSize' => volume['size']
43
47
  }
44
48
  @data[:snapshots][snapshot_id] = data
45
49
  response.body = {
@@ -53,6 +53,9 @@ module Fog
53
53
  elsif Time.now - snapshot['startTime'] > Fog::Mock.delay
54
54
  snapshot['progress'] = '50%'
55
55
  snapshot['status'] = 'in progress'
56
+ else
57
+ snapshot['progress'] = '0%'
58
+ snapshot['status'] = 'in progress'
56
59
  end
57
60
  end
58
61
  end