aws-sdk-s3 1.3.0 → 1.4.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.
@@ -32,7 +32,7 @@ module Aws::S3
32
32
 
33
33
  # @return [Types::LoggingEnabled]
34
34
  def logging_enabled
35
- data.logging_enabled
35
+ data[:logging_enabled]
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
@@ -32,17 +32,17 @@ module Aws::S3
32
32
 
33
33
  # @return [Array<Types::TopicConfiguration>]
34
34
  def topic_configurations
35
- data.topic_configurations
35
+ data[:topic_configurations]
36
36
  end
37
37
 
38
38
  # @return [Array<Types::QueueConfiguration>]
39
39
  def queue_configurations
40
- data.queue_configurations
40
+ data[:queue_configurations]
41
41
  end
42
42
 
43
43
  # @return [Array<Types::LambdaFunctionConfiguration>]
44
44
  def lambda_function_configurations
45
- data.lambda_function_configurations
45
+ data[:lambda_function_configurations]
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
@@ -33,7 +33,7 @@ module Aws::S3
33
33
  # The bucket policy as a JSON document.
34
34
  # @return [IO]
35
35
  def policy
36
- data.policy
36
+ data[:policy]
37
37
  end
38
38
 
39
39
  # @!endgroup
@@ -71,6 +71,101 @@ module Aws::S3
71
71
  !!@data
72
72
  end
73
73
 
74
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
75
+ #
76
+ # Waiter polls an API operation until a resource enters a desired
77
+ # state.
78
+ #
79
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
80
+ #
81
+ # ## Basic Usage
82
+ #
83
+ # Waiter will polls until it is successful, it fails by
84
+ # entering a terminal state, or until a maximum number of attempts
85
+ # are made.
86
+ #
87
+ # # polls in a loop until condition is true
88
+ # resource.wait_until(options) {|resource| condition}
89
+ #
90
+ # ## Example
91
+ #
92
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
93
+ #
94
+ # ## Configuration
95
+ #
96
+ # You can configure the maximum number of polling attempts, and the
97
+ # delay (in seconds) between each polling attempt. The waiting condition is set
98
+ # by passing a block to {#wait_until}:
99
+ #
100
+ # # poll for ~25 seconds
101
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
102
+ #
103
+ # ## Callbacks
104
+ #
105
+ # You can be notified before each polling attempt and before each
106
+ # delay. If you throw `:success` or `:failure` from these callbacks,
107
+ # it will terminate the waiter.
108
+ #
109
+ # started_at = Time.now
110
+ # # poll for 1 hour, instead of a number of attempts
111
+ # proc = Proc.new do |attempts, response|
112
+ # throw :failure if Time.now - started_at > 3600
113
+ # end
114
+ #
115
+ # # disable max attempts
116
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
117
+ #
118
+ # ## Handling Errors
119
+ #
120
+ # When a waiter is successful, it returns the Resource. When a waiter
121
+ # fails, it raises an error.
122
+ #
123
+ # begin
124
+ # resource.wait_until(...)
125
+ # rescue Aws::Waiters::Errors::WaiterFailed
126
+ # # resource did not enter the desired state in time
127
+ # end
128
+ #
129
+ #
130
+ # @yield param [Resource] resource to be used in the waiting condition
131
+ #
132
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
133
+ # because the waiter has entered a state that it will not transition
134
+ # out of, preventing success.
135
+ #
136
+ # yet successful.
137
+ #
138
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
139
+ # while polling for a resource that is not expected.
140
+ #
141
+ # @raise [NotImplementedError] Raised when the resource does not
142
+ #
143
+ # @option options [Integer] :max_attempts (10) Maximum number of
144
+ # attempts
145
+ # @option options [Integer] :delay (10) Delay between each
146
+ # attempt in seconds
147
+ # @option options [Proc] :before_attempt (nil) Callback
148
+ # invoked before each attempt
149
+ # @option options [Proc] :before_wait (nil) Callback
150
+ # invoked before each wait
151
+ # @return [Resource] if the waiter was successful
152
+ def wait_until(options = {}, &block)
153
+ self_copy = self.dup
154
+ attempts = 0
155
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
156
+ options[:delay] ||= 10
157
+ options[:poller] = Proc.new do
158
+ attempts += 1
159
+ if block.call(self_copy)
160
+ [:success, self_copy]
161
+ else
162
+ self_copy.reload unless attempts == options[:max_attempts]
163
+ :retry
164
+ end
165
+ end
166
+ Aws::Waiters::Waiter.new(options).wait({})
167
+ end
168
+
74
169
  # @!group Actions
