fog 0.4.1 → 0.5.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.
Files changed (59) hide show
  1. data/Gemfile.lock +3 -6
  2. data/fog.gemspec +3 -3
  3. data/lib/fog.rb +1 -1
  4. data/lib/fog/aws/parsers/ses/delete_verified_email_address.rb +24 -0
  5. data/lib/fog/aws/parsers/ses/get_send_quota.rb +26 -0
  6. data/lib/fog/aws/parsers/ses/get_send_statistics.rb +29 -0
  7. data/lib/fog/aws/parsers/ses/list_verified_email_addresses.rb +25 -0
  8. data/lib/fog/aws/parsers/ses/send_email.rb +26 -0
  9. data/lib/fog/aws/parsers/ses/send_raw_email.rb +26 -0
  10. data/lib/fog/aws/parsers/ses/verify_email_address.rb +24 -0
  11. data/lib/fog/aws/requests/elb/create_load_balancer.rb +1 -1
  12. data/lib/fog/aws/requests/ses/delete_verified_email_address.rb +37 -0
  13. data/lib/fog/aws/requests/ses/get_send_quota.rb +40 -0
  14. data/lib/fog/aws/requests/ses/get_send_statistics.rb +43 -0
  15. data/lib/fog/aws/requests/ses/list_verified_email_addresses.rb +37 -0
  16. data/lib/fog/aws/requests/ses/send_email.rb +82 -0
  17. data/lib/fog/aws/requests/ses/send_raw_email.rb +50 -0
  18. data/lib/fog/aws/requests/ses/verify_email_address.rb +37 -0
  19. data/lib/fog/aws/ses.rb +106 -0
  20. data/lib/fog/bin/aws.rb +5 -1
  21. data/lib/fog/cdn.rb +1 -1
  22. data/lib/fog/compute/aws.rb +1 -0
  23. data/lib/fog/compute/models/aws/server.rb +5 -2
  24. data/lib/fog/compute/models/bluebox/server.rb +5 -2
  25. data/lib/fog/compute/models/go_grid/images.rb +1 -1
  26. data/lib/fog/compute/models/go_grid/server.rb +55 -8
  27. data/lib/fog/compute/models/go_grid/servers.rb +2 -2
  28. data/lib/fog/compute/models/rackspace/server.rb +5 -2
  29. data/lib/fog/compute/models/slicehost/server.rb +5 -2
  30. data/lib/fog/compute/parsers/aws/describe_reserved_instances_offerings.rb +34 -0
  31. data/lib/fog/compute/rackspace.rb +28 -7
  32. data/lib/fog/compute/requests/aws/describe_images.rb +48 -1
  33. data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +45 -0
  34. data/lib/fog/compute/requests/go_grid/grid_server_add.rb +2 -2
  35. data/lib/fog/core/ssh.rb +7 -3
  36. data/lib/fog/dns.rb +1 -1
  37. data/lib/fog/dns/requests/aws/create_hosted_zone.rb +8 -8
  38. data/lib/fog/providers/aws.rb +1 -0
  39. data/lib/fog/storage/aws.rb +49 -30
  40. data/lib/fog/storage/google.rb +48 -29
  41. data/lib/fog/storage/local.rb +2 -0
  42. data/lib/fog/storage/models/aws/file.rb +1 -1
  43. data/lib/fog/storage/models/google/file.rb +1 -1
  44. data/lib/fog/storage/models/local/file.rb +9 -1
  45. data/lib/fog/storage/requests/aws/put_bucket.rb +6 -6
  46. data/lib/fog/storage/requests/aws/put_object.rb +7 -7
  47. data/lib/fog/storage/requests/google/put_bucket.rb +5 -6
  48. data/lib/fog/storage/requests/google/put_object.rb +7 -7
  49. data/lib/fog/storage/requests/rackspace/get_container.rb +1 -0
  50. data/lib/fog/storage/requests/rackspace/get_containers.rb +1 -0
  51. data/tests/aws/requests/ses/helper.rb +15 -0
  52. data/tests/aws/requests/ses/verified_email_address_tests.rb +27 -0
  53. data/tests/compute/requests/terremark_ecloud/catalog_tests.rb +1 -1
  54. data/tests/compute/requests/terremark_ecloud/network_tests.rb +1 -1
  55. data/tests/compute/requests/terremark_ecloud/organization_tests.rb +1 -1
  56. data/tests/compute/requests/terremark_ecloud/vdc_tests.rb +1 -1
  57. data/tests/helper.rb +4 -36
  58. data/tests/helpers/mock_helper.rb +33 -0
  59. metadata +32 -9
