aws-sdk-ec2 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,45 +33,45 @@ module Aws::EC2
33
33
  # The ID of the instance that the address is associated with (if any).
34
34
  # @return [String]
35
35
  def instance_id
36
- data.instance_id
36
+ data[:instance_id]
37
37
  end
38
38
 
39
39
  # The Elastic IP address.
40
40
  # @return [String]
41
41
  def public_ip
42
- data.public_ip
42
+ data[:public_ip]
43
43
  end
44
44
 
45
45
  # The ID representing the association of the address with an instance in
46
46
  # a VPC.
47
47
  # @return [String]
48
48
  def association_id
49
- data.association_id
49
+ data[:association_id]
50
50
  end
51
51
 
52
52
  # Indicates whether this Elastic IP address is for use with instances in
53
53
  # EC2-Classic (`standard`) or instances in a VPC (`vpc`).
54
54
  # @return [String]
55
55
  def domain
56
- data.domain
56
+ data[:domain]
57
57
  end
58
58
 
59
59
  # The ID of the network interface.
60
60
  # @return [String]
61
61
  def network_interface_id
62
- data.network_interface_id
62
+ data[:network_interface_id]
63
63
  end
64
64
 
65
65
  # The ID of the AWS account that owns the network interface.
66
66
  # @return [String]
67
67
  def network_interface_owner_id
68
- data.network_interface_owner_id
68
+ data[:network_interface_owner_id]
69
69
  end
70
70
 
71
71
  # The private IP address associated with the Elastic IP address.
72
72
  # @return [String]
73
73
  def private_ip_address
74
- data.private_ip_address
74
+ data[:private_ip_address]
75
75
  end
76
76
 
77
77
  # @!endgroup
@@ -109,6 +109,101 @@ module Aws::EC2
109
109
  !!@data
110
110
  end
111
111
 
112
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
113
+ #
114
+ # Waiter polls an API operation until a resource enters a desired
115
+ # state.
116
+ #
117
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
118
+ #
119
+ # ## Basic Usage
120
+ #
121
+ # Waiter will polls until it is successful, it fails by
122
+ # entering a terminal state, or until a maximum number of attempts
123
+ # are made.
124
+ #
125
+ # # polls in a loop until condition is true
126
+ # resource.wait_until(options) {|resource| condition}
127
+ #
128
+ # ## Example
129
+ #
130
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
131
+ #
132
+ # ## Configuration
133
+ #
134
+ # You can configure the maximum number of polling attempts, and the
135
+ # delay (in seconds) between each polling attempt. The waiting condition is set
136
+ # by passing a block to {#wait_until}:
137
+ #
138
+ # # poll for ~25 seconds
139
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
140
+ #
141
+ # ## Callbacks
142
+ #
143
+ # You can be notified before each polling attempt and before each
144
+ # delay. If you throw `:success` or `:failure` from these callbacks,
145
+ # it will terminate the waiter.
146
+ #
147
+ # started_at = Time.now
148
+ # # poll for 1 hour, instead of a number of attempts
149
+ # proc = Proc.new do |attempts, response|
150
+ # throw :failure if Time.now - started_at > 3600
151
+ # end
152
+ #
153
+ # # disable max attempts
154
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
155
+ #
156
+ # ## Handling Errors
157
+ #
158
+ # When a waiter is successful, it returns the Resource. When a waiter
159
+ # fails, it raises an error.
160
+ #
161
+ # begin
162
+ # resource.wait_until(...)
163
+ # rescue Aws::Waiters::Errors::WaiterFailed
164
+ # # resource did not enter the desired state in time
165
+ # end
166
+ #
167
+ #
168
+ # @yield param [Resource] resource to be used in the waiting condition
169
+ #
170
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
171
+ # because the waiter has entered a state that it will not transition
172
+ # out of, preventing success.
173
+ #
174
+ # yet successful.
175
+ #
176
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
177
+ # while polling for a resource that is not expected.
178
+ #
179
+ # @raise [NotImplementedError] Raised when the resource does not
180
+ #
181
+ # @option options [Integer] :max_attempts (10) Maximum number of
182
+ # attempts
183
+ # @option options [Integer] :delay (10) Delay between each
184
+ # attempt in seconds
185
+ # @option options [Proc] :before_attempt (nil) Callback
186
+ # invoked before each attempt
187
+ # @option options [Proc] :before_wait (nil) Callback
188
+ # invoked before each wait
189
+ # @return [Resource] if the waiter was successful
190
+ def wait_until(options = {}, &block)
191
+ self_copy = self.dup
192
+ attempts = 0
193
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
194
+ options[:delay] ||= 10
195
+ options[:poller] = Proc.new do
196
+ attempts += 1
197
+ if block.call(self_copy)
198
+ [:success, self_copy]
199
+ else
200
+ self_copy.reload unless attempts == options[:max_attempts]
201
+ :retry
202
+ end
203
+ end
204
+ Aws::Waiters::Waiter.new(options).wait({})
205
+ end
206
+
112
207
  # @!group Actions
