fog 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -9
- data/Rakefile +3 -2
- data/docs/_layouts/default.html +13 -13
- data/docs/about/contributing.markdown +1 -1
- data/docs/about/getting_started.markdown +28 -3
- data/docs/dns/index.markdown +4 -4
- data/docs/index.markdown +2 -10
- data/docs/public/css/fog.css +14 -1
- data/docs/storage/index.markdown +2 -2
- data/fog.gemspec +6 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +26 -1
- data/lib/fog/aws/auto_scaling.rb +3 -1
- data/lib/fog/aws/cloud_formation.rb +3 -0
- data/lib/fog/aws/cloud_watch.rb +17 -1
- data/lib/fog/aws/compute.rb +50 -18
- data/lib/fog/aws/elb.rb +4 -2
- data/lib/fog/aws/emr.rb +133 -0
- data/lib/fog/aws/models/cloud_watch/alarm.rb +12 -0
- data/lib/fog/aws/models/cloud_watch/alarm_data.rb +39 -0
- data/lib/fog/aws/models/cloud_watch/alarm_datum.rb +66 -0
- data/lib/fog/aws/models/cloud_watch/alarm_histories.rb +18 -0
- data/lib/fog/aws/models/cloud_watch/alarm_history.rb +16 -0
- data/lib/fog/aws/models/cloud_watch/alarms.rb +30 -0
- data/lib/fog/aws/models/compute/addresses.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +1 -1
- data/lib/fog/aws/models/compute/security_groups.rb +1 -1
- data/lib/fog/aws/models/compute/server.rb +4 -2
- data/lib/fog/aws/models/compute/servers.rb +1 -1
- data/lib/fog/aws/models/compute/snapshots.rb +1 -1
- data/lib/fog/aws/models/compute/spot_request.rb +21 -4
- data/lib/fog/aws/models/compute/spot_requests.rb +45 -1
- data/lib/fog/aws/models/compute/volumes.rb +1 -1
- data/lib/fog/aws/models/elb/load_balancer.rb +2 -0
- data/lib/fog/aws/models/storage/file.rb +1 -1
- data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
- data/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_watch/delete_alarms.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +40 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +73 -0
- data/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +71 -0
- data/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/get_metric_statistics.rb +1 -0
- data/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +26 -0
- data/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +26 -0
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
- data/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
- data/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
- data/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
- data/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
- data/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
- data/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
- data/lib/fog/aws/rds.rb +3 -1
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
- data/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
- data/lib/fog/aws/requests/cloud_watch/delete_alarms.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarm_history.rb +33 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +38 -0
- data/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +39 -0
- data/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb +30 -0
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +84 -0
- data/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb +31 -0
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
- data/lib/fog/aws/requests/compute/create_snapshot.rb +2 -3
- data/lib/fog/aws/requests/compute/create_tags.rb +5 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +0 -1
- data/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
- data/lib/fog/aws/requests/compute/delete_tags.rb +3 -4
- data/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
- data/lib/fog/aws/requests/compute/describe_images.rb +6 -9
- data/lib/fog/aws/requests/compute/describe_instances.rb +17 -8
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +7 -5
- data/lib/fog/aws/requests/compute/describe_volumes.rb +5 -4
- data/lib/fog/aws/requests/compute/modify_image_attribute.rb +32 -0
- data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
- data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +1 -1
- data/lib/fog/aws/requests/compute/register_image.rb +0 -1
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
- data/lib/fog/aws/requests/compute/run_instances.rb +1 -2
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/create_load_balancer_listeners.rb +1 -1
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +2 -2
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +2 -2
- data/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
- data/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
- data/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
- data/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
- data/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
- data/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
- data/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
- data/lib/fog/aws/requests/iam/get_server_certificate.rb +5 -7
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +1 -0
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/select.rb +1 -1
- data/lib/fog/aws/requests/storage/copy_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/hash_to_acl.rb +35 -25
- data/lib/fog/aws/ses.rb +1 -1
- data/lib/fog/aws/simpledb.rb +2 -0
- data/lib/fog/aws/sns.rb +3 -1
- data/lib/fog/aws/sqs.rb +4 -2
- data/lib/fog/aws/storage.rb +12 -3
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/bin/aws.rb +8 -4
- data/lib/fog/bin/bluebox.rb +2 -2
- data/lib/fog/bin/brightbox.rb +1 -1
- data/lib/fog/bin/dnsimple.rb +1 -1
- data/lib/fog/bin/dnsmadeeasy.rb +1 -1
- data/lib/fog/bin/ecloud.rb +1 -1
- data/lib/fog/bin/glesys.rb +1 -1
- data/lib/fog/bin/go_grid.rb +1 -1
- data/lib/fog/bin/google.rb +1 -1
- data/lib/fog/bin/libvirt.rb +1 -1
- data/lib/fog/bin/linode.rb +2 -2
- data/lib/fog/bin/local.rb +1 -1
- data/lib/fog/bin/new_servers.rb +1 -1
- data/lib/fog/bin/ninefold.rb +2 -2
- data/lib/fog/bin/openstack.rb +1 -1
- data/lib/fog/bin/rackspace.rb +3 -3
- data/lib/fog/bin/slicehost.rb +1 -1
- data/lib/fog/bin/stormondemand.rb +1 -1
- data/lib/fog/bin/virtual_box.rb +1 -1
- data/lib/fog/bin/vmfusion.rb +1 -1
- data/lib/fog/bin/voxel.rb +1 -1
- data/lib/fog/bin/zerigo.rb +1 -1
- data/lib/fog/brightbox/models/compute/account.rb +1 -1
- data/lib/fog/compute/models/server.rb +1 -2
- data/lib/fog/core/attributes.rb +5 -5
- data/lib/fog/core/connection.rb +1 -1
- data/lib/fog/core/deprecation.rb +2 -2
- data/lib/fog/core/logger.rb +8 -3
- data/lib/fog/core/mock.rb +4 -0
- data/lib/fog/core/provider.rb +7 -2
- data/lib/fog/core/service.rb +8 -2
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
- data/lib/fog/dynect/dns.rb +25 -3
- data/lib/fog/ecloud/compute.rb +2 -6
- data/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +1 -1
- data/lib/fog/google/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/google/storage.rb +1 -1
- data/lib/fog/libvirt/models/compute/uri.rb +7 -3
- data/lib/fog/linode/models/compute/server.rb +10 -0
- data/lib/fog/ninefold/models/storage/file.rb +8 -6
- data/lib/fog/ninefold/models/storage/files.rb +3 -2
- data/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
- data/lib/fog/ninefold/storage.rb +4 -2
- data/lib/fog/openstack.rb +4 -3
- data/lib/fog/openstack/compute.rb +8 -5
- data/lib/fog/openstack/models/compute/server.rb +10 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +6 -8
- data/lib/fog/rackspace/load_balancers.rb +1 -0
- data/lib/fog/rackspace/models/dns/callback.rb +1 -1
- data/lib/fog/rackspace/models/dns/record.rb +1 -1
- data/lib/fog/rackspace/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/dns.rb +1 -0
- data/lib/fog/slicehost/models/dns/record.rb +7 -3
- data/lib/fog/slicehost/models/dns/zone.rb +1 -1
- data/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
- data/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
- data/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
- data/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
- data/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
- data/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
- data/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
- data/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
- data/lib/fog/terremark/vcloud.rb +1 -1
- data/lib/fog/vsphere/compute.rb +40 -23
- data/lib/fog/vsphere/models/compute/server.rb +1 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +36 -4
- data/lib/fog/zerigo/dns.rb +14 -3
- data/lib/fog/zerigo/models/dns/record.rb +1 -1
- data/lib/fog/zerigo/models/dns/records.rb +5 -0
- data/lib/fog/zerigo/models/dns/zones.rb +2 -2
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/count_zones.rb +12 -1
- data/lib/fog/zerigo/requests/dns/create_host.rb +67 -1
- data/lib/fog/zerigo/requests/dns/create_zone.rb +44 -1
- data/lib/fog/zerigo/requests/dns/delete_host.rb +19 -0
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +17 -0
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +22 -1
- data/lib/fog/zerigo/requests/dns/get_host.rb +18 -1
- data/lib/fog/zerigo/requests/dns/get_zone.rb +19 -2
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +23 -0
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +20 -1
- data/lib/fog/zerigo/requests/dns/list_zones.rb +15 -0
- data/lib/fog/zerigo/requests/dns/update_host.rb +20 -1
- data/lib/fog/zerigo/requests/dns/update_zone.rb +20 -1
- data/tests/aws/models/cloud_watch/alarm_data_tests.rb +42 -0
- data/tests/aws/models/cloud_watch/alarm_history_tests.rb +22 -0
- data/tests/aws/models/compute/security_group_tests.rb +15 -10
- data/tests/aws/models/elb/model_tests.rb +4 -4
- data/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
- data/tests/aws/requests/cloud_watch/list_metrics_test.rb +5 -5
- data/tests/aws/requests/compute/image_tests.rb +33 -2
- data/tests/aws/requests/compute/instance_tests.rb +16 -1
- data/tests/aws/requests/compute/security_group_tests.rb +251 -32
- data/tests/aws/requests/compute/tag_tests.rb +42 -2
- data/tests/aws/requests/emr/helper.rb +172 -0
- data/tests/aws/requests/emr/instance_group_tests.rb +106 -0
- data/tests/aws/requests/emr/job_flow_tests.rb +88 -0
- data/tests/aws/requests/iam/server_certificate_tests.rb +20 -7
- data/tests/aws/requests/storage/bucket_tests.rb +82 -54
- data/tests/aws/requests/storage/hash_to_acl_tests.rb +173 -0
- data/tests/aws/requests/storage/object_tests.rb +44 -24
- data/tests/brightbox/requests/compute/helper.rb +15 -6
- data/tests/core/attribute_tests.rb +29 -0
- data/tests/core/mocking_tests.rb +60 -0
- data/tests/dns/models/record_tests.rb +4 -2
- data/tests/dns/models/records_tests.rb +4 -2
- data/tests/dns/models/zone_tests.rb +3 -1
- data/tests/dns/models/zones_tests.rb +4 -2
- data/tests/helper.rb +4 -0
- data/tests/rackspace/requests/dns/dns_tests.rb +16 -12
- data/tests/rackspace/requests/dns/records_tests.rb +13 -11
- data/tests/slicehost/requests/dns/dns_tests.rb +58 -11
- data/tests/vsphere/compute_tests.rb +18 -10
- data/tests/vsphere/requests/compute/vm_clone_tests.rb +1 -1
- metadata +214 -221
@@ -1,4 +1,5 @@
|
|
1
1
|
Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
2
|
+
@aws_bucket_name = 'fogbuckettests-' + Time.now.to_i.to_s(32)
|
2
3
|
|
3
4
|
tests('success') do
|
4
5
|
|
@@ -33,30 +34,31 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
33
34
|
}
|
34
35
|
}
|
35
36
|
|
36
|
-
tests("#put_bucket('
|
37
|
-
Fog::Storage[:aws].put_bucket(
|
37
|
+
tests("#put_bucket('#{@aws_bucket_name}')").succeeds do
|
38
|
+
Fog::Storage[:aws].put_bucket(@aws_bucket_name)
|
39
|
+
@aws_owner = Fog::Storage[:aws].get_bucket_acl(Fog::Storage[:aws].directories.first.key).body['Owner']
|
38
40
|
end
|
39
41
|
|
40
42
|
tests("#get_service").formats(@service_format) do
|
41
43
|
Fog::Storage[:aws].get_service.body
|
42
44
|
end
|
43
45
|
|
44
|
-
file = Fog::Storage[:aws].directories.get(
|
46
|
+
file = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'y', :key => 'x')
|
45
47
|
|
46
|
-
tests("#get_bucket('
|
47
|
-
Fog::Storage[:aws].get_bucket(
|
48
|
+
tests("#get_bucket('#{@aws_bucket_name}')").formats(@bucket_format) do
|
49
|
+
Fog::Storage[:aws].get_bucket(@aws_bucket_name).body
|
48
50
|
end
|
49
51
|
|
50
52
|
file.destroy
|
51
53
|
|
52
|
-
file1 = Fog::Storage[:aws].directories.get(
|
53
|
-
file2 = Fog::Storage[:aws].directories.get(
|
54
|
-
file3 = Fog::Storage[:aws].directories.get(
|
55
|
-
file4 = Fog::Storage[:aws].directories.get(
|
54
|
+
file1 = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'a', :key => 'a/a1/file1')
|
55
|
+
file2 = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'ab', :key => 'a/file2')
|
56
|
+
file3 = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'abc', :key => 'b/file3')
|
57
|
+
file4 = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'abcd', :key => 'file4')
|
56
58
|
|
57
|
-
tests("#get_bucket('
|
59
|
+
tests("#get_bucket('#{@aws_bucket_name}')") do
|
58
60
|
before do
|
59
|
-
@bucket = Fog::Storage[:aws].get_bucket(
|
61
|
+
@bucket = Fog::Storage[:aws].get_bucket(@aws_bucket_name)
|
60
62
|
end
|
61
63
|
|
62
64
|
tests(".body['Contents'].map{|n| n['Key']}").returns(["a/a1/file1", "a/file2", "b/file3", "file4"]) do
|
@@ -72,9 +74,9 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
|
-
tests("#get_bucket('
|
77
|
+
tests("#get_bucket('#{@aws_bucket_name}', 'delimiter' => '/')") do
|
76
78
|
before do
|
77
|
-
@bucket = Fog::Storage[:aws].get_bucket(
|
79
|
+
@bucket = Fog::Storage[:aws].get_bucket(@aws_bucket_name, 'delimiter' => '/')
|
78
80
|
end
|
79
81
|
|
80
82
|
tests(".body['Contents'].map{|n| n['Key']}").returns(['file4']) do
|
@@ -86,9 +88,9 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
89
|
-
tests("#get_bucket('
|
91
|
+
tests("#get_bucket('#{@aws_bucket_name}', 'delimiter' => '/', 'prefix' => 'a/')") do
|
90
92
|
before do
|
91
|
-
@bucket = Fog::Storage[:aws].get_bucket(
|
93
|
+
@bucket = Fog::Storage[:aws].get_bucket(@aws_bucket_name, 'delimiter' => '/', 'prefix' => 'a/')
|
92
94
|
end
|
93
95
|
|
94
96
|
tests(".body['Contents'].map{|n| n['Key']}").returns(['a/file2']) do
|
@@ -102,63 +104,87 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
|
102
104
|
|
103
105
|
file1.destroy; file2.destroy; file3.destroy; file4.destroy
|
104
106
|
|
105
|
-
tests("#get_bucket_location('
|
106
|
-
Fog::Storage[:aws].get_bucket_location(
|
107
|
+
tests("#get_bucket_location('#{@aws_bucket_name}')").formats('LocationConstraint' => NilClass) do
|
108
|
+
Fog::Storage[:aws].get_bucket_location(@aws_bucket_name).body
|
107
109
|
end
|
108
110
|
|
109
|
-
tests("#get_request_payment('
|
110
|
-
Fog::Storage[:aws].get_request_payment(
|
111
|
+
tests("#get_request_payment('#{@aws_bucket_name}')").formats('Payer' => String) do
|
112
|
+
Fog::Storage[:aws].get_request_payment(@aws_bucket_name).body
|
111
113
|
end
|
112
114
|
|
113
|
-
tests("#put_request_payment('
|
114
|
-
Fog::Storage[:aws].put_request_payment(
|
115
|
+
tests("#put_request_payment('#{@aws_bucket_name}', 'Requester')").succeeds do
|
116
|
+
Fog::Storage[:aws].put_request_payment(@aws_bucket_name, 'Requester')
|
115
117
|
end
|
116
118
|
|
117
|
-
tests("#put_bucket_website('
|
119
|
+
tests("#put_bucket_website('#{@aws_bucket_name}', 'index.html')").succeeds do
|
118
120
|
pending if Fog.mocking?
|
119
|
-
Fog::Storage[:aws].put_bucket_website(
|
121
|
+
Fog::Storage[:aws].put_bucket_website(@aws_bucket_name, 'index.html')
|
120
122
|
end
|
121
123
|
|
122
|
-
tests("#
|
123
|
-
|
124
|
-
Fog::Storage[:aws].delete_bucket_website('fogbuckettests')
|
124
|
+
tests("#put_bucket_acl('#{@aws_bucket_name}', 'private')").succeeds do
|
125
|
+
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, 'private')
|
125
126
|
end
|
126
127
|
|
127
|
-
|
128
|
-
|
129
|
-
|
128
|
+
acl = {
|
129
|
+
'Owner' => @aws_owner,
|
130
|
+
'AccessControlList' => [
|
131
|
+
{
|
132
|
+
'Grantee' => @aws_owner,
|
133
|
+
'Permission' => "FULL_CONTROL"
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
137
|
+
tests("#put_bucket_acl('#{@aws_bucket_name}', hash with id)").returns(acl) do
|
138
|
+
pending if Fog.mocking?
|
130
139
|
|
131
|
-
|
132
|
-
Fog::Storage[:aws].
|
140
|
+
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
|
141
|
+
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
|
133
142
|
end
|
134
143
|
|
135
|
-
tests("#put_bucket_acl('
|
136
|
-
|
137
|
-
'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
|
144
|
+
tests("#put_bucket_acl('#{@aws_bucket_name}', hash with email)").returns({
|
145
|
+
'Owner' => @aws_owner,
|
138
146
|
'AccessControlList' => [
|
139
|
-
{
|
140
|
-
'Grantee' => { 'ID' =>
|
141
|
-
'Permission' => "FULL_CONTROL"
|
147
|
+
{
|
148
|
+
'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' },
|
149
|
+
'Permission' => "FULL_CONTROL"
|
150
|
+
}
|
151
|
+
]
|
152
|
+
}) do
|
153
|
+
pending if Fog.mocking?
|
154
|
+
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, {
|
155
|
+
'Owner' => @aws_owner,
|
156
|
+
'AccessControlList' => [
|
157
|
+
{
|
158
|
+
'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' },
|
159
|
+
'Permission' => "FULL_CONTROL"
|
142
160
|
}
|
143
161
|
]
|
144
162
|
})
|
145
|
-
Fog::Storage[:aws].get_bucket_acl(
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
163
|
+
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
|
164
|
+
end
|
165
|
+
|
166
|
+
acl = {
|
167
|
+
'Owner' => @aws_owner,
|
168
|
+
'AccessControlList' => [
|
169
|
+
{
|
170
|
+
'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
|
171
|
+
'Permission' => "FULL_CONTROL"
|
172
|
+
}
|
173
|
+
]
|
174
|
+
}
|
175
|
+
tests("#put_bucket_acl('#{@aws_bucket_name}', hash with uri)").returns(acl) do
|
176
|
+
pending if Fog.mocking?
|
177
|
+
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
|
178
|
+
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
|
179
|
+
end
|
180
|
+
|
181
|
+
tests("#delete_bucket_website('#{@aws_bucket_name}')").succeeds do
|
182
|
+
pending if Fog.mocking?
|
183
|
+
Fog::Storage[:aws].delete_bucket_website(@aws_bucket_name)
|
184
|
+
end
|
185
|
+
|
186
|
+
tests("#delete_bucket('#{@aws_bucket_name}')").succeeds do
|
187
|
+
Fog::Storage[:aws].delete_bucket(@aws_bucket_name)
|
162
188
|
end
|
163
189
|
|
164
190
|
end
|
@@ -201,4 +227,6 @@ BODY
|
|
201
227
|
|
202
228
|
end
|
203
229
|
|
230
|
+
# don't keep the bucket around
|
231
|
+
Fog::Storage[:aws].delete_bucket(@aws_bucket_name) rescue nil
|
204
232
|
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'fog/aws/requests/storage/hash_to_acl'
|
2
|
+
|
3
|
+
Shindo.tests('Fog::Storage::AWS | converting a hash to an ACL', [:aws]) do
|
4
|
+
tests(".hash_to_acl") do
|
5
|
+
tests(".hash_to_acl({}) at xpath //AccessControlPolicy").returns("", "has an empty AccessControlPolicy") do
|
6
|
+
xml = Fog::Storage::AWS.hash_to_acl({})
|
7
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy").first.content.chomp
|
8
|
+
end
|
9
|
+
|
10
|
+
tests(".hash_to_acl({}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do
|
11
|
+
xml = Fog::Storage::AWS.hash_to_acl({})
|
12
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first
|
13
|
+
end
|
14
|
+
|
15
|
+
tests(".hash_to_acl('Owner' => {}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do
|
16
|
+
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {})
|
17
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first
|
18
|
+
end
|
19
|
+
|
20
|
+
tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/ID").returns("abcdef0123456789", "returns the Owner ID") do
|
21
|
+
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
|
22
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first.content
|
23
|
+
end
|
24
|
+
|
25
|
+
tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/ID").returns(nil, "does not have an Owner ID element") do
|
26
|
+
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
|
27
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first
|
28
|
+
end
|
29
|
+
|
30
|
+
tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns("bob", "returns the Owner DisplayName") do
|
31
|
+
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
|
32
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first.content
|
33
|
+
end
|
34
|
+
|
35
|
+
tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns(nil, "does not have an Owner DisplayName element") do
|
36
|
+
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
|
37
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first
|
38
|
+
end
|
39
|
+
|
40
|
+
tests(".hash_to_acl({}) at xpath //AccessControlPolicy/AccessControlList").returns(nil, "has no AccessControlList") do
|
41
|
+
xml = Fog::Storage::AWS.hash_to_acl({})
|
42
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlPolicy").first
|
43
|
+
end
|
44
|
+
|
45
|
+
acl = {
|
46
|
+
'AccessControlList' => [
|
47
|
+
{
|
48
|
+
'Grantee' => {
|
49
|
+
'ID' => 'abcdef0123456789',
|
50
|
+
'DisplayName' => 'bob'
|
51
|
+
},
|
52
|
+
'Permission' => 'READ'
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
|
57
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("CanonicalUser", "has an xsi:type of CanonicalUser") do
|
58
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
59
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
|
60
|
+
end
|
61
|
+
|
62
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the Grantee ID") do
|
63
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
64
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content
|
65
|
+
end
|
66
|
+
|
67
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").returns("bob", "returns the Grantee DisplayName") do
|
68
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
69
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").first.content
|
70
|
+
end
|
71
|
+
|
72
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("READ", "returns the Grantee Permission") do
|
73
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
74
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
|
75
|
+
end
|
76
|
+
|
77
|
+
acl = {
|
78
|
+
'AccessControlList' => [
|
79
|
+
{
|
80
|
+
'Grantee' => {
|
81
|
+
'EmailAddress' => 'user@example.com'
|
82
|
+
},
|
83
|
+
'Permission' => 'FULL_CONTROL'
|
84
|
+
}
|
85
|
+
]
|
86
|
+
}
|
87
|
+
|
88
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("AmazonCustomerByEmail", "has an xsi:type of AmazonCustomerByEmail") do
|
89
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
90
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
|
91
|
+
end
|
92
|
+
|
93
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the Grantee EmailAddress") do
|
94
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
95
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content
|
96
|
+
end
|
97
|
+
|
98
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("FULL_CONTROL", "returns the Grantee Permission") do
|
99
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
100
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
|
101
|
+
end
|
102
|
+
|
103
|
+
acl = {
|
104
|
+
'AccessControlList' => [
|
105
|
+
{
|
106
|
+
'Grantee' => {
|
107
|
+
'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers'
|
108
|
+
},
|
109
|
+
'Permission' => 'WRITE'
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}
|
113
|
+
|
114
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("Group", "has an xsi:type of Group") do
|
115
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
116
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
|
117
|
+
end
|
118
|
+
|
119
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the Grantee URI") do
|
120
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
121
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content
|
122
|
+
end
|
123
|
+
|
124
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("WRITE", "returns the Grantee Permission") do
|
125
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
126
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
|
127
|
+
end
|
128
|
+
|
129
|
+
acl = {
|
130
|
+
'AccessControlList' => [
|
131
|
+
{
|
132
|
+
'Grantee' => {
|
133
|
+
'ID' => 'abcdef0123456789',
|
134
|
+
'DisplayName' => 'bob'
|
135
|
+
},
|
136
|
+
'Permission' => 'READ'
|
137
|
+
},
|
138
|
+
{
|
139
|
+
'Grantee' => {
|
140
|
+
'EmailAddress' => 'user@example.com'
|
141
|
+
},
|
142
|
+
'Permission' => 'FULL_CONTROL'
|
143
|
+
},
|
144
|
+
{
|
145
|
+
'Grantee' => {
|
146
|
+
'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers'
|
147
|
+
},
|
148
|
+
'Permission' => 'WRITE'
|
149
|
+
}
|
150
|
+
]
|
151
|
+
}
|
152
|
+
|
153
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant").returns(3, "has three elements") do
|
154
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
155
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant").size
|
156
|
+
end
|
157
|
+
|
158
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the first Grant's Grantee ID") do
|
159
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
160
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content
|
161
|
+
end
|
162
|
+
|
163
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the second Grant's Grantee EmailAddress") do
|
164
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
165
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content
|
166
|
+
end
|
167
|
+
|
168
|
+
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the third Grant's Grantee URI") do
|
169
|
+
xml = Fog::Storage::AWS.hash_to_acl(acl)
|
170
|
+
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
2
|
-
|
3
|
-
@
|
2
|
+
@directory = Fog::Storage[:aws].directories.create(:key => 'fogobjecttests-' + Time.now.to_i.to_s(32))
|
3
|
+
@aws_owner = Fog::Storage[:aws].get_bucket_acl(@directory.key).body['Owner']
|
4
4
|
|
5
5
|
tests('success') do
|
6
6
|
|
@@ -34,32 +34,52 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
|
34
34
|
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', 'private')
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
acl = {
|
38
|
+
'Owner' => @aws_owner,
|
39
|
+
'AccessControlList' => [
|
40
|
+
{
|
41
|
+
'Grantee' => @aws_owner,
|
42
|
+
'Permission' => "FULL_CONTROL"
|
43
|
+
}
|
44
|
+
]}
|
45
|
+
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(acl) do
|
46
|
+
pending if Fog.mocking?
|
47
|
+
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
|
48
|
+
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
49
|
+
end
|
50
|
+
|
51
|
+
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with email)").returns({
|
52
|
+
'Owner' => @aws_owner,
|
53
|
+
'AccessControlList' => [
|
54
|
+
{
|
55
|
+
'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' },
|
56
|
+
'Permission' => "FULL_CONTROL"
|
57
|
+
}
|
58
|
+
]}) do
|
59
|
+
pending if Fog.mocking?
|
38
60
|
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', {
|
39
|
-
'Owner' =>
|
61
|
+
'Owner' => @aws_owner,
|
40
62
|
'AccessControlList' => [
|
41
|
-
{
|
42
|
-
'Grantee' => { '
|
43
|
-
'Permission' => "FULL_CONTROL"
|
63
|
+
{
|
64
|
+
'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' },
|
65
|
+
'Permission' => "FULL_CONTROL"
|
44
66
|
}
|
45
67
|
]})
|
46
|
-
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
</AccessControlPolicy>
|
62
|
-
BODY
|
68
|
+
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
69
|
+
end
|
70
|
+
|
71
|
+
acl = {
|
72
|
+
'Owner' => @aws_owner,
|
73
|
+
'AccessControlList' => [
|
74
|
+
{
|
75
|
+
'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
|
76
|
+
'Permission' => "FULL_CONTROL"
|
77
|
+
}
|
78
|
+
]}
|
79
|
+
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(acl) do
|
80
|
+
pending if Fog.mocking?
|
81
|
+
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
|
82
|
+
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
|
63
83
|
end
|
64
84
|
|
65
85
|
tests("#delete_object('#{@directory.identity}', 'fog_object')").succeeds do
|