@@ -100,13 +100,10 @@ module Fog
100
100
  end
101
101
 
102
102
  require 'json'
103
- credentials = Fog::Rackspace.authenticate(options)
104
- @auth_token = credentials['X-Auth-Token']
105
- uri = URI.parse(credentials['X-Server-Management-Url'])
106
- @host = uri.host
107
- @path = uri.path
108
- @port = uri.port
109
- @scheme = uri.scheme
103
+ @rackspace_api_key = options[:rackspace_api_key]
104
+ @rackspace_username = options[:rackspace_username]
105
+ @rackspace_auth_url = options[:rackspace_auth_url]
106
+ authenticate
110
107
  @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
111
108
  end
112
109
 
@@ -124,6 +121,13 @@ module Fog
124
121
  :host => @host,
125
122
  :path => "#{@path}/#{params[:path]}"
126
123
  }))
124
+ rescue Excon::Errors::Unauthorized => error
125
+ if JSON.parse(response.body)['unauthorized']['message'] == 'Invalid authentication token. Please renew.'
126
+ authenticate
127
+ retry
128
+ else
129
+ raise error
130
+ end
127
131
  rescue Excon::Errors::HTTPStatusError => error
128
132
  raise case error
129
133
  when Excon::Errors::NotFound
@@ -138,6 +142,23 @@ module Fog
138
142
  response
139
143
  end
140
144
 
145
+ private
146
+
147
+ def authenticate
148
+ options = {
149
+ :rackspace_api_key => @rackspace_api_key,
150
+ :rackspace_username => @rackspace_username,
151
+ :rackspace_auth_url => @rackspace_auth_url
152
+ }
153
+ credentials = Fog::Rackspace.authenticate(options)
154
+ @auth_token = credentials['X-Auth-Token']
155
+ uri = URI.parse(credentials['X-Server-Management-Url'])
156
+ @host = uri.host
157
+ @path = uri.path
158
+ @port = uri.port
159
+ @scheme = uri.scheme
160
+ end
161
+
141
162
  end
142
163
  end
143
164
  end
@@ -56,7 +56,54 @@ module Fog
56
56
  class Mock
57
57
 
58
58
  def describe_images(filters = {})
59
- Fog::Mock.not_implemented
59
+ unless filters.is_a?(Hash)
60
+ Formatador.display_line("[yellow][WARN] describe_images with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead[/] [light_black](#{caller.first})[/]")
61
+ filters = {'snapshot-id' => [*filters]}
62
+ end
63
+
64
+ if filters.keys.any? {|key| key =~ /^block-device/}
65
+ Formatador.display_line("[yellow][WARN] describe_images block-device-mapping filters are not yet mocked[/] [light_black](#{caller.first})[/]")
66
+ Fog::Mock.not_implemented
67
+ end
68
+
69
+ if filters.keys.any? {|key| key =~ /^tag/}
70
+ Formatador.display_line("[yellow][WARN] describe_images tag filters are not yet mocked[/] [light_black](#{caller.first})[/]")
71
+ Fog::Mock.not_implemented
72
+ end
73
+
74
+ response = Excon::Response.new
75
+
76
+ aliases = {
77
+ 'architecture' => 'architecture',
78
+ 'description' => 'description',
79
+ 'hypervisor' => 'hypervisor',
80
+ 'image-id' => 'imageId',
81
+ 'image-type' => 'imageType',
82
+ 'is-public' => 'isPublic',
83
+ 'kernel-id' => 'kernelId',
84
+ 'manifest-location' => 'manifestLocation',
85
+ 'name' => 'name',
86
+ 'owner-id' => 'imageOwnerId',
87
+ 'ramdisk-id' => 'ramdiskId',
88
+ 'root-device-name' => 'rootDeviceName',
89
+ 'root-device-type' => 'rootDeviceType',
90
+ 'state' => 'imageState',
91
+ 'virtualization-type' => 'virtualizationType'
92
+ }
93
+
94
+ image_set = @data[:images].values
95
+
96
+ for filter_key, filter_value in filters
97
+ aliased_key = aliases[filter_key]
98
+ image_set = image_set.reject{|image| ![*filter_value].include?(image[aliased_key])}
99
+ end
100
+
101
+ response.status = 200
102
+ response.body = {
103
+ 'requestId' => Fog::AWS::Mock.request_id,
104
+ 'imagesSet' => image_set
105
+ }
106
+ response
60
107
  end