113
208
 
114
209
  # @example Request syntax with placeholder values
@@ -173,7 +268,7 @@ module Aws::EC2
173
268
  # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
174
269
  # @return [EmptyStructure]
175
270
  def release(options = {})
176
- options = options.merge(allocation_id: data.allocation_id)
271
+ options = options.merge(allocation_id: data[:allocation_id])
177
272
  resp = @client.release_address(options)
178
273
  resp.data
179
274
  end
@@ -182,9 +277,9 @@ module Aws::EC2
182
277
 
183
278
  # @return [NetworkInterfaceAssociation, nil]
184
279
  def association
185
- if data.association_id
280
+ if data[:association_id]
186
281
  NetworkInterfaceAssociation.new(
187
- id: data.association_id,
282
+ id: data[:association_id],
188
283
  client: @client
189
284
  )
190
285
  else
@@ -35,32 +35,32 @@ module Aws::EC2
35
35
  # returned when describing an active VPC peering connection.
36
36
  # @return [Types::VpcPeeringConnectionVpcInfo]
37
37
  def accepter_vpc_info
38
- data.accepter_vpc_info
38
+ data[:accepter_vpc_info]
39
39
  end
40
40
 
41
41
  # The time that an unaccepted VPC peering connection will expire.
42
42
  # @return [Time]
43
43
  def expiration_time
44
- data.expiration_time
44
+ data[:expiration_time]
45
45
  end
46
46
 
47
47
  # Information about the requester VPC. CIDR block information is only
48
48
  # returned when describing an active VPC peering connection.
49
49
  # @return [Types::VpcPeeringConnectionVpcInfo]
50
50
  def requester_vpc_info
51
- data.requester_vpc_info
51
+ data[:requester_vpc_info]
52
52
  end
53
53
 
54
54
  # The status of the VPC peering connection.
55
55
  # @return [Types::VpcPeeringConnectionStateReason]
56
56
  def status
57
- data.status
57
+ data[:status]
58
58
  end
59
59
 
60
60
  # Any tags assigned to the resource.
61
61
  # @return [Array<Types::Tag>]
62
62
  def tags
63
- data.tags
63
+ data[:tags]
64
64
  end
65
65
 
66
66
  # @!endgroup
@@ -130,6 +130,101 @@ module Aws::EC2
130
130
  })
131
131
  end
132
132
 
