aws-sdk-s3 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-s3.rb +1 -1
- data/lib/aws-sdk-s3/bucket.rb +96 -1
- data/lib/aws-sdk-s3/bucket_acl.rb +97 -2
- data/lib/aws-sdk-s3/bucket_cors.rb +96 -1
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +96 -1
- data/lib/aws-sdk-s3/bucket_logging.rb +96 -1
- data/lib/aws-sdk-s3/bucket_notification.rb +98 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +96 -1
- data/lib/aws-sdk-s3/bucket_request_payment.rb +96 -1
- data/lib/aws-sdk-s3/bucket_tagging.rb +96 -1
- data/lib/aws-sdk-s3/bucket_versioning.rb +97 -2
- data/lib/aws-sdk-s3/bucket_website.rb +99 -4
- data/lib/aws-sdk-s3/client.rb +1 -1
- data/lib/aws-sdk-s3/multipart_upload.rb +101 -6
- data/lib/aws-sdk-s3/multipart_upload_part.rb +98 -3
- data/lib/aws-sdk-s3/object.rb +121 -26
- data/lib/aws-sdk-s3/object_acl.rb +98 -3
- data/lib/aws-sdk-s3/object_summary.rb +100 -5
- data/lib/aws-sdk-s3/object_version.rb +103 -8
- metadata +2 -2
@@ -32,7 +32,7 @@ module Aws::S3
|
|
32
32
|
|
33
33
|
# @return [Array<Types::Tag>]
|
34
34
|
def tag_set
|
35
|
-
data
|
35
|
+
data[:tag_set]
|
36
36
|
end
|
37
37
|
|
38
38
|
# @!endgroup
|
@@ -70,6 +70,101 @@ module Aws::S3
|
|
70
70
|
!!@data
|
71
71
|
end
|
72
72
|
|
73
|
+
# @deprecated Use [Aws::S3::Client] #wait_until instead
|
74
|
+
#
|
75
|
+
# Waiter polls an API operation until a resource enters a desired
|
76
|
+
# state.
|
77
|
+
#
|
78
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
79
|
+
#
|
80
|
+
# ## Basic Usage
|
81
|
+
#
|
82
|
+
# Waiter will polls until it is successful, it fails by
|
83
|
+
# entering a terminal state, or until a maximum number of attempts
|
84
|
+
# are made.
|
85
|
+
#
|
86
|
+
# # polls in a loop until condition is true
|
87
|
+
# resource.wait_until(options) {|resource| condition}
|
88
|
+
#
|
89
|
+
# ## Example
|
90
|
+
#
|
91
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
92
|
+
#
|
93
|
+
# ## Configuration
|
94
|
+
#
|
95
|
+
# You can configure the maximum number of polling attempts, and the
|
96
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
97
|
+
# by passing a block to {#wait_until}:
|
98
|
+
#
|
99
|
+
# # poll for ~25 seconds
|
100
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
101
|
+
#
|
102
|
+
# ## Callbacks
|
103
|
+
#
|
104
|
+
# You can be notified before each polling attempt and before each
|
105
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
106
|
+
# it will terminate the waiter.
|
107
|
+
#
|
108
|
+
# started_at = Time.now
|
109
|
+
# # poll for 1 hour, instead of a number of attempts
|
110
|
+
# proc = Proc.new do |attempts, response|
|
111
|
+
# throw :failure if Time.now - started_at > 3600
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# # disable max attempts
|
115
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
116
|
+
#
|
117
|
+
# ## Handling Errors
|
118
|
+
#
|
119
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
120
|
+
# fails, it raises an error.
|
121
|
+
#
|
122
|
+
# begin
|
123
|
+
# resource.wait_until(...)
|
124
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
125
|
+
# # resource did not enter the desired state in time
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
#
|
129
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
130
|
+
#
|
131
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
132
|
+
# because the waiter has entered a state that it will not transition
|
133
|
+
# out of, preventing success.
|
134
|
+
#
|
135
|
+
# yet successful.
|
136
|
+
#
|
137
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
138
|
+
# while polling for a resource that is not expected.
|
139
|
+
#
|
140
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
141
|
+
#
|
142
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
143
|
+
# attempts
|
144
|
+
# @option options [Integer] :delay (10) Delay between each
|
145
|
+
# attempt in seconds
|
146
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
147
|
+
# invoked before each attempt
|
148
|
+
# @option options [Proc] :before_wait (nil) Callback
|
149
|
+
# invoked before each wait
|
150
|
+
# @return [Resource] if the waiter was successful
|
151
|
+
def wait_until(options = {}, &block)
|
152
|
+
self_copy = self.dup
|
153
|
+
attempts = 0
|
154
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
155
|
+
options[:delay] ||= 10
|
156
|
+
options[:poller] = Proc.new do
|
157
|
+
attempts += 1
|
158
|
+
if block.call(self_copy)
|
159
|
+
[:success, self_copy]
|
160
|
+
else
|
161
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
162
|
+
:retry
|
163
|
+
end
|
164
|
+
end
|
165
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
166
|
+
end
|
167
|
+
|
73
168
|
# @!group Actions
|
74
169
|
|
75
170
|
# @example Request syntax with placeholder values
|
@@ -33,7 +33,7 @@ module Aws::S3
|
|
33
33
|
# The versioning state of the bucket.
|
34
34
|
# @return [String]
|
35
35
|
def status
|
36
|
-
data
|
36
|
+
data[:status]
|
37
37
|
end
|
38
38
|
|
39
39
|
# Specifies whether MFA delete is enabled in the bucket versioning
|
@@ -42,7 +42,7 @@ module Aws::S3
|
|
42
42
|
# configured, this element is not returned.
|
43
43
|
# @return [String]
|
44
44
|
def mfa_delete
|
45
|
-
data
|
45
|
+
data[:mfa_delete]
|
46
46
|
end
|
47
47
|
|
48
48
|
# @!endgroup
|
@@ -80,6 +80,101 @@ module Aws::S3
|
|
80
80
|
!!@data
|
81
81
|
end
|
82
82
|
|
83
|
+
# @deprecated Use [Aws::S3::Client] #wait_until instead
|
84
|
+
#
|
85
|
+
# Waiter polls an API operation until a resource enters a desired
|
86
|
+
# state.
|
87
|
+
#
|
88
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
89
|
+
#
|
90
|
+
# ## Basic Usage
|
91
|
+
#
|
92
|
+
# Waiter will polls until it is successful, it fails by
|
93
|
+
# entering a terminal state, or until a maximum number of attempts
|
94
|
+
# are made.
|
95
|
+
#
|
96
|
+
# # polls in a loop until condition is true
|
97
|
+
# resource.wait_until(options) {|resource| condition}
|
98
|
+
#
|
99
|
+
# ## Example
|
100
|
+
#
|
101
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
102
|
+
#
|
103
|
+
# ## Configuration
|
104
|
+
#
|
105
|
+
# You can configure the maximum number of polling attempts, and the
|
106
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
107
|
+
# by passing a block to {#wait_until}:
|
108
|
+
#
|
109
|
+
# # poll for ~25 seconds
|
110
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
111
|
+
#
|
112
|
+
# ## Callbacks
|
113
|
+
#
|
114
|
+
# You can be notified before each polling attempt and before each
|
115
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
116
|
+
# it will terminate the waiter.
|
117
|
+
#
|
118
|
+
# started_at = Time.now
|
119
|
+
# # poll for 1 hour, instead of a number of attempts
|
120
|
+
# proc = Proc.new do |attempts, response|
|
121
|
+
# throw :failure if Time.now - started_at > 3600
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# # disable max attempts
|
125
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
126
|
+
#
|
127
|
+
# ## Handling Errors
|
128
|
+
#
|
129
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
130
|
+
# fails, it raises an error.
|
131
|
+
#
|
132
|
+
# begin
|
133
|
+
# resource.wait_until(...)
|
134
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
135
|
+
# # resource did not enter the desired state in time
|
136
|
+
# end
|
137
|
+
#
|
138
|
+
#
|
139
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
140
|
+
#
|
141
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
142
|
+
# because the waiter has entered a state that it will not transition
|
143
|
+
# out of, preventing success.
|
144
|
+
#
|
145
|
+
# yet successful.
|
146
|
+
#
|
147
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
148
|
+
# while polling for a resource that is not expected.
|
149
|
+
#
|
150
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
151
|
+
#
|
152
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
153
|
+
# attempts
|
154
|
+
# @option options [Integer] :delay (10) Delay between each
|
155
|
+
# attempt in seconds
|
156
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
157
|
+
# invoked before each attempt
|
158
|
+
# @option options [Proc] :before_wait (nil) Callback
|
159
|
+
# invoked before each wait
|
160
|
+
# @return [Resource] if the waiter was successful
|
161
|
+
def wait_until(options = {}, &block)
|
162
|
+
self_copy = self.dup
|
163
|
+
attempts = 0
|
164
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
165
|
+
options[:delay] ||= 10
|
166
|
+
options[:poller] = Proc.new do
|
167
|
+
attempts += 1
|
168
|
+
if block.call(self_copy)
|
169
|
+
[:success, self_copy]
|
170
|
+
else
|
171
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
172
|
+
:retry
|
173
|
+
end
|
174
|
+
end
|
175
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
176
|
+
end
|
177
|
+
|
83
178
|
# @!group Actions
|
84
179
|
|
85
180
|
# @example Request syntax with placeholder values
|
@@ -32,22 +32,22 @@ module Aws::S3
|
|
32
32
|
|
33
33
|
# @return [Types::RedirectAllRequestsTo]
|
34
34
|
def redirect_all_requests_to
|
35
|
-
data
|
35
|
+
data[:redirect_all_requests_to]
|
36
36
|
end
|
37
37
|
|
38
38
|
# @return [Types::IndexDocument]
|
39
39
|
def index_document
|
40
|
-
data
|
40
|
+
data[:index_document]
|
41
41
|
end
|
42
42
|
|
43
43
|
# @return [Types::ErrorDocument]
|
44
44
|
def error_document
|
45
|
-
data
|
45
|
+
data[:error_document]
|
46
46
|
end
|
47
47
|
|
48
48
|
# @return [Array<Types::RoutingRule>]
|
49
49
|
def routing_rules
|
50
|
-
data
|
50
|
+
data[:routing_rules]
|
51
51
|
end
|
52
52
|
|
53
53
|
# @!endgroup
|
@@ -85,6 +85,101 @@ module Aws::S3
|
|
85
85
|
!!@data
|
86
86
|
end
|
87
87
|
|
88
|
+
# @deprecated Use [Aws::S3::Client] #wait_until instead
|
89
|
+
#
|
90
|
+
# Waiter polls an API operation until a resource enters a desired
|
91
|
+
# state.
|
92
|
+
#
|
93
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
94
|
+
#
|
95
|
+
# ## Basic Usage
|
96
|
+
#
|
97
|
+
# Waiter will polls until it is successful, it fails by
|
98
|
+
# entering a terminal state, or until a maximum number of attempts
|
99
|
+
# are made.
|
100
|
+
#
|
101
|
+
# # polls in a loop until condition is true
|
102
|
+
# resource.wait_until(options) {|resource| condition}
|
103
|
+
#
|
104
|
+
# ## Example
|
105
|
+
#
|
106
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
107
|
+
#
|
108
|
+
# ## Configuration
|
109
|
+
#
|
110
|
+
# You can configure the maximum number of polling attempts, and the
|
111
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
112
|
+
# by passing a block to {#wait_until}:
|
113
|
+
#
|
114
|
+
# # poll for ~25 seconds
|
115
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
116
|
+
#
|
117
|
+
# ## Callbacks
|
118
|
+
#
|
119
|
+
# You can be notified before each polling attempt and before each
|
120
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
121
|
+
# it will terminate the waiter.
|
122
|
+
#
|
123
|
+
# started_at = Time.now
|
124
|
+
# # poll for 1 hour, instead of a number of attempts
|
125
|
+
# proc = Proc.new do |attempts, response|
|
126
|
+
# throw :failure if Time.now - started_at > 3600
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# # disable max attempts
|
130
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
131
|
+
#
|
132
|
+
# ## Handling Errors
|
133
|
+
#
|
134
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
135
|
+
# fails, it raises an error.
|
136
|
+
#
|
137
|
+
# begin
|
138
|
+
# resource.wait_until(...)
|
139
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
140
|
+
# # resource did not enter the desired state in time
|
141
|
+
# end
|
142
|
+
#
|
143
|
+
#
|
144
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
145
|
+
#
|
146
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
147
|
+
# because the waiter has entered a state that it will not transition
|
148
|
+
# out of, preventing success.
|
149
|
+
#
|
150
|
+
# yet successful.
|
151
|
+
#
|
152
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
153
|
+
# while polling for a resource that is not expected.
|
154
|
+
#
|
155
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
156
|
+
#
|
157
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
158
|
+
# attempts
|
159
|
+
# @option options [Integer] :delay (10) Delay between each
|
160
|
+
# attempt in seconds
|
161
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
162
|
+
# invoked before each attempt
|
163
|
+
# @option options [Proc] :before_wait (nil) Callback
|
164
|
+
# invoked before each wait
|
165
|
+
# @return [Resource] if the waiter was successful
|
166
|
+
def wait_until(options = {}, &block)
|
167
|
+
self_copy = self.dup
|
168
|
+
attempts = 0
|
169
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
170
|
+
options[:delay] ||= 10
|
171
|
+
options[:poller] = Proc.new do
|
172
|
+
attempts += 1
|
173
|
+
if block.call(self_copy)
|
174
|
+
[:success, self_copy]
|
175
|
+
else
|
176
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
177
|
+
:retry
|
178
|
+
end
|
179
|
+
end
|
180
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
181
|
+
end
|
182
|
+
|
88
183
|
# @!group Actions
|
89
184
|
|
90
185
|
# @example Request syntax with placeholder values
|
data/lib/aws-sdk-s3/client.rb
CHANGED
@@ -49,36 +49,36 @@ module Aws::S3
|
|
49
49
|
# Upload ID that identifies the multipart upload.
|
50
50
|
# @return [String]
|
51
51
|
def upload_id
|
52
|
-
data
|
52
|
+
data[:upload_id]
|
53
53
|
end
|
54
54
|
|
55
55
|
# Key of the object for which the multipart upload was initiated.
|
56
56
|
# @return [String]
|
57
57
|
def key
|
58
|
-
data
|
58
|
+
data[:key]
|
59
59
|
end
|
60
60
|
|
61
61
|
# Date and time at which the multipart upload was initiated.
|
62
62
|
# @return [Time]
|
63
63
|
def initiated
|
64
|
-
data
|
64
|
+
data[:initiated]
|
65
65
|
end
|
66
66
|
|
67
67
|
# The class of storage used to store the object.
|
68
68
|
# @return [String]
|
69
69
|
def storage_class
|
70
|
-
data
|
70
|
+
data[:storage_class]
|
71
71
|
end
|
72
72
|
|
73
73
|
# @return [Types::Owner]
|
74
74
|
def owner
|
75
|
-
data
|
75
|
+
data[:owner]
|
76
76
|
end
|
77
77
|
|
78
78
|
# Identifies who initiated the multipart upload.
|
79
79
|
# @return [Types::Initiator]
|
80
80
|
def initiator
|
81
|
-
data
|
81
|
+
data[:initiator]
|
82
82
|
end
|
83
83
|
|
84
84
|
# @!endgroup
|
@@ -111,6 +111,101 @@ module Aws::S3
|
|
111
111
|
!!@data
|
112
112
|
end
|
113
113
|
|
114
|
+
# @deprecated Use [Aws::S3::Client] #wait_until instead
|
115
|
+
#
|
116
|
+
# Waiter polls an API operation until a resource enters a desired
|
117
|
+
# state.
|
118
|
+
#
|
119
|
+
# @note The waiting operation is performed on a copy. The original resource remains unchanged
|
120
|
+
#
|
121
|
+
# ## Basic Usage
|
122
|
+
#
|
123
|
+
# Waiter will polls until it is successful, it fails by
|
124
|
+
# entering a terminal state, or until a maximum number of attempts
|
125
|
+
# are made.
|
126
|
+
#
|
127
|
+
# # polls in a loop until condition is true
|
128
|
+
# resource.wait_until(options) {|resource| condition}
|
129
|
+
#
|
130
|
+
# ## Example
|
131
|
+
#
|
132
|
+
# instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
|
133
|
+
#
|
134
|
+
# ## Configuration
|
135
|
+
#
|
136
|
+
# You can configure the maximum number of polling attempts, and the
|
137
|
+
# delay (in seconds) between each polling attempt. The waiting condition is set
|
138
|
+
# by passing a block to {#wait_until}:
|
139
|
+
#
|
140
|
+
# # poll for ~25 seconds
|
141
|
+
# resource.wait_until(max_attempts:5,delay:5) {|resource|...}
|
142
|
+
#
|
143
|
+
# ## Callbacks
|
144
|
+
#
|
145
|
+
# You can be notified before each polling attempt and before each
|
146
|
+
# delay. If you throw `:success` or `:failure` from these callbacks,
|
147
|
+
# it will terminate the waiter.
|
148
|
+
#
|
149
|
+
# started_at = Time.now
|
150
|
+
# # poll for 1 hour, instead of a number of attempts
|
151
|
+
# proc = Proc.new do |attempts, response|
|
152
|
+
# throw :failure if Time.now - started_at > 3600
|
153
|
+
# end
|
154
|
+
#
|
155
|
+
# # disable max attempts
|
156
|
+
# instance.wait_until(before_wait:proc, max_attempts:nil) {...}
|
157
|
+
#
|
158
|
+
# ## Handling Errors
|
159
|
+
#
|
160
|
+
# When a waiter is successful, it returns the Resource. When a waiter
|
161
|
+
# fails, it raises an error.
|
162
|
+
#
|
163
|
+
# begin
|
164
|
+
# resource.wait_until(...)
|
165
|
+
# rescue Aws::Waiters::Errors::WaiterFailed
|
166
|
+
# # resource did not enter the desired state in time
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
#
|
170
|
+
# @yield param [Resource] resource to be used in the waiting condition
|
171
|
+
#
|
172
|
+
# @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
|
173
|
+
# because the waiter has entered a state that it will not transition
|
174
|
+
# out of, preventing success.
|
175
|
+
#
|
176
|
+
# yet successful.
|
177
|
+
#
|
178
|
+
# @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
|
179
|
+
# while polling for a resource that is not expected.
|
180
|
+
#
|
181
|
+
# @raise [NotImplementedError] Raised when the resource does not
|
182
|
+
#
|
183
|
+
# @option options [Integer] :max_attempts (10) Maximum number of
|
184
|
+
# attempts
|
185
|
+
# @option options [Integer] :delay (10) Delay between each
|
186
|
+
# attempt in seconds
|
187
|
+
# @option options [Proc] :before_attempt (nil) Callback
|
188
|
+
# invoked before each attempt
|
189
|
+
# @option options [Proc] :before_wait (nil) Callback
|
190
|
+
# invoked before each wait
|
191
|
+
# @return [Resource] if the waiter was successful
|
192
|
+
def wait_until(options = {}, &block)
|
193
|
+
self_copy = self.dup
|
194
|
+
attempts = 0
|
195
|
+
options[:max_attempts] = 10 unless options.key?(:max_attempts)
|
196
|
+
options[:delay] ||= 10
|
197
|
+
options[:poller] = Proc.new do
|
198
|
+
attempts += 1
|
199
|
+
if block.call(self_copy)
|
200
|
+
[:success, self_copy]
|
201
|
+
else
|
202
|
+
self_copy.reload unless attempts == options[:max_attempts]
|
203
|
+
:retry
|
204
|
+
end
|
205
|
+
end
|
206
|
+
Aws::Waiters::Waiter.new(options).wait({})
|
207
|
+
end
|
208
|
+
|
114
209
|
# @!group Actions
|
115
210
|
|
116
211
|
# @example Request syntax with placeholder values
|