fog 0.3.17 → 0.3.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/Gemfile.lock +5 -5
  2. data/README.rdoc +16 -7
  3. data/fog.gemspec +102 -27
  4. data/lib/fog.rb +3 -2
  5. data/lib/fog/aws/cdn.rb +2 -1
  6. data/lib/fog/aws/compute.rb +3 -2
  7. data/lib/fog/aws/iam.rb +8 -0
  8. data/lib/fog/aws/models/compute/flavors.rb +2 -1
  9. data/lib/fog/aws/models/compute/server.rb +3 -0
  10. data/lib/fog/aws/models/compute/volume.rb +9 -8
  11. data/lib/fog/aws/models/storage/file.rb +24 -14
  12. data/lib/fog/aws/models/storage/files.rb +4 -14
  13. data/lib/fog/aws/parsers/cdn/distribution.rb +16 -1
  14. data/lib/fog/aws/parsers/cdn/get_distribution_list.rb +13 -0
  15. data/lib/fog/aws/parsers/compute/describe_volumes.rb +2 -0
  16. data/lib/fog/aws/parsers/iam/create_group.rb +2 -2
  17. data/lib/fog/aws/parsers/iam/create_user.rb +26 -0
  18. data/lib/fog/aws/parsers/iam/list_group_policies.rb +28 -0
  19. data/lib/fog/aws/parsers/iam/list_groups.rb +1 -1
  20. data/lib/fog/aws/parsers/storage/complete_multipart_upload.rb +24 -0
  21. data/lib/fog/aws/parsers/storage/initiate_multipart_upload.rb +24 -0
  22. data/lib/fog/aws/parsers/storage/list_multipart_uploads.rb +56 -0
  23. data/lib/fog/aws/parsers/storage/list_parts.rb +40 -0
  24. data/lib/fog/aws/requests/cdn/get_distribution.rb +11 -1
  25. data/lib/fog/aws/requests/cdn/get_distribution_list.rb +9 -1
  26. data/lib/fog/aws/requests/cdn/post_distribution.rb +16 -5
  27. data/lib/fog/aws/requests/cdn/put_distribution_config.rb +102 -0
  28. data/lib/fog/aws/requests/compute/describe_volumes.rb +1 -0
  29. data/lib/fog/aws/requests/compute/run_instances.rb +1 -1
  30. data/lib/fog/aws/requests/iam/add_user_to_group.rb +42 -0
  31. data/lib/fog/aws/requests/iam/create_group.rb +7 -3
  32. data/lib/fog/aws/requests/iam/create_user.rb +47 -0
  33. data/lib/fog/aws/requests/iam/delete_group.rb +5 -1
  34. data/lib/fog/aws/requests/iam/delete_group_policy.rb +42 -0
  35. data/lib/fog/aws/requests/iam/delete_user.rb +40 -0
  36. data/lib/fog/aws/requests/iam/list_group_policies.rb +47 -0
  37. data/lib/fog/aws/requests/iam/list_groups.rb +9 -4
  38. data/lib/fog/aws/requests/iam/put_group_policy.rb +44 -0
  39. data/lib/fog/aws/requests/iam/remove_user_from_group.rb +42 -0
  40. data/lib/fog/aws/requests/simpledb/put_attributes.rb +2 -2
  41. data/lib/fog/aws/requests/storage/abort_multipart_upload.rb +38 -0
  42. data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +60 -0
  43. data/lib/fog/aws/requests/storage/get_service.rb +1 -1
  44. data/lib/fog/aws/requests/storage/initiate_multipart_upload.rb +55 -0
  45. data/lib/fog/aws/requests/storage/list_multipart_uploads.rb +68 -0
  46. data/lib/fog/aws/requests/storage/list_parts.rb +67 -0
  47. data/lib/fog/aws/requests/storage/put_object.rb +12 -5
  48. data/lib/fog/aws/requests/storage/upload_part.rb +51 -0
  49. data/lib/fog/aws/storage.rb +12 -6
  50. data/lib/fog/brightbox.rb +7 -0
  51. data/lib/fog/brightbox/bin.rb +23 -0
  52. data/lib/fog/brightbox/compute.rb +134 -0
  53. data/lib/fog/brightbox/models/compute/account.rb +51 -0
  54. data/lib/fog/brightbox/models/compute/cloud_ip.rb +43 -0
  55. data/lib/fog/brightbox/models/compute/cloud_ips.rb +34 -0
  56. data/lib/fog/brightbox/models/compute/flavor.rb +33 -0
  57. data/lib/fog/brightbox/models/compute/flavors.rb +28 -0
  58. data/lib/fog/brightbox/models/compute/image.rb +52 -0
  59. data/lib/fog/brightbox/models/compute/images.rb +28 -0
  60. data/lib/fog/brightbox/models/compute/server.rb +94 -0
  61. data/lib/fog/brightbox/models/compute/servers.rb +29 -0
  62. data/lib/fog/brightbox/models/compute/user.rb +39 -0
  63. data/lib/fog/brightbox/models/compute/users.rb +29 -0
  64. data/lib/fog/brightbox/models/compute/zone.rb +21 -0
  65. data/lib/fog/brightbox/models/compute/zones.rb +29 -0
  66. data/lib/fog/brightbox/requests/compute/create_api_client.rb +27 -0
  67. data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +27 -0
  68. data/lib/fog/brightbox/requests/compute/create_image.rb +27 -0
  69. data/lib/fog/brightbox/requests/compute/create_server.rb +27 -0
  70. data/lib/fog/brightbox/requests/compute/destroy_api_client.rb +28 -0
  71. data/lib/fog/brightbox/requests/compute/destroy_cloud_ip.rb +28 -0
  72. data/lib/fog/brightbox/requests/compute/destroy_image.rb +28 -0
  73. data/lib/fog/brightbox/requests/compute/destroy_server.rb +28 -0
  74. data/lib/fog/brightbox/requests/compute/get_account.rb +27 -0
  75. data/lib/fog/brightbox/requests/compute/get_api_client.rb +28 -0
  76. data/lib/fog/brightbox/requests/compute/get_cloud_ip.rb +28 -0
  77. data/lib/fog/brightbox/requests/compute/get_image.rb +28 -0
  78. data/lib/fog/brightbox/requests/compute/get_interface.rb +28 -0
  79. data/lib/fog/brightbox/requests/compute/get_server.rb +28 -0
  80. data/lib/fog/brightbox/requests/compute/get_server_type.rb +28 -0
  81. data/lib/fog/brightbox/requests/compute/get_user.rb +28 -0
  82. data/lib/fog/brightbox/requests/compute/get_zone.rb +28 -0
  83. data/lib/fog/brightbox/requests/compute/list_api_clients.rb +27 -0
  84. data/lib/fog/brightbox/requests/compute/list_cloud_ips.rb +27 -0
  85. data/lib/fog/brightbox/requests/compute/list_images.rb +27 -0
  86. data/lib/fog/brightbox/requests/compute/list_server_types.rb +27 -0
  87. data/lib/fog/brightbox/requests/compute/list_servers.rb +27 -0
  88. data/lib/fog/brightbox/requests/compute/list_users.rb +27 -0
  89. data/lib/fog/brightbox/requests/compute/list_zones.rb +27 -0
  90. data/lib/fog/brightbox/requests/compute/map_cloud_ip.rb +28 -0
  91. data/lib/fog/brightbox/requests/compute/reset_ftp_password_account.rb +27 -0
  92. data/lib/fog/brightbox/requests/compute/resize_server.rb +27 -0
  93. data/lib/fog/brightbox/requests/compute/shutdown_server.rb +28 -0
  94. data/lib/fog/brightbox/requests/compute/snapshot_server.rb +28 -0
  95. data/lib/fog/brightbox/requests/compute/start_server.rb +28 -0
  96. data/lib/fog/brightbox/requests/compute/stop_server.rb +28 -0
  97. data/lib/fog/brightbox/requests/compute/unmap_cloud_ip.rb +28 -0
  98. data/lib/fog/brightbox/requests/compute/update_account.rb +28 -0
  99. data/lib/fog/brightbox/requests/compute/update_api_client.rb +29 -0
  100. data/lib/fog/brightbox/requests/compute/update_image.rb +29 -0
  101. data/lib/fog/brightbox/requests/compute/update_server.rb +29 -0
  102. data/lib/fog/brightbox/requests/compute/update_user.rb +29 -0
  103. data/lib/fog/core/attributes.rb +3 -3
  104. data/lib/fog/core/bin.rb +2 -0
  105. data/lib/fog/core/compute.rb +5 -2
  106. data/lib/fog/core/credentials.rb +2 -0
  107. data/lib/fog/core/service.rb +24 -12
  108. data/lib/fog/google/models/storage/file.rb +23 -14
  109. data/lib/fog/google/models/storage/files.rb +4 -14
  110. data/lib/fog/google/requests/storage/get_bucket.rb +0 -1
  111. data/lib/fog/google/requests/storage/put_object.rb +9 -2
  112. data/lib/fog/rackspace/models/storage/file.rb +3 -3
  113. data/lib/fog/rackspace/models/storage/files.rb +5 -13
  114. data/spec/aws/models/compute/server_spec.rb +0 -3
  115. data/spec/aws/requests/simpledb/get_attributes_spec.rb +11 -0
  116. data/spec/core/attributes_spec.rb +52 -0
  117. data/spec/vcloud/bin_spec.rb +1 -1
  118. data/spec/vcloud/vcloud_spec.rb +1 -1
  119. data/tests/aws/models/compute/flavors_tests.rb +5 -0
  120. data/tests/aws/models/compute/server_tests.rb +6 -0
  121. data/tests/aws/models/compute/servers_tests.rb +6 -0
  122. data/tests/aws/requests/storage/bucket_tests.rb +1 -1
  123. data/tests/aws/requests/storage/multipart_upload_tests.rb +135 -0
  124. data/tests/bluebox/models/compute/flavors_tests.rb +5 -0
  125. data/tests/bluebox/models/compute/server_tests.rb +5 -0
  126. data/tests/bluebox/models/compute/servers_tests.rb +6 -0
  127. data/tests/brightbox/helper.rb +0 -0
  128. data/tests/brightbox/models/compute/flavors_tests.rb +5 -0
  129. data/tests/brightbox/models/compute/server_tests.rb +6 -0
  130. data/tests/brightbox/models/compute/servers_tests.rb +6 -0
  131. data/tests/google/requests/storage/bucket_tests.rb +78 -0
  132. data/tests/google/requests/storage/object_tests.rb +81 -0
  133. data/tests/helper.rb +19 -4
  134. data/tests/helpers/collection_tests.rb +51 -0
  135. data/tests/helpers/compute/flavors_tests.rb +34 -0
  136. data/tests/helpers/compute/server_tests.rb +19 -0
  137. data/tests/helpers/compute/servers_tests.rb +11 -0
  138. data/tests/helpers/model_tests.rb +28 -0
  139. data/tests/helpers/storage/directories_tests.rb +4 -36
  140. data/tests/helpers/storage/directory_tests.rb +8 -22
  141. data/tests/helpers/storage/file_tests.rb +8 -25
  142. data/tests/helpers/storage/files_tests.rb +5 -39
  143. data/tests/local/models/storage/directories_tests.rb +1 -1
  144. data/tests/local/models/storage/directory_tests.rb +1 -1
  145. data/tests/local/models/storage/file_tests.rb +1 -1
  146. data/tests/local/models/storage/files_tests.rb +1 -1
  147. data/tests/rackspace/models/compute/flavors_tests.rb +5 -0
  148. data/tests/rackspace/models/compute/server_tests.rb +6 -0
  149. data/tests/rackspace/models/compute/servers_tests.rb +6 -0
  150. data/tests/rackspace/models/storage/directories_tests.rb +1 -1
  151. data/tests/rackspace/models/storage/directory_tests.rb +1 -1
  152. data/tests/rackspace/models/storage/file_tests.rb +1 -1
  153. data/tests/rackspace/models/storage/files_tests.rb +1 -1
  154. data/tests/slicehost/models/compute/flavors_tests.rb +5 -0
  155. data/tests/slicehost/models/compute/server_tests.rb +6 -0
  156. data/tests/slicehost/models/compute/servers_tests.rb +6 -0
  157. metadata +108 -31
  158. data/spec/aws/models/compute/flavors_spec.rb +0 -14
  159. data/spec/aws/models/compute/servers_spec.rb +0 -21
  160. data/spec/bluebox/models/compute/flavors_spec.rb +0 -17
  161. data/spec/bluebox/models/compute/server_spec.rb +0 -29
  162. data/spec/bluebox/models/compute/servers_spec.rb +0 -31
  163. data/spec/google/requests/storage/copy_object_spec.rb +0 -61
  164. data/spec/google/requests/storage/delete_bucket_spec.rb +0 -35
  165. data/spec/google/requests/storage/delete_object_spec.rb +0 -38
  166. data/spec/google/requests/storage/get_bucket_spec.rb +0 -110
  167. data/spec/google/requests/storage/get_object_spec.rb +0 -58
  168. data/spec/google/requests/storage/get_service_spec.rb +0 -32
  169. data/spec/google/requests/storage/head_object_spec.rb +0 -26
  170. data/spec/google/requests/storage/put_bucket_spec.rb +0 -21
  171. data/spec/google/requests/storage/put_object_spec.rb +0 -43
  172. data/spec/rackspace/models/compute/flavors_spec.rb +0 -18
  173. data/spec/rackspace/models/compute/server_spec.rb +0 -55
  174. data/spec/rackspace/models/compute/servers_spec.rb +0 -22
  175. data/spec/shared_examples/flavors_examples.rb +0 -16
  176. data/spec/shared_examples/server_examples.rb +0 -43
  177. data/spec/shared_examples/servers_examples.rb +0 -37
  178. data/spec/slicehost/models/compute/flavors_spec.rb +0 -18
  179. data/spec/slicehost/models/compute/server_spec.rb +0 -55
  180. data/spec/slicehost/models/compute/servers_spec.rb +0 -26