61
108
 
62
109
  end
@@ -0,0 +1,45 @@
1
+ module Fog
2
+ module AWS
3
+ class Compute
4
+ class Real
5
+
6
+ require 'fog/compute/parsers/aws/describe_reserved_instances_offerings'
7
+
8
+ # Describe all or specified reserved instances offerings
9
+ #
10
+ # ==== Parameters
11
+ # * filters<~Hash> - List of filters to limit results with
12
+ #
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'requestId'<~String> - Id of request
17
+ # * 'reservedInstancesOfferingsSet'<~Array>:
18
+ # * 'availabilityZone'<~String> - availability zone of offering
19
+ # * 'duration'<~Integer> - duration, in seconds, of offering
20
+ # * 'fixedPrice'<~Float> - purchase price of offering
21
+ # * 'instanceType'<~String> - instance type of offering
22
+ # * 'productDescription'<~String> - description of offering
23
+ # * 'reservedInstancesOfferingId'<~String> - id of offering
24
+ # * 'usagePrice'<~Float> - usage price of offering, per hour
25
+ def describe_reserved_instances_offerings(filters = {})
26
+ params = AWS.indexed_filters(filters)
27
+ request({
28
+ 'Action' => 'DescribeReservedInstancesOfferings',
29
+ :idempotent => true,
30
+ :parser => Fog::Parsers::AWS::Compute::DescribeReservedInstancesOfferings.new
31
+ }.merge!(params))
32
+ end
33
+
34
+ end
35
+
36
+ class Mock
37
+
38
+ def describe_reserved_instances_offerings(filters = {})
39
+ Fog::Mock.not_implemented
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
@@ -6,11 +6,11 @@ module Fog
6
6
  # Create a new server
7
7
  #
8
8
  # ==== Parameters
9
+ # * 'name'<~String> - name of the server, 20 or fewer characters
9
10
  # * 'image'<~String> - image to use, in grid_image_list
10
11
  # * 'ip'<~String> - initial public ip for this server
11
- # * 'name'<~String> - name of the server, 20 or fewer characters
12
- # * 'server_ram'<~String> - flavor to use, in common_lookup_list('server.ram')
13
12
  # * 'options'<~Hash>:
13
+ # * 'server.ram'<~String> - flavor to use, in common_lookup_list('server.ram')
14
14
  # * 'description'<~String> - description of this server
15
15
  # * 'isSandbox'<~String> - treat this server as image sandbox? in ['true', 'false']
16
16
  #
@@ -2,9 +2,6 @@ module Fog
2
2
  module SSH
3
3
 
4
4
  def self.new(address, username, options = {})
5
- unless options[:key_data] || options[:keys] || options[:password]
6
- raise ArgumentError.new(':key_data, :keys or :password are required to initialize SSH')
7
- end
8
5
  if Fog.mocking?
9
6
  Fog::SSH::Mock.new(address, username, options)
10
7
  else
@@ -40,6 +37,13 @@ module Fog
40
37
 
