aws-sdk 1.5.7 → 1.5.8
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.
- data/lib/aws.rb +2 -0
- data/lib/aws/api_config/EMR-2009-03-31.yml +349 -0
- data/lib/aws/auto_scaling.rb +8 -8
- data/lib/aws/auto_scaling/group.rb +2 -2
- data/lib/aws/auto_scaling/instance.rb +1 -1
- data/lib/aws/auto_scaling/launch_configuration.rb +4 -4
- data/lib/aws/auto_scaling/launch_configuration_collection.rb +11 -11
- data/lib/aws/auto_scaling/scaling_policy.rb +1 -1
- data/lib/aws/auto_scaling/scheduled_action.rb +1 -1
- data/lib/aws/auto_scaling/tag.rb +3 -3
- data/lib/aws/cloud_formation/stack.rb +7 -7
- data/lib/aws/cloud_formation/stack_collection.rb +13 -13
- data/lib/aws/cloud_formation/stack_event_collection.rb +2 -2
- data/lib/aws/cloud_formation/stack_resource.rb +1 -1
- data/lib/aws/cloud_formation/stack_resource_summary_collection.rb +10 -18
- data/lib/aws/cloud_formation/stack_summary_collection.rb +12 -16
- data/lib/aws/core.rb +7 -1
- data/lib/aws/core/collection.rb +12 -12
- data/lib/aws/core/configuration.rb +4 -0
- data/lib/aws/core/credential_providers.rb +23 -23
- data/lib/aws/core/inflection.rb +2 -0
- data/lib/aws/core/model.rb +6 -6
- data/lib/aws/core/policy.rb +102 -102
- data/lib/aws/core/resource.rb +81 -80
- data/lib/aws/core/response.rb +23 -23
- data/lib/aws/core/xml/frame.rb +4 -2
- data/lib/aws/dynamo_db/resource.rb +2 -2
- data/lib/aws/dynamo_db/table.rb +5 -5
- data/lib/aws/ec2/availability_zone.rb +2 -3
- data/lib/aws/ec2/export_task.rb +7 -7
- data/lib/aws/ec2/image.rb +5 -5
- data/lib/aws/ec2/instance.rb +40 -40
- data/lib/aws/ec2/instance_collection.rb +5 -2
- data/lib/aws/ec2/key_pair.rb +1 -1
- data/lib/aws/ec2/network_acl.rb +1 -1
- data/lib/aws/ec2/network_interface.rb +2 -2
- data/lib/aws/ec2/region.rb +1 -1
- data/lib/aws/ec2/resource.rb +1 -1
- data/lib/aws/ec2/route_table.rb +1 -1
- data/lib/aws/ec2/security_group.rb +4 -4
- data/lib/aws/ec2/subnet.rb +1 -1
- data/lib/aws/ec2/volume.rb +1 -1
- data/lib/aws/ec2/vpn_connection.rb +1 -1
- data/lib/aws/ec2/vpn_gateway.rb +2 -2
- data/lib/aws/elb/listener_opts.rb +1 -1
- data/lib/aws/elb/load_balancer.rb +5 -5
- data/lib/aws/elb/load_balancer_collection.rb +17 -9
- data/lib/aws/elb/load_balancer_policy.rb +2 -2
- data/lib/aws/emr.rb +84 -0
- data/lib/aws/emr/client.rb +309 -0
- data/lib/aws/emr/config.rb +18 -0
- data/lib/aws/emr/errors.rb +22 -0
- data/lib/aws/emr/instance_group.rb +138 -0
- data/lib/aws/emr/instance_group_collection.rb +82 -0
- data/lib/aws/emr/job_flow.rb +296 -0
- data/lib/aws/emr/job_flow_collection.rb +185 -0
- data/lib/aws/emr/request.rb +23 -0
- data/lib/aws/iam/access_key.rb +1 -1
- data/lib/aws/iam/account_alias_collection.rb +2 -2
- data/lib/aws/iam/client.rb +1 -1
- data/lib/aws/iam/group.rb +2 -2
- data/lib/aws/iam/policy_collection.rb +1 -1
- data/lib/aws/iam/server_certificate.rb +2 -2
- data/lib/aws/iam/signing_certificate.rb +1 -1
- data/lib/aws/iam/user.rb +2 -2
- data/lib/aws/iam/virtual_mfa_device.rb +1 -1
- data/lib/aws/s3/client.rb +57 -55
- data/lib/aws/s3/config.rb +2 -0
- data/lib/aws/s3/request.rb +14 -6
- data/lib/aws/simple_email_service/identity.rb +9 -7
- data/lib/aws/simple_workflow/domain.rb +1 -1
- data/lib/aws/simple_workflow/resource.rb +2 -2
- data/lib/aws/simple_workflow/workflow_execution.rb +5 -5
- data/lib/aws/sns/subscription_collection.rb +33 -35
- data/lib/aws/sns/topic_collection.rb +13 -18
- data/lib/aws/sns/topic_subscription_collection.rb +8 -9
- data/lib/aws/sqs/queue.rb +4 -4
- data/lib/aws/sqs/queue_collection.rb +17 -13
- metadata +13 -4
- data/lib/aws/cloud_formation/stack_summary.rb +0 -71
@@ -0,0 +1,185 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
require 'date'
|
15
|
+
require 'time'
|
16
|
+
|
17
|
+
module AWS
|
18
|
+
class EMR
|
19
|
+
|
20
|
+
# = Creating a Job Flow
|
21
|
+
#
|
22
|
+
# Call {#create} to run a new job flow.
|
23
|
+
#
|
24
|
+
# emr = AWS::EMR.new
|
25
|
+
#
|
26
|
+
# job_flow = emr.job_flows.create('name',
|
27
|
+
# :instances => {
|
28
|
+
# :instance_count => 2,
|
29
|
+
# :master_instance_type => 'm1.small',
|
30
|
+
# :slave_instance_type => 'm1.small',
|
31
|
+
# }
|
32
|
+
# )
|
33
|
+
#
|
34
|
+
# = Getting a Job Flow
|
35
|
+
#
|
36
|
+
# You can get a job flow by its ID.
|
37
|
+
#
|
38
|
+
# job_flow = emr.job_flows['j-123456678'] # makes no request
|
39
|
+
# job_flow.exists? #=> true/false
|
40
|
+
#
|
41
|
+
# = Enumerating Job Flows
|
42
|
+
#
|
43
|
+
# You can enumerate all job flows, or filter them.
|
44
|
+
#
|
45
|
+
# # all job flows
|
46
|
+
# job_flows.each {|job_flow| ... }
|
47
|
+
#
|
48
|
+
# # only job flows with a particular state
|
49
|
+
# job_flows.with_state('ENDED').each {|job_flow| ... }
|
50
|
+
#
|
51
|
+
# The filtering methods include:
|
52
|
+
#
|
53
|
+
# * {#with_id}
|
54
|
+
# * {#with_state}
|
55
|
+
# * {#created_before}
|
56
|
+
# * {#created_after}
|
57
|
+
#
|
58
|
+
class JobFlowCollection
|
59
|
+
|
60
|
+
include Core::Collection::Simple
|
61
|
+
|
62
|
+
# @private
|
63
|
+
def initialize options = {}
|
64
|
+
@filters = options[:filters] || {}
|
65
|
+
super
|
66
|
+
end
|
67
|
+
|
68
|
+
# @param [String] job_flow_id
|
69
|
+
# @return [JobFlow] Returns a {JobFlow} with the given ID.
|
70
|
+
def [] job_flow_id
|
71
|
+
JobFlow.new(job_flow_id, :config => config)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Runs a job flow.
|
75
|
+
#
|
76
|
+
# job_flow = emr.job_flows.create('name',
|
77
|
+
# :instances => {
|
78
|
+
# :instance_count => 2,
|
79
|
+
# :master_instance_type => 'm1.small',
|
80
|
+
# :slave_instance_type => 'm1.small',
|
81
|
+
# }
|
82
|
+
# )
|
83
|
+
#
|
84
|
+
# See {Client#run_job_flow} for documentation on the complete
|
85
|
+
# list of accepted options.
|
86
|
+
# @param [String] name
|
87
|
+
# @param [Hash] options
|
88
|
+
# @see (Client#run_job_flow)
|
89
|
+
# @return [JobFlow]
|
90
|
+
def create name, options = {}
|
91
|
+
|
92
|
+
options[:name] = name
|
93
|
+
options[:ami_version] ||= 'latest'
|
94
|
+
options[:instances] ||= {}
|
95
|
+
|
96
|
+
resp = client.run_job_flow(options)
|
97
|
+
|
98
|
+
self[resp.data[:job_flow_id]]
|
99
|
+
|
100
|
+
end
|
101
|
+
alias_method :run, :create
|
102
|
+
|
103
|
+
# Returns a new collection that will only enumerate job flows that have
|
104
|
+
# one of the given ids.
|
105
|
+
#
|
106
|
+
# emr.job_flows.with_id('id1', 'id2', 'id3').each do |job_flow|
|
107
|
+
# # ...
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# @param [String] ids One or more job flow ids to use as a filter.
|
111
|
+
# @return [JobFlowCollection]
|
112
|
+
def with_id *ids
|
113
|
+
filter(:job_flow_ids, ids.flatten)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Returns a new collection that will only enumerate job flows that have
|
117
|
+
# one of the given job flow states.
|
118
|
+
#
|
119
|
+
# emr.job_flows.with_state('SHUTTING_DOWN', 'TERMINATED').each do |job|
|
120
|
+
# # ...
|
121
|
+
# end
|
122
|
+
#
|
123
|
+
# @param [String] states One or more job flow states to use as a filter.
|
124
|
+
# @return [JobFlowCollection]
|
125
|
+
def with_state *states
|
126
|
+
filter(:job_flow_states, states.flatten)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Returns a new collection that will only enumerate job flows that
|
130
|
+
# were created before the given time.
|
131
|
+
#
|
132
|
+
# # enumerate jobs that are more than an hour old
|
133
|
+
# emr.job_flows.created_before(Time.now - 3600).each{|job| ... }
|
134
|
+
#
|
135
|
+
# @param [Time,DateTime,Date] time
|
136
|
+
# @return [JobFlowCollection]
|
137
|
+
def created_before time
|
138
|
+
time = time.iso8601 if time.respond_to?(:iso8601)
|
139
|
+
filter(:created_before, time)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Returns a new collection that will only enumerate job flows that
|
143
|
+
# were created after the given time.
|
144
|
+
#
|
145
|
+
# # enumerate jobs that are at most 1 hour old
|
146
|
+
# emr.job_flows.created_after(Time.now - 3600).each{|job| ... }
|
147
|
+
#
|
148
|
+
# @param [Time,DateTime,Date] time
|
149
|
+
# @return [JobFlowCollection]
|
150
|
+
def created_after time
|
151
|
+
time = time.iso8601 if time.respond_to?(:iso8601)
|
152
|
+
filter(:created_after, time)
|
153
|
+
end
|
154
|
+
|
155
|
+
# @param [String,Symbol] name
|
156
|
+
# @param [Mixed] value
|
157
|
+
# @return [JobFlowCollection]
|
158
|
+
def filter name, value
|
159
|
+
options = {}
|
160
|
+
options[:filters] = @filters.merge(name.to_s.to_sym => value)
|
161
|
+
options[:config] = config
|
162
|
+
JobFlowCollection.new(options)
|
163
|
+
end
|
164
|
+
|
165
|
+
protected
|
166
|
+
|
167
|
+
def _each_item options = {}, &block
|
168
|
+
|
169
|
+
resp = client.describe_job_flows(@filters.merge(options))
|
170
|
+
resp.data[:job_flows].each do |details|
|
171
|
+
|
172
|
+
job_flow = JobFlow.new_from(
|
173
|
+
:describe_job_flows,
|
174
|
+
details,
|
175
|
+
details[:job_flow_id],
|
176
|
+
:config => config)
|
177
|
+
|
178
|
+
yield(job_flow)
|
179
|
+
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class EMR
|
16
|
+
|
17
|
+
# @private
|
18
|
+
class Request < Core::Http::Request
|
19
|
+
include Core::Signature::Version2
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/aws/iam/access_key.rb
CHANGED
@@ -39,7 +39,7 @@ module AWS
|
|
39
39
|
#
|
40
40
|
# iam.account_aliases.create('myaccountalias')
|
41
41
|
#
|
42
|
-
# For information about account alias restrictions and usage,
|
42
|
+
# For information about account alias restrictions and usage,
|
43
43
|
# see http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?AccountAlias.html.
|
44
44
|
#
|
45
45
|
# @param [String] account_alias
|
@@ -69,7 +69,7 @@ module AWS
|
|
69
69
|
# @private
|
70
70
|
protected
|
71
71
|
def each_item response, &block
|
72
|
-
response.account_aliases.each do |account_alias|
|
72
|
+
response.data[:account_aliases].each do |account_alias|
|
73
73
|
yield(account_alias)
|
74
74
|
end
|
75
75
|
end
|
data/lib/aws/iam/client.rb
CHANGED
data/lib/aws/iam/group.rb
CHANGED
@@ -36,9 +36,9 @@ module AWS
|
|
36
36
|
super
|
37
37
|
end
|
38
38
|
|
39
|
-
mutable_attribute :name, :static => true, :
|
39
|
+
mutable_attribute :name, :static => true, :from => :group_name
|
40
40
|
|
41
|
-
attribute :id, :static => true, :
|
41
|
+
attribute :id, :static => true, :from => :group_id
|
42
42
|
|
43
43
|
attribute :create_date, :static => true
|
44
44
|
|
@@ -32,11 +32,11 @@ module AWS
|
|
32
32
|
|
33
33
|
# @attr [String] The name that identifies the server
|
34
34
|
# certificate.
|
35
|
-
mutable_attribute :name, :static => true, :
|
35
|
+
mutable_attribute :name, :static => true, :from => :server_certificate_name
|
36
36
|
|
37
37
|
# @attr_reader [String] The stable and unique string identifying
|
38
38
|
# the server certificate.
|
39
|
-
attribute :id, :static => true, :
|
39
|
+
attribute :id, :static => true, :from => :server_certificate_id
|
40
40
|
|
41
41
|
# @attr_reader [Time] The date when the server certificate was
|
42
42
|
# uploaded.
|
@@ -71,7 +71,7 @@ module AWS
|
|
71
71
|
# then that user is the implied owner.
|
72
72
|
attr_reader :user
|
73
73
|
|
74
|
-
attribute :contents, :
|
74
|
+
attribute :contents, :from => :certificate_body, :static => true
|
75
75
|
|
76
76
|
mutable_attribute :status, :to_sym => true
|
77
77
|
|
data/lib/aws/iam/user.rb
CHANGED
@@ -80,10 +80,10 @@ module AWS
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# @attr [String] The IAM user name.
|
83
|
-
mutable_attribute :name, :static => true, :
|
83
|
+
mutable_attribute :name, :static => true, :from => :user_name
|
84
84
|
|
85
85
|
# @attr_reader [String] The user's unique ID.
|
86
|
-
attribute :id, :static => true, :
|
86
|
+
attribute :id, :static => true, :from => :user_id
|
87
87
|
|
88
88
|
# @attr_reader [Time] When the user was created.
|
89
89
|
attribute :create_date, :static => true
|
data/lib/aws/s3/client.rb
CHANGED
@@ -67,7 +67,7 @@ module AWS
|
|
67
67
|
header_options.each do |(opt, header)|
|
68
68
|
if value = options[opt]
|
69
69
|
# for backwards compatability we translate canned acls
|
70
|
-
# header values from symbols to strings (e.g.
|
70
|
+
# header values from symbols to strings (e.g.
|
71
71
|
# :public_read translates to 'public-read')
|
72
72
|
value = (opt == :acl ? value.to_s.tr('_', '-') : value)
|
73
73
|
req.headers[header] = value
|
@@ -82,17 +82,17 @@ module AWS
|
|
82
82
|
if xml_grammar
|
83
83
|
|
84
84
|
parser = Core::XML::Parser.new(xml_grammar.rules)
|
85
|
-
|
85
|
+
|
86
86
|
process_response do |resp|
|
87
87
|
resp.data = parser.parse(resp.http_response.body)
|
88
88
|
super(resp)
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
simulate_response do |resp|
|
92
92
|
resp.data = parser.simulate
|
93
93
|
super(resp)
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|
@@ -116,8 +116,8 @@ module AWS
|
|
116
116
|
# @overload create_bucket(options = {})
|
117
117
|
# @param [Hash] options
|
118
118
|
# @option options [required,String] :bucket_name
|
119
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
120
|
-
# 'public-read', etc). See the S3 API documentation for
|
119
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
120
|
+
# 'public-read', etc). See the S3 API documentation for
|
121
121
|
# a complete list of valid values.
|
122
122
|
# @option options [String] :grant_read
|
123
123
|
# @option options [String] :grant_write
|
@@ -140,7 +140,7 @@ module AWS
|
|
140
140
|
xmlns = "http://s3.amazonaws.com/doc/#{API_VERSION}/"
|
141
141
|
req.body = <<-XML
|
142
142
|
<CreateBucketConfiguration xmlns="#{xmlns}">
|
143
|
-
<LocationConstraint>#{location}</LocationConstraint>
|
143
|
+
<LocationConstraint>#{location}</LocationConstraint>
|
144
144
|
</CreateBucketConfiguration>
|
145
145
|
XML
|
146
146
|
end
|
@@ -198,7 +198,7 @@ module AWS
|
|
198
198
|
# @option options [required,String] :bucket_name
|
199
199
|
# @return [Core::Response]
|
200
200
|
bucket_method(:delete_bucket_lifecycle_configuration, :delete) do
|
201
|
-
|
201
|
+
|
202
202
|
configure_request do |req, options|
|
203
203
|
req.add_param('lifecycle')
|
204
204
|
super(req, options)
|
@@ -286,7 +286,7 @@ module AWS
|
|
286
286
|
|
287
287
|
end
|
288
288
|
|
289
|
-
# Gets the bucket's location constraint.
|
289
|
+
# Gets the bucket's location constraint.
|
290
290
|
# @overload get_bucket_location(options = {})
|
291
291
|
# @param [Hash] options
|
292
292
|
# @option options [required,String] :bucket_name
|
@@ -341,12 +341,12 @@ module AWS
|
|
341
341
|
#
|
342
342
|
# @example Using a canned acl
|
343
343
|
# s3_client.put_bucket_acl(
|
344
|
-
# :bucket_name => 'bucket-name',
|
344
|
+
# :bucket_name => 'bucket-name',
|
345
345
|
# :acl => 'public-read')
|
346
346
|
#
|
347
347
|
# @example Using grants
|
348
348
|
# s3_client.put_bucket_acl(
|
349
|
-
# :bucket_name => 'bucket-name',
|
349
|
+
# :bucket_name => 'bucket-name',
|
350
350
|
# :grant_read => 'uri="http://acs.amazonaws.com/groups/global/AllUsers"',
|
351
351
|
# :grant_full_control => 'emailAddress="xyz@amazon.com", id="8a9...fa7"')
|
352
352
|
#
|
@@ -385,8 +385,8 @@ module AWS
|
|
385
385
|
# @option options [String] :access_control_policy An access control
|
386
386
|
# policy description as a string of XML. See the S3 API
|
387
387
|
# documentation for a description.
|
388
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
389
|
-
# 'public-read', etc). See the S3 API documentation for
|
388
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
389
|
+
# 'public-read', etc). See the S3 API documentation for
|
390
390
|
# a complete list of valid values.
|
391
391
|
# @option options [String] :grant_read
|
392
392
|
# @option options [String] :grant_write
|
@@ -404,10 +404,10 @@ module AWS
|
|
404
404
|
}) do
|
405
405
|
|
406
406
|
configure_request do |req, options|
|
407
|
-
move_access_control_policy(options)
|
407
|
+
move_access_control_policy(options)
|
408
408
|
require_acl!(options)
|
409
409
|
super(req, options)
|
410
|
-
req.body = options[:access_control_policy] if
|
410
|
+
req.body = options[:access_control_policy] if
|
411
411
|
options[:access_control_policy]
|
412
412
|
end
|
413
413
|
|
@@ -430,7 +430,7 @@ module AWS
|
|
430
430
|
#
|
431
431
|
# @example Using a canned acl
|
432
432
|
# s3_client.put_object_acl(
|
433
|
-
# :bucket_name => 'bucket-name',
|
433
|
+
# :bucket_name => 'bucket-name',
|
434
434
|
# :key => 'object-key',
|
435
435
|
# :acl => 'public-read')
|
436
436
|
#
|
@@ -478,8 +478,8 @@ module AWS
|
|
478
478
|
# @option options [String] :access_control_policy An access control
|
479
479
|
# policy description as a string of XML. See the S3 API
|
480
480
|
# documentation for a description.
|
481
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
482
|
-
# 'public-read', etc). See the S3 API documentation for
|
481
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
482
|
+
# 'public-read', etc). See the S3 API documentation for
|
483
483
|
# a complete list of valid values.
|
484
484
|
# @option options [String] :grant_read
|
485
485
|
# @option options [String] :grant_write
|
@@ -497,10 +497,10 @@ module AWS
|
|
497
497
|
}) do
|
498
498
|
|
499
499
|
configure_request do |req, options|
|
500
|
-
move_access_control_policy(options)
|
500
|
+
move_access_control_policy(options)
|
501
501
|
require_acl!(options)
|
502
502
|
super(req, options)
|
503
|
-
req.body = options[:access_control_policy] if
|
503
|
+
req.body = options[:access_control_policy] if
|
504
504
|
options[:access_control_policy]
|
505
505
|
end
|
506
506
|
|
@@ -519,7 +519,7 @@ module AWS
|
|
519
519
|
#
|
520
520
|
# s3_client.put_object({
|
521
521
|
# :bucket_name => 'bucket-name',
|
522
|
-
# :key => 'readme.txt',
|
522
|
+
# :key => 'readme.txt',
|
523
523
|
# :data => 'This is the readme for ...',
|
524
524
|
# })
|
525
525
|
#
|
@@ -529,12 +529,12 @@ module AWS
|
|
529
529
|
# accepts data chunks. For example:
|
530
530
|
#
|
531
531
|
# s3_client.put_object(
|
532
|
-
# :bucket_name => 'mybucket',
|
532
|
+
# :bucket_name => 'mybucket',
|
533
533
|
# :key => 'some/key'
|
534
534
|
# :content_length => File.size('myfile')
|
535
535
|
# ) do |buffer|
|
536
536
|
#
|
537
|
-
# File.open('myfile') do |io|
|
537
|
+
# File.open('myfile') do |io|
|
538
538
|
# buffer.write(io.read(length)) until io.eof?
|
539
539
|
# end
|
540
540
|
#
|
@@ -556,15 +556,15 @@ module AWS
|
|
556
556
|
# @option options [required,String] :key
|
557
557
|
# @option options [required,String,Pathname,File,IO] :data
|
558
558
|
# The data to upload. This can be provided as a string,
|
559
|
-
# a Pathname object, or any object that responds to
|
559
|
+
# a Pathname object, or any object that responds to
|
560
560
|
# +#read+ and +#eof?+ (e.g. IO, File, Tempfile, StringIO, etc).
|
561
561
|
# @option options [Integer] :content_length
|
562
|
-
# Required if you are using block form to write data or if it is
|
563
|
-
# not possible to determine the size of +:data+. A best effort
|
564
|
-
# is made to determine the content length of strings, files,
|
562
|
+
# Required if you are using block form to write data or if it is
|
563
|
+
# not possible to determine the size of +:data+. A best effort
|
564
|
+
# is made to determine the content length of strings, files,
|
565
565
|
# tempfiles, io objects, and any object that responds
|
566
566
|
# to +#length+ or +#size+.
|
567
|
-
# @option options [Hash] :metadata
|
567
|
+
# @option options [Hash] :metadata
|
568
568
|
# A hash of metadata to be included with the
|
569
569
|
# object. These will be sent to S3 as headers prefixed with
|
570
570
|
# +x-amz-meta+.
|
@@ -573,9 +573,9 @@ module AWS
|
|
573
573
|
# * +:private+
|
574
574
|
# * +:public_read+
|
575
575
|
# * ...
|
576
|
-
# @option options [Symbol] :storage_class+ (:standard)
|
577
|
-
# Controls whether Reduced Redundancy Storage is enabled for
|
578
|
-
# the object. Valid values are +:standard+ and
|
576
|
+
# @option options [Symbol] :storage_class+ (:standard)
|
577
|
+
# Controls whether Reduced Redundancy Storage is enabled for
|
578
|
+
# the object. Valid values are +:standard+ and
|
579
579
|
# +:reduced_redundancy+.
|
580
580
|
# @option options [String] :cache_control
|
581
581
|
# Can be used to specify caching behavior.
|
@@ -588,8 +588,8 @@ module AWS
|
|
588
588
|
# @option options [String] :content_type
|
589
589
|
# Specifies the content type.
|
590
590
|
# @option options [String] :expires
|
591
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
592
|
-
# 'public-read', etc). See the S3 API documentation for
|
591
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
592
|
+
# 'public-read', etc). See the S3 API documentation for
|
593
593
|
# a complete list of valid values.
|
594
594
|
# @option options [String] :grant_read
|
595
595
|
# @option options [String] :grant_write
|
@@ -627,7 +627,7 @@ module AWS
|
|
627
627
|
|
628
628
|
process_response do |response|
|
629
629
|
|
630
|
-
response.data[:version_id] =
|
630
|
+
response.data[:version_id] =
|
631
631
|
response.http_response.header('x-amz-version-id')
|
632
632
|
|
633
633
|
response.data[:etag] = response.http_response.header('ETag')
|
@@ -661,13 +661,13 @@ module AWS
|
|
661
661
|
# that is true if the object was not modified after the
|
662
662
|
# given time. If +:unmodified+ returns false, the +:data+
|
663
663
|
# value will be +nil+.
|
664
|
-
# @option options [String] :if_match If specified, the response
|
664
|
+
# @option options [String] :if_match If specified, the response
|
665
665
|
# will contain an additional +:matches+ value that is true
|
666
666
|
# if the object ETag matches the value for this option. If
|
667
667
|
# +:matches+ is false, the +:data+ value of the
|
668
668
|
# response will be +nil+.
|
669
|
-
# @option options [String] :if_none_match If specified, the
|
670
|
-
# response will contain an additional +:matches+ value that
|
669
|
+
# @option options [String] :if_none_match If specified, the
|
670
|
+
# response will contain an additional +:matches+ value that
|
671
671
|
# is true if and only if the object ETag matches the value for
|
672
672
|
# this option. If +:matches+ is true, the +:data+ value
|
673
673
|
# of the response will be +nil+.
|
@@ -765,7 +765,7 @@ module AWS
|
|
765
765
|
resp.data[:last_modified] = Time.parse(time)
|
766
766
|
end
|
767
767
|
|
768
|
-
resp.data[:content_length] =
|
768
|
+
resp.data[:content_length] =
|
769
769
|
resp.http_response.header('content-length').to_i
|
770
770
|
|
771
771
|
add_sse_to_response(resp)
|
@@ -829,8 +829,8 @@ module AWS
|
|
829
829
|
# @option options [String] :storage_class
|
830
830
|
# @option options [String] :server_side_encryption
|
831
831
|
# @option options [String] :expires
|
832
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
833
|
-
# 'public-read', etc). See the S3 API documentation for
|
832
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
833
|
+
# 'public-read', etc). See the S3 API documentation for
|
834
834
|
# a complete list of valid values.
|
835
835
|
# @option options [String] :grant_read
|
836
836
|
# @option options [String] :grant_write
|
@@ -935,7 +935,7 @@ module AWS
|
|
935
935
|
# @option options [required,String] :key
|
936
936
|
# @option options [required,String,Pathname,File,IO] :data
|
937
937
|
# The data to upload. This can be provided as a string,
|
938
|
-
# a Pathname object, or any object that responds to
|
938
|
+
# a Pathname object, or any object that responds to
|
939
939
|
# +#read+ and +#eof?+ (e.g. IO, File, Tempfile, StringIO, etc).
|
940
940
|
# @option options [required,String] :upload_id
|
941
941
|
# @option options [required,Integer] :part_number
|
@@ -994,7 +994,7 @@ module AWS
|
|
994
994
|
|
995
995
|
process_response do |response|
|
996
996
|
add_sse_to_response(response)
|
997
|
-
response.data[:version_id] =
|
997
|
+
response.data[:version_id] =
|
998
998
|
response.http_response.header('x-amz-version-id')
|
999
999
|
end
|
1000
1000
|
|
@@ -1048,8 +1048,8 @@ module AWS
|
|
1048
1048
|
# bucket name and key, joined by a forward slash ('/').
|
1049
1049
|
# This string must be URL-encoded. Additionally, you must
|
1050
1050
|
# have read access to the source object.
|
1051
|
-
# @option options [String] :acl A canned ACL (e.g. 'private',
|
1052
|
-
# 'public-read', etc). See the S3 API documentation for
|
1051
|
+
# @option options [String] :acl A canned ACL (e.g. 'private',
|
1052
|
+
# 'public-read', etc). See the S3 API documentation for
|
1053
1053
|
# a complete list of valid values.
|
1054
1054
|
# @option options [String] :grant_read
|
1055
1055
|
# @option options [String] :grant_write
|
@@ -1092,7 +1092,7 @@ module AWS
|
|
1092
1092
|
end
|
1093
1093
|
|
1094
1094
|
process_response do |response|
|
1095
|
-
response.data[:version_id] =
|
1095
|
+
response.data[:version_id] =
|
1096
1096
|
response.http_response.header('x-amz-version-id')
|
1097
1097
|
response.data[:etag] = response.http_response.header('ETag')
|
1098
1098
|
if time = response.http_response.header('Last-Modified')
|
@@ -1106,7 +1106,7 @@ module AWS
|
|
1106
1106
|
protected
|
1107
1107
|
|
1108
1108
|
def extract_error_details response
|
1109
|
-
if
|
1109
|
+
if
|
1110
1110
|
(response.http_response.status >= 300 ||
|
1111
1111
|
response.request_type == :complete_multipart_upload) and
|
1112
1112
|
body = response.http_response.body and
|
@@ -1134,7 +1134,7 @@ module AWS
|
|
1134
1134
|
super or
|
1135
1135
|
response.request_type == :complete_multipart_upload &&
|
1136
1136
|
extract_error_details(response)
|
1137
|
-
# complete multipart upload can return an error inside a
|
1137
|
+
# complete multipart upload can return an error inside a
|
1138
1138
|
# 200 level response -- this forces us to parse the
|
1139
1139
|
# response for errors every time
|
1140
1140
|
end
|
@@ -1145,7 +1145,9 @@ module AWS
|
|
1145
1145
|
end
|
1146
1146
|
|
1147
1147
|
def new_request
|
1148
|
-
S3::Request.new
|
1148
|
+
req = S3::Request.new
|
1149
|
+
req.force_path_style = config.s3_force_path_style?
|
1150
|
+
req
|
1149
1151
|
end
|
1150
1152
|
|
1151
1153
|
def add_sse_to_response response
|
@@ -1169,7 +1171,7 @@ module AWS
|
|
1169
1171
|
end
|
1170
1172
|
|
1171
1173
|
# @param [String] possible_xml
|
1172
|
-
# @return [Boolean] Returns +true+ if the given string is a valid xml
|
1174
|
+
# @return [Boolean] Returns +true+ if the given string is a valid xml
|
1173
1175
|
# document.
|
1174
1176
|
def is_xml? possible_xml
|
1175
1177
|
begin
|
@@ -1196,9 +1198,9 @@ module AWS
|
|
1196
1198
|
# name in the url path, like:
|
1197
1199
|
#
|
1198
1200
|
# http://s3.amazonaws.com/dns_incompat_bucket_name/
|
1199
|
-
#
|
1201
|
+
#
|
1200
1202
|
# @return [Boolean] Returns true if the given bucket name may be
|
1201
|
-
# is dns compatible.
|
1203
|
+
# is dns compatible.
|
1202
1204
|
# this bucket n
|
1203
1205
|
#
|
1204
1206
|
def dns_compatible_bucket_name?(bucket_name)
|
@@ -1226,17 +1228,17 @@ module AWS
|
|
1226
1228
|
|
1227
1229
|
# Returns true if the bucket name must be used in the request
|
1228
1230
|
# path instead of as a sub-domain when making requests against
|
1229
|
-
# S3.
|
1231
|
+
# S3.
|
1230
1232
|
#
|
1231
|
-
# This can be an issue if the bucket name is DNS compatible but
|
1233
|
+
# This can be an issue if the bucket name is DNS compatible but
|
1232
1234
|
# contains '.' (periods). These cause the SSL certificate to
|
1233
1235
|
# become invalid when making authenticated requets over SSL to the
|
1234
1236
|
# bucket name. The solution is to send this as a path argument
|
1235
1237
|
# instead.
|
1236
|
-
#
|
1238
|
+
#
|
1237
1239
|
# @return [Boolean] Returns true if the bucket name should be used
|
1238
1240
|
# as a path segement instead of dns prefix when making requests
|
1239
|
-
# against s3.
|
1241
|
+
# against s3.
|
1240
1242
|
#
|
1241
1243
|
def path_style_bucket_name? bucket_name
|
1242
1244
|
if dns_compatible_bucket_name?(bucket_name)
|