133
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
134
+ #
135
+ # Waiter polls an API operation until a resource enters a desired
136
+ # state.
137
+ #
138
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
139
+ #
140
+ # ## Basic Usage
141
+ #
142
+ # Waiter will polls until it is successful, it fails by
143
+ # entering a terminal state, or until a maximum number of attempts
144
+ # are made.
145
+ #
146
+ # # polls in a loop until condition is true
147
+ # resource.wait_until(options) {|resource| condition}
148
+ #
149
+ # ## Example
150
+ #
151
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
152
+ #
153
+ # ## Configuration
154
+ #
155
+ # You can configure the maximum number of polling attempts, and the
156
+ # delay (in seconds) between each polling attempt. The waiting condition is set
157
+ # by passing a block to {#wait_until}:
158
+ #
159
+ # # poll for ~25 seconds
160
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
161
+ #
162
+ # ## Callbacks
163
+ #
164
+ # You can be notified before each polling attempt and before each
165
+ # delay. If you throw `:success` or `:failure` from these callbacks,
166
+ # it will terminate the waiter.
167
+ #
168
+ # started_at = Time.now
169
+ # # poll for 1 hour, instead of a number of attempts
170
+ # proc = Proc.new do |attempts, response|
171
+ # throw :failure if Time.now - started_at > 3600
172
+ # end
173
+ #
174
+ # # disable max attempts
175
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
176
+ #
177
+ # ## Handling Errors
178
+ #
179
+ # When a waiter is successful, it returns the Resource. When a waiter
180
+ # fails, it raises an error.
181
+ #
182
+ # begin
183
+ # resource.wait_until(...)
184
+ # rescue Aws::Waiters::Errors::WaiterFailed
185
+ # # resource did not enter the desired state in time
186
+ # end
187
+ #
188
+ #
189
+ # @yield param [Resource] resource to be used in the waiting condition
190
+ #
191
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
192
+ # because the waiter has entered a state that it will not transition
193
+ # out of, preventing success.
194
+ #
195
+ # yet successful.
196
+ #
197
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
198
+ # while polling for a resource that is not expected.
199
+ #
200
+ # @raise [NotImplementedError] Raised when the resource does not
201
+ #
202
+ # @option options [Integer] :max_attempts (10) Maximum number of
203
+ # attempts
204
+ # @option options [Integer] :delay (10) Delay between each
205
+ # attempt in seconds
206
+ # @option options [Proc] :before_attempt (nil) Callback
207
+ # invoked before each attempt
208
+ # @option options [Proc] :before_wait (nil) Callback
209
+ # invoked before each wait
210
+ # @return [Resource] if the waiter was successful
211
+ def wait_until(options = {}, &block)
212
+ self_copy = self.dup
213
+ attempts = 0
214
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
215
+ options[:delay] ||= 10
216
+ options[:poller] = Proc.new do
217
+ attempts += 1
218
+ if block.call(self_copy)
219
+ [:success, self_copy]
220
+ else
221
+ self_copy.reload unless attempts == options[:max_attempts]
222
+ :retry
223
+ end
224
+ end
225
+ Aws::Waiters::Waiter.new(options).wait({})
226
+ end
227
+
133
228
  # @!group Actions
134
229
 
135
230
  # @example Request syntax with placeholder values
@@ -190,9 +285,9 @@ module Aws::EC2
190
285
 
191
286
  # @return [Vpc, nil]
192
287
  def accepter_vpc
193
- if data.accepter_vpc_info.vpc_id
288
+ if data[:accepter_vpc_info][:vpc_id]
194
289
  Vpc.new(
195
- id: data.accepter_vpc_info.vpc_id,
290
+ id: data[:accepter_vpc_info][:vpc_id],
196
291
  client: @client
197
292
  )
198
293
  else
@@ -202,9 +297,9 @@ module Aws::EC2
202
297
 
203
298
  # @return [Vpc, nil]
204
299
  def requester_vpc
205
- if data.requester_vpc_info.vpc_id
300
+ if data[:requester_vpc_info][:vpc_id]
206
301
  Vpc.new(
207
- id: data.requester_vpc_info.vpc_id,
302
+ id: data[:requester_vpc_info][:vpc_id],
208
303
  client: @client
209
304
  )
210
305
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sigv4