41
38
  def initialize(address, username, options)
42
39
  require 'net/ssh'
40
+
41
+ key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)
42
+
43
+ unless options[:key_data] || options[:keys] || options[:password] || key_manager.agent
44
+ raise ArgumentError.new(':key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH')
45
+ end
46
+
43
47
  @address = address
44
48
  @username = username
45
49
  @options = { :paranoid => false }.merge(options)
@@ -17,7 +17,7 @@ module Fog
17
17
  require 'fog/dns/zerigo'
18
18
  Fog::Zerigo::DNS.new(attributes)
19
19
  else
20
- raise ArgumentError.new("#{provider} is not a recognized storage provider")
20
+ raise ArgumentError.new("#{provider} is not a recognized dns provider")
21
21
  end
22
22
  end
23
23
 
@@ -10,18 +10,18 @@ module Fog
10
10
  # ==== Parameters
11
11
  # * name<~String> - The name of the domain. Must be a fully-specified domain that ends with a period
12
12
  # * options<~Hash>
13
- # * caller_ref<~String> - unique string that identifies the request & allows failed
13
+ # * caller_ref<~String> - unique string that identifies the request & allows failed
14
14
  # calls to be retried without the risk of executing the operation twice
15
- # * comment<~Integer> -
15
+ # * comment<~Integer> -
16
16
  #
17
17
  # ==== Returns
18
18
  # * response<~Excon::Response>:
19
19
  # * body<~Hash>:
20
20
  # * 'HostedZone'<~Hash>:
21
- # * 'Id'<~String> -
22
- # * 'Name'<~String> -
21
+ # * 'Id'<~String> -
22
+ # * 'Name'<~String> -
23
23
  # * 'CallerReference'<~String>
24
- # * 'Comment'<~String> -
24
+ # * 'Comment'<~String> -
25
25
  # * 'ChangeInfo'<~Hash> -
26
26
  # * 'Id'<~String>
27
27
  # * 'Status'<~String>
@@ -33,16 +33,16 @@ module Fog
33
33
 
34
34
  optional_tags = ''
35
35
  if options[:caller_ref]
36
- optional_tags+= "<CallerReference>#{options[:call_ref]}</CallerReference>"
36
+ optional_tags+= "<CallerReference>#{options[:caller_ref]}</CallerReference>"
37
37
  else
38
38
  #make sure we have a unique call reference
39
39
  caller_ref = "ref-#{rand(1000000).to_s}"
40
- optional_tags+= "<CallerReference>#{caller_ref}</CallerReference>"
40
+ optional_tags+= "<CallerReference>#{caller_ref}</CallerReference>"
41
41
  end
42
42
  if options[:comment]
43
43
  optional_tags+= "<HostedZoneConfig><Comment>#{options[:comment]}</Comment></HostedZoneConfig>"
44
44
  end