75
170
 
76
171
  # @example Request syntax with placeholder values
@@ -33,7 +33,7 @@ module Aws::S3
33
33
  # Specifies who pays for the download and request fees.
34
34
  # @return [String]
35
35
  def payer
36
- data.payer
36
+ data[:payer]
37
37
  end
38
38
 
39
39
  # @!endgroup
@@ -71,6 +71,101 @@ module Aws::S3
71
71
  !!@data
72
72
  end
73
73
 
74
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
75
+ #
76
+ # Waiter polls an API operation until a resource enters a desired
77
+ # state.
78
+ #
79
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
80
+ #
81
+ # ## Basic Usage
82
+ #
83
+ # Waiter will polls until it is successful, it fails by
84
+ # entering a terminal state, or until a maximum number of attempts
85
+ # are made.
86
+ #
87
+ # # polls in a loop until condition is true
88
+ # resource.wait_until(options) {|resource| condition}
89
+ #
90
+ # ## Example
91
+ #
92
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
93
+ #
94
+ # ## Configuration
95
+ #
96
+ # You can configure the maximum number of polling attempts, and the
97
+ # delay (in seconds) between each polling attempt. The waiting condition is set
98
+ # by passing a block to {#wait_until}:
99
+ #
100
+ # # poll for ~25 seconds
101
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
102
+ #
103
+ # ## Callbacks
104
+ #
105
+ # You can be notified before each polling attempt and before each
106
+ # delay. If you throw `:success` or `:failure` from these callbacks,
107
+ # it will terminate the waiter.
108
+ #
109
+ # started_at = Time.now
110
+ # # poll for 1 hour, instead of a number of attempts
111
+ # proc = Proc.new do |attempts, response|
112
+ # throw :failure if Time.now - started_at > 3600
113
+ # end
114
+ #
115
+ # # disable max attempts
116
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
117
+ #
118
+ # ## Handling Errors
119
+ #
120
+ # When a waiter is successful, it returns the Resource. When a waiter
121
+ # fails, it raises an error.
122
+ #
123
+ # begin
124
+ # resource.wait_until(...)
125
+ # rescue Aws::Waiters::Errors::WaiterFailed
126
+ # # resource did not enter the desired state in time
127
+ # end
128
+ #
129
+ #
130
+ # @yield param [Resource] resource to be used in the waiting condition
131
+ #
132
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
133
+ # because the waiter has entered a state that it will not transition
134
+ # out of, preventing success.
135
+ #
136
+ # yet successful.
137
+ #
138
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
139
+ # while polling for a resource that is not expected.
140
+ #
141
+ # @raise [NotImplementedError] Raised when the resource does not
142
+ #
143
+ # @option options [Integer] :max_attempts (10) Maximum number of
144
+ # attempts
145
+ # @option options [Integer] :delay (10) Delay between each
146
+ # attempt in seconds
147
+ # @option options [Proc] :before_attempt (nil) Callback
148
+ # invoked before each attempt
149
+ # @option options [Proc] :before_wait (nil) Callback
150
+ # invoked before each wait
151
+ # @return [Resource] if the waiter was successful
152
+ def wait_until(options = {}, &block)
153
+ self_copy = self.dup
154
+ attempts = 0
155
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
156
+ options[:delay] ||= 10
157
+ options[:poller] = Proc.new do
158
+ attempts += 1
159
+ if block.call(self_copy)
160
+ [:success, self_copy]
161
+ else
162
+ self_copy.reload unless attempts == options[:max_attempts]
163
+ :retry
164
+ end
165
+ end
166
+ Aws::Waiters::Waiter.new(options).wait({})
167
+ end
168
+
74
169
  # @!group Actions
75
170
 
76
171
  # @example Request syntax with placeholder values