@@ -1,14 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
- require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples'
3
-
4
- describe 'Fog::AWS::Compute::Flavors' do
5
-
6
- it_should_behave_like "Flavors"
7
-
8
- subject { @flavor = @flavors.all.first }
9
-
10
- before(:each) do
11
- @flavors = AWS[:compute].flavors
12
- end
13
-
14
- end
@@ -1,21 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
- require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples'
3
-
4
- describe 'Fog::AWS::Compute::Servers' do
5
-
6
- it_should_behave_like "Servers"
7
-
8
- subject { @server = @servers.new(:image_id => GENTOO_AMI) }
9
-
10
- before(:each) do
11
- @servers = AWS[:compute].servers
12
- end
13
-
14
- after(:each) do
15
- if @server && !@server.new_record?
16
- @server.wait_for { ready? }
17
- @server.destroy.should be_true
18
- end
19
- end
20
-
21
- end
@@ -1,17 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
- require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples'
3
-
4
- describe 'Fog::Bluebox::Compute::Flavors' do
5
-
6
- if Fog.mocking?
7
- it "needs to have mocks implemented"
8
- else
9
- it_should_behave_like "Flavors"
10
- end
11
- subject { @flavor = @flavors.all.first }
12
-
13
- before(:each) do
14
- @flavors = Bluebox[:compute].flavors
15
- end
16
-
17
- end
@@ -1,29 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
- require File.dirname(__FILE__) + '/../../../shared_examples/server_examples'
3
-
4
- describe 'Fog::Bluebox::Compute::Server' do
5
-
6
- if Fog.mocking?
7
- it "needs to have mocks implemented"
8
- else
9
- it_should_behave_like "Server"
10
- end
11
-
12
- subject {
13
- @flavor_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # Block 1GB Virtual Server
14
- @image_id = 'a00baa8f-b5d0-4815-8238-b471c4c4bf72' # Ubuntu 9.10 64bit
15
- @server = @servers.new(:flavor_id => @flavor_id, :image_id => @image_id, :password => "chunkybacon")
16
- }
17
-
18
- before(:each) do
19
- @servers = Bluebox[:compute].servers
20
- end
21
-
22
- after(:each) do
23
- if @server && !@server.new_record?
24
- @server.wait_for { ready? }
25
- @server.destroy.should be_true
26
- end
27
- end
28
-
29
- end
@@ -1,31 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
- require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples'
3
-
4
- describe 'Fog::Bluebox::Compute::Servers' do
5
-
6
- if Fog.mocking?
7
- it "needs to have mocks implemented"
8
- else
9
- it_should_behave_like "Servers"
10
- end
11
-
12
- # flavor 1 = 256, image 3 = gentoo 2008.0
13
- subject {
14
- @flavor_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # Block 1GB Virtual Server
15
- @image_id = 'a00baa8f-b5d0-4815-8238-b471c4c4bf72' # Ubuntu 9.10 64bit
16
- @server = @servers.new(:flavor_id => @flavor_id, :image_id => @image_id, :password => "chunkybacon")
17
- @server
18
- }
19
-
20
- before(:each) do
21
- @servers = Bluebox[:compute].servers
22
- end
23
-
24
- after(:each) do
25
- if @server && !@server.new_record?
26
- @server.wait_for { ready? }
27
- @server.destroy.should be_true
28
- end
29
- end
30
-
31
- end
@@ -1,61 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.copy_object' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- Google[:storage].put_bucket('fogcopyobjectsource')
8
- Google[:storage].put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
9
- Google[:storage].put_bucket('fogcopyobjectdestination')
10
- end
11
-
12
- after(:each) do
13
- Google[:storage].delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
14
- Google[:storage].delete_bucket('fogcopyobjectdestination')
15
- Google[:storage].delete_object('fogcopyobjectsource', 'fog_copy_object_source')
16
- Google[:storage].delete_bucket('fogcopyobjectsource')
17
- end
18
-
19
- it 'should return proper attributes' do
20
- actual = Google[:storage].copy_object(
21
- 'fogcopyobjectsource', 'fog_copy_object_source',
22
- 'fogcopyobjectdestination', 'fog_copy_object_destination'
23
- )
24
- actual.status.should == 200
25
- actual.body['ETag'].should be_a(String)
26
- actual.body['LastModified'].should be_a(Time)
27
- end
28
-
29
- end
30
- describe 'failure' do
31
-
32
- it 'should raise a NotFound error if the source_bucket does not exist' do
33
- lambda {
34
- Google[:storage].copy_object(
35
- 'fognotabucket', 'fog_copy_object_source',
36
- 'fogcopyobjectdestination', 'fog_copy_object_destination'
37
- )
38
- }.should raise_error(Excon::Errors::NotFound)
39
- end
40
-
41
- it 'should raise a NotFound error if the source_object does not exist' do
42
- lambda {
43
- Google[:storage].copy_object(
44
- 'fogcopyobjectsource', 'fog_not_an_object',
45
- 'fogcopyobjectdestination', 'fog_copy_object_destination'
46
- )
47
- }.should raise_error(Excon::Errors::NotFound)
48
- end
49
-
50
- it 'should raise a NotFound error if the target_bucket does not exist' do
51
- lambda {
52
- Google[:storage].copy_object(
53
- 'fogcopyobjectsource', 'fog_copy_object_source',
54
- 'fognotabucket', 'fog_copy_object_destination'
55
- )
56
- }.should raise_error(Excon::Errors::NotFound)
57
- end
58
-
59
- end
60
-
61
- end
@@ -1,35 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.delete_bucket' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- Google[:storage].put_bucket('fogdeletebucket')
8
- end
9
-
10
- it 'should return proper attributes' do
11
- actual = Google[:storage].delete_bucket('fogdeletebucket')
12
- actual.status.should == 204
13
- end
14
-
15
- end
16
- describe 'failure' do
17
-
18
- it 'should raise a NotFound error if the bucket does not exist' do
19
- lambda {
20
- Google[:storage].delete_bucket('fognotabucket')
21
- }.should raise_error(Excon::Errors::NotFound)
22
- end
23
-
24
- it 'should raise a Conflict error if the bucket is not empty' do
25
- Google[:storage].put_bucket('fogdeletebucket')
26
- Google[:storage].put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
27
- lambda {
28
- Google[:storage].delete_bucket('fogdeletebucket')
29
- }.should raise_error(Excon::Errors::Conflict)
30
- Google[:storage].delete_object('fogdeletebucket', 'fog_delete_object')
31
- Google[:storage].delete_bucket('fogdeletebucket')
32
- end
33
-
34
- end
35
- end
@@ -1,38 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.delete_object' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- Google[:storage].put_bucket('fogdeleteobject')
8
- Google[:storage].put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
9
- end
10
-
11
- after(:each) do
12
- Google[:storage].delete_bucket('fogdeleteobject')
13
- end
14
-
15
- it 'should return proper attributes' do
16
- actual = Google[:storage].delete_object('fogdeleteobject', 'fog_delete_object')
17
- actual.status.should == 204
18
- end
19
-
20
- end
21
- describe 'failure' do
22
-
23
- it 'should raise a NotFound error if the bucket does not exist' do
24
- lambda {
25
- Google[:storage].delete_object('fognotabucket', 'fog_delete_object')
26
- }.should raise_error(Excon::Errors::NotFound)
27
- end
28
-
29
- it 'should raise an error if the object does not exist' do
30
- Google[:storage].put_bucket('fogdeleteobject')
31
- lambda {
32
- Google[:storage].delete_object('fogdeleteobject', 'fog_not_an_object')
33
- }.should raise_error(Excon::Errors::NotFound)
34
- Google[:storage].delete_bucket('fogdeleteobject')
35
- end
36
-
37
- end
38
- end
@@ -1,110 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.get_bucket' do
4
- describe 'success' do
5
-
6
- before(:all) do
7
- Google[:storage].put_bucket('foggetbucket')
8
- Google[:storage].put_object('foggetbucket', 'fog_object', lorem_file)
9
- Google[:storage].put_object('foggetbucket', 'fog_other_object', lorem_file)
10
- end
11
-
12
- after(:all) do
13
- Google[:storage].delete_object('foggetbucket', 'fog_object')
14
- Google[:storage].delete_object('foggetbucket', 'fog_other_object')
15
- Google[:storage].delete_bucket('foggetbucket')
16
- end
17
-
18
- it 'should return proper attributes' do
19
- actual = Google[:storage].get_bucket('foggetbucket')
20
- actual.body['IsTruncated'].should == false
21
- actual.body['Marker'].should be_nil
22
- actual.body['Name'].should be_a(String)
23
- actual.body['Prefix'].should be_nil
24
- actual.body['Contents'].should be_an(Array)
25
- actual.body['Contents'].length.should == 2
26
- object = actual.body['Contents'].first
27
- object['ETag'].should be_a(String)
28
- object['Key'].should == 'fog_object'
29
- object['LastModified'].should be_a(Time)
30
- owner = object['Owner']
31
- owner['DisplayName'].should be_a(String)
32
- owner['ID'].should be_a(String)
33
- object['Size'].should be_an(Integer)
34
- object['StorageClass'].should be_a(String)
35
- end
36
-
37
- it 'should accept marker option' do
38
- actual = Google[:storage].get_bucket('foggetbucket', 'marker' => 'fog_object')
39
- actual.body['IsTruncated'].should == false
40
- actual.body['Marker'].should be_a(String)
41
- actual.body['Name'].should be_a(String)
42
- actual.body['Prefix'].should be_nil
43
- actual.body['Contents'].should be_an(Array)
44
- actual.body['Contents'].length.should == 1
45
- object = actual.body['Contents'].first
46
- object['ETag'].should be_a(String)
47
- object['Key'].should == 'fog_other_object'
48
- object['LastModified'].should be_a(Time)
49
- owner = object['Owner']
50
- owner['DisplayName'].should be_a(String)
51
- owner['ID'].should be_a(String)
52
- object['Size'].should be_an(Integer)
53
- object['StorageClass'].should be_a(String)
54
- end
55
-
56
- it 'should accept max-keys option' do
57
- actual = Google[:storage].get_bucket('foggetbucket', 'max-keys' => 1)
58
- actual.body['IsTruncated'].should == true
59
- actual.body['Marker'].should be_nil
60
- actual.body['Name'].should be_a(String)
61
- actual.body['Prefix'].should be_nil
62
- actual.body['Contents'].should be_an(Array)
63
- actual.body['Contents'].length.should == 1
64
- object = actual.body['Contents'].first
65
- object['ETag'].should be_a(String)
66
- object['Key'].should == 'fog_object'
67
- object['LastModified'].should be_a(Time)
68
- owner = object['Owner']
69
- owner['DisplayName'].should be_a(String)
70
- owner['ID'].should be_a(String)
71
- object['Size'].should be_an(Integer)
72
- object['StorageClass'].should be_a(String)
73
- end
74
-
75
- it 'should accept prefix option' do
76
- actual = Google[:storage].get_bucket('foggetbucket', 'prefix' => 'fog_ob')
77
- actual.body['IsTruncated'].should == false
78
- actual.body['Marker'].should be_nil
79
- actual.body['Name'].should be_a(String)
80
- actual.body['Prefix'].should be_a(String)
81
- actual.body['Contents'].should be_an(Array)
82
- actual.body['Contents'].length.should == 1
83
- object = actual.body['Contents'].first
84
- object['ETag'].should be_a(String)
85
- object['Key'].should == 'fog_object'
86
- object['LastModified'].should be_a(Time)
87
- owner = object['Owner']
88
- owner['DisplayName'].should be_a(String)
89
- owner['ID'].should be_a(String)
90
- object['Size'].should be_an(Integer)
91
- object['StorageClass'].should be_a(String)
92
- end
93
-
94
- end
95
- describe 'failure' do
96
-
97
- it 'should raise a NotFound error if the bucket does not exist' do
98
- lambda {
99
- Google[:storage].get_bucket('fognotabucket')
100
- }.should raise_error(Excon::Errors::NotFound)
101
- end
102
-
103
- it 'should request non-subdomain buckets and raise a NotFound error' do
104
- lambda {
105
- Google[:storage].get_bucket('A-invalid--name')
106
- }.should raise_error(Excon::Errors::BadRequest)
107
- end
108
-
109
- end
110
- end
@@ -1,58 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.get_object' do
4
- describe 'success' do
5
-
6
- before(:each) do
7
- Google[:storage].put_bucket('foggetobject')
8
- Google[:storage].put_object('foggetobject', 'fog_get_object', lorem_file,{'x-goog-acl' => 'public-read'})
9
- end
10
-
11
- after(:each) do
12
- Google[:storage].delete_object('foggetobject', 'fog_get_object')
13
- Google[:storage].delete_bucket('foggetobject')
14
- end
15
-
16
- it 'should return proper attributes' do
17
- actual = Google[:storage].get_object('foggetobject', 'fog_get_object')
18
- actual.status.should == 200
19
- data = lorem_file.read
20
- actual.body.should == data
21
- actual.body.length.should == data.length
22
- actual.headers['Content-Type'].should be_a(String)
23
- actual.headers['ETag'].should be_a(String)
24
- actual.headers['Last-Modified'].should be_a(String)
25
- end
26
-
27
- it 'should return chunks with optional block' do
28
- data = ''
29
- Google[:storage].get_object('foggetobject', 'fog_get_object') do |chunk|
30
- data << chunk
31
- end
32
- data.should == lorem_file.read
33
- end
34
-
35
- it 'should return a url' do
36
- url = Google[:storage].get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10)
37
- unless Fog.mocking?
38
- open(url).read.should == lorem_file.read
39
- end
40
- end
41
-
42
- end
43
- describe 'failure' do
44
-
45
- it 'should raise a NotFound error if the bucket does not exist' do
46
- lambda {
47
- Google[:storage].get_object('fognotabucket', 'fog_get_object')
48
- }.should raise_error(Excon::Errors::NotFound)
49
- end
50
-
51
- it 'should raise a NotFound error if the object does not exist' do
52
- lambda {
53
- Google[:storage].get_object('foggetobject', 'fog_not_an_object')
54
- }.should raise_error(Excon::Errors::NotFound)
55
- end
56
-
57
- end
58
- end
@@ -1,32 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Storage.get_service' do
4
- describe 'success' do
5
-
6
- before(:all) do
7
- Google[:storage].put_bucket('foggetservice')
8
- Fog.wait_for { Google[:storage].directories.get('foggetservice') }
9
- end
10
-
11
- after(:all) do
12
- Google[:storage].delete_bucket('foggetservice')
13
- end
14
-
15
- it 'should return proper_attributes' do
16
- actual = Google[:storage].get_service
17
- actual.body['Buckets'].should be_an(Array)
18
- bucket = actual.body['Buckets'].select {|bucket| bucket['Name'] == 'foggetservice'}.first
19
- bucket['CreationDate'].should be_a(Time)
20
- bucket['Name'].should == 'foggetservice'
21
- owner = actual.body['Owner']
22
- owner['DisplayName'].should be_a(String)
23
- owner['ID'].should be_a(String)
24
- end
25
-
26
- it 'should include foggetservice in get_service' do
27
- actual = Google[:storage].get_service
28
- actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice')
29
- end
30
-
31
- end
32
- end