45
-
45
+
46
46
  request({
47
47
  :body => %Q{<?xml version="1.0" encoding="UTF-8"?><CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2010-10-01/"><Name>#{name}</Name>#{optional_tags}</CreateHostedZoneRequest>},
48
48
  :parser => Fog::Parsers::AWS::DNS::CreateHostedZone.new,
@@ -15,6 +15,7 @@ module Fog
15
15
  service(:elb, 'aws/elb')
16
16
  service(:iam, 'aws/iam')
17
17
  service(:s3, 'storage/aws')
18
+ service(:ses, 'aws/ses')
18
19
  service(:simpledb, 'aws/simpledb')
19
20
  service(:storage, 'storage/aws')
20
21
 
@@ -21,7 +21,7 @@ module Fog
21
21
  requires :aws_access_key_id, :aws_secret_access_key
22
22
  recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
23
23
  recognizes :provider # remove post deprecation
24
-
24
+
25
25
  model_path 'fog/storage/models/aws'
26
26
  collection :directories
27
27
  model :directory
@@ -79,14 +79,14 @@ module Fog
79
79
 
80
80
  if data.is_a?(String)
81
81
  metadata[:body] = data
82
- metadata[:headers]['Content-Length'] = metadata[:body].size.to_s
82
+ metadata[:headers]['Content-Length'] = metadata[:body].size
83
83
  else
84
84
  filename = ::File.basename(data.path)
85
85
  unless (mime_types = MIME::Types.of(filename)).empty?
86
86
  metadata[:headers]['Content-Type'] = mime_types.first.content_type
87
87
  end
88
88
  metadata[:body] = data
89
- metadata[:headers]['Content-Length'] = ::File.size(data.path).to_s
89
+ metadata[:headers]['Content-Length'] = ::File.size(data.path)
90
90
  end
91
91
  # metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
92
92
  metadata
@@ -94,13 +94,13 @@ module Fog
94
94
 
95
95
  def url(params, expires)
96
96
  params[:headers]['Date'] = expires.to_i
97
+ params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
97
98
  query = [params[:query]].compact
98
99
  query << "AWSAccessKeyId=#{@aws_access_key_id}"
99
100
  query << "Signature=#{CGI.escape(signature(params))}"
100
101
  query << "Expires=#{params[:headers]['Date']}"
101
102
  bucket = params[:host].split('.').first
102
- path = CGI.escape(params[:path]).gsub('%2F', '/')
103
- "https://#{@host}/#{path}?#{query.join('&')}"
103
+ "https://#{@host}/#{params[:path]}?#{query.join('&')}"
104
104
  end
105
105
 
106
106
  end
@@ -111,7 +111,7 @@ module Fog
111
111
  def self.acls(type)
112
112
  case type
113
113
  when 'private'
114
- @private ||= {
114
+ {
115
115
  "AccessControlList" => [
116
116
  {
117
117
  "Permission" => "FULL_CONTROL",
@@ -121,32 +121,51 @@ module Fog
121
121
  "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
122
122
  }
123
123
  when 'public-read'
124
- @public_read ||= begin
125
- public_read = self.acls('private').dup
126
- public_read['AccessControlList'] << {
127
- "Permission" => "READ",
128
- "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
129
- }
130
- public_read
131
- end
124
+ {
125
+ "AccessControlList" => [
126
+ {
127
+ "Permission" => "FULL_CONTROL",
128
+ "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
129
+ },
130
+ {
131
+ "Permission" => "READ",
132
+ "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
133
+ }
134
+ ],
135
+ "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
136
+ }
132
137
  when 'public-read-write'
133
- @public_read_write ||= begin
134
- public_read_write = self.acls('public-read').dup
135
- public_read_write['AccessControlList'] << {
136
- "Permission" => "WRITE",
137
- "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
138
- }
139
- public_read_write
140
- end
138
+ {
139
+ "AccessControlList" => [
140
+ {
141
+ "Permission" => "FULL_CONTROL",
142
+ "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
143
+ },
144
+ {
145
+ "Permission" => "READ",
146
+ "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
147
+ },
148
+ {
149
+ "Permission" => "WRITE",
150
+ "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"}
151
+ }
152
+ ],
153
+ "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
154
+ }
141
155
  when 'authenticated-read'
142
- @authenticated_read ||= begin
143
- authenticated_read = self.acls('private').dup
144
- authenticated_read['AccessControlList'] << {
145
- "Permission" => "READ",
146
- "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"}
147
- }
148
- authenticated_read
149
- end
156
+ {
157
+ "AccessControlList" => [
158
+ {
159
+ "Permission" => "FULL_CONTROL",
160
+ "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
161
+ },
162
+ {
163
+ "Permission" => "READ",
164
+ "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"}
165
+ }
166
+ ],
167
+ "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
168
+ }
150
169
  end
151
170
  end
152
171
 
@@ -39,14 +39,14 @@ module Fog
39
39
 
40
40
  if data.is_a?(String)
41
41
  metadata[:body] = data
42
- metadata[:headers]['Content-Length'] = metadata[:body].size.to_s
42
+ metadata[:headers]['Content-Length'] = metadata[:body].size
43
43
  else
44
44
  filename = ::File.basename(data.path)
45
45
  unless (mime_types = MIME::Types.of(filename)).empty?
46
46
  metadata[:headers]['Content-Type'] = mime_types.first.content_type
47
47
  end
48
48
  metadata[:body] = data
49
- metadata[:headers]['Content-Length'] = ::File.size(data.path).to_s
49
+ metadata[:headers]['Content-Length'] = ::File.size(data.path)
50
50
  end
51
51
  # metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
52
52
  metadata
@@ -54,12 +54,12 @@ module Fog
54
54
 
55
55
  def url(params, expires)
56
56
  params[:headers]['Date'] = expires.to_i
57
+ params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
57
58
  query = [params[:query]].compact
58
59
  query << "GoogleAccessKeyId=#{@google_storage_access_key_id}"
59
60
  query << "Signature=#{CGI.escape(signature(params))}"
60
61
  query << "Expires=#{params[:headers]['Date']}"
61
- path = CGI.escape(params[:path]).gsub('%2F', '/')
62
- "http://#{params[:host]}/#{path}?#{query.join('&')}"
62
+ "http://#{params[:host]}/#{params[:path]}?#{query.join('&')}"
63
63
  end
64
64
 
65
65
  end
@@ -70,7 +70,7 @@ module Fog
70
70
  def self.acls(type)
71
71
  case type
72
72
  when 'private'
73
- @private ||= {
73
+ {
74
74
  "AccessControlList"=> [
75
75
  {
76
76
  "Permission" => "FULL_CONTROL",
@@ -80,32 +80,51 @@ module Fog
80
80
  "Owner" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
81
81
  }
82
82
  when 'public-read'
83
- @public_read ||= begin
84
- public_read = self.acls('private').dup
85
- public_read['AccessControlList'] << {
86
- "Permission" => "READ",
87
- "Scope" => {"type" => "AllUsers"}
88
- }
89
- public_read
90
- end
83
+ {
84
+ "AccessControlList"=> [
85
+ {
86
+ "Permission" => "FULL_CONTROL",
87
+ "Scope" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0", "type" => "UserById"}
88
+ },
89
+ {
90
+ "Permission" => "READ",
91
+ "Scope" => {"type" => "AllUsers"}
92
+ }
93
+ ],
94
+ "Owner" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
95
+ }
91
96
  when 'public-read-write'
92
- @public_read_write ||= begin
93
- public_read_write = self.acls('private').dup
94
- public_read_write['AccessControlList'] << {
95
- "Permission" => "WRITE",
96
- "Scope" => {"type" => "AllUsers"}
97
- }
98
- public_read_write
99
- end
97
+ {
98
+ "AccessControlList"=> [
99
+ {
100
+ "Permission" => "FULL_CONTROL",
101
+ "Scope" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0", "type" => "UserById"}
102
+ },
103
+ {
104
+ "Permission" => "READ",
105
+ "Scope" => {"type" => "AllUsers"}
106
+ },
107
+ {
108
+ "Permission" => "WRITE",
109
+ "Scope" => {"type" => "AllUsers"}
110
+ }
111
+ ],
112
+ "Owner" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
113
+ }
100
114
  when 'authenticated-read'
101
- @authenticated_read ||= begin
102
- authenticated_read = self.acls('private').dup
103
- authenticated_read['AccessControlList'] << {
104
- "Permission" => "READ",
105
- "Scope" => {"type" => "AllAuthenticatedUsers"}
106
- }
107
- authenticated_read
108
- end
115
+ {
116
+ "AccessControlList"=> [
117
+ {
118
+ "Permission" => "FULL_CONTROL",
119
+ "Scope" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0", "type" => "UserById"}
120
+ },
121
+ {
122
+ "Permission" => "READ",
123
+ "Scope" => {"type" => "AllAuthenticatedUsers"}
124
+ }
125
+ ],
126
+ "Owner" => {"ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"}
127
+ }
109
128
  end
110
129
  end
111
130