aws-sdk-ec2 1.5.0 → 1.6.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.
@@ -41,49 +41,49 @@ module Aws::EC2
41
41
  # The IPv6 CIDR block used for the destination match.
42
42
  # @return [String]
43
43
  def destination_ipv_6_cidr_block
44
- data.destination_ipv_6_cidr_block
44
+ data[:destination_ipv_6_cidr_block]
45
45
  end
46
46
 
47
47
  # The prefix of the AWS service.
48
48
  # @return [String]
49
49
  def destination_prefix_list_id
50
- data.destination_prefix_list_id
50
+ data[:destination_prefix_list_id]
51
51
  end
52
52
 
53
53
  # The ID of the egress-only Internet gateway.
54
54
  # @return [String]
55
55
  def egress_only_internet_gateway_id
56
- data.egress_only_internet_gateway_id
56
+ data[:egress_only_internet_gateway_id]
57
57
  end
58
58
 
59
59
  # The ID of a gateway attached to your VPC.
60
60
  # @return [String]
61
61
  def gateway_id
62
- data.gateway_id
62
+ data[:gateway_id]
63
63
  end
64
64
 
65
65
  # The ID of a NAT instance in your VPC.
66
66
  # @return [String]
67
67
  def instance_id
68
- data.instance_id
68
+ data[:instance_id]
69
69
  end
70
70
 
71
71
  # The AWS account ID of the owner of the instance.
72
72
  # @return [String]
73
73
  def instance_owner_id
74
- data.instance_owner_id
74
+ data[:instance_owner_id]
75
75
  end
76
76
 
77
77
  # The ID of a NAT gateway.
78
78
  # @return [String]
79
79
  def nat_gateway_id
80
- data.nat_gateway_id
80
+ data[:nat_gateway_id]
81
81
  end
82
82
 
83
83
  # The ID of the network interface.
84
84
  # @return [String]
85
85
  def network_interface_id
86
- data.network_interface_id
86
+ data[:network_interface_id]
87
87
  end
88
88
 
89
89
  # Describes how the route was created.
@@ -97,7 +97,7 @@ module Aws::EC2
97
97
  # propagation.
98
98
  # @return [String]
99
99
  def origin
100
- data.origin
100
+ data[:origin]
101
101
  end
102
102
 
103
103
  # The state of the route. The `blackhole` state indicates that the
@@ -106,13 +106,13 @@ module Aws::EC2
106
106
  # terminated).
107
107
  # @return [String]
108
108
  def state
109
- data.state
109
+ data[:state]
110
110
  end
111
111
 
112
112
  # The ID of the VPC peering connection.
113
113
  # @return [String]
114
114
  def vpc_peering_connection_id
115
- data.vpc_peering_connection_id
115
+ data[:vpc_peering_connection_id]
116
116
  end
117
117
 
118
118
  # @!endgroup
@@ -145,6 +145,101 @@ module Aws::EC2
145
145
  !!@data
146
146
  end
147
147
 
148
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
149
+ #
150
+ # Waiter polls an API operation until a resource enters a desired
151
+ # state.
152
+ #
153
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
154
+ #
155
+ # ## Basic Usage
156
+ #
157
+ # Waiter will polls until it is successful, it fails by
158
+ # entering a terminal state, or until a maximum number of attempts
159
+ # are made.
160
+ #
161
+ # # polls in a loop until condition is true
162
+ # resource.wait_until(options) {|resource| condition}
163
+ #
164
+ # ## Example
165
+ #
166
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
167
+ #
168
+ # ## Configuration
169
+ #
170
+ # You can configure the maximum number of polling attempts, and the
171
+ # delay (in seconds) between each polling attempt. The waiting condition is set
172
+ # by passing a block to {#wait_until}:
173
+ #
174
+ # # poll for ~25 seconds
175
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
176
+ #
177
+ # ## Callbacks
178
+ #
179
+ # You can be notified before each polling attempt and before each
180
+ # delay. If you throw `:success` or `:failure` from these callbacks,
181
+ # it will terminate the waiter.
182
+ #
183
+ # started_at = Time.now
184
+ # # poll for 1 hour, instead of a number of attempts
185
+ # proc = Proc.new do |attempts, response|
186
+ # throw :failure if Time.now - started_at > 3600
187
+ # end
188
+ #
189
+ # # disable max attempts
190
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
191
+ #
192
+ # ## Handling Errors
193
+ #
194
+ # When a waiter is successful, it returns the Resource. When a waiter
195
+ # fails, it raises an error.
196
+ #
197
+ # begin
198
+ # resource.wait_until(...)
199
+ # rescue Aws::Waiters::Errors::WaiterFailed
200
+ # # resource did not enter the desired state in time
201
+ # end
202
+ #
203
+ #
204
+ # @yield param [Resource] resource to be used in the waiting condition
205
+ #
206
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
207
+ # because the waiter has entered a state that it will not transition
208
+ # out of, preventing success.
209
+ #
210
+ # yet successful.
211
+ #
212
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
213
+ # while polling for a resource that is not expected.
214
+ #
215
+ # @raise [NotImplementedError] Raised when the resource does not
216
+ #
217
+ # @option options [Integer] :max_attempts (10) Maximum number of
218
+ # attempts
219
+ # @option options [Integer] :delay (10) Delay between each
220
+ # attempt in seconds
221
+ # @option options [Proc] :before_attempt (nil) Callback
222
+ # invoked before each attempt
223
+ # @option options [Proc] :before_wait (nil) Callback
224
+ # invoked before each wait
225
+ # @return [Resource] if the waiter was successful
226
+ def wait_until(options = {}, &block)
227
+ self_copy = self.dup
228
+ attempts = 0
229
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
230
+ options[:delay] ||= 10
231
+ options[:poller] = Proc.new do
232
+ attempts += 1
233
+ if block.call(self_copy)
234
+ [:success, self_copy]
235
+ else
236
+ self_copy.reload unless attempts == options[:max_attempts]
237
+ :retry
238
+ end
239
+ end
240
+ Aws::Waiters::Waiter.new(options).wait({})
241
+ end
242
+
148
243
  # @!group Actions
149
244
 
150
245
  # @example Request syntax with placeholder values
@@ -34,19 +34,19 @@ module Aws::EC2
34
34
  # Any virtual private gateway (VGW) propagating routes.
35
35
  # @return [Array<Types::PropagatingVgw>]
36
36
  def propagating_vgws
37
- data.propagating_vgws
37
+ data[:propagating_vgws]
38
38
  end
39
39
 
40
40
  # Any tags assigned to the route table.
41
41
  # @return [Array<Types::Tag>]
42
42
  def tags
43
- data.tags
43
+ data[:tags]
44
44
  end
45
45
 
46
46
  # The ID of the VPC.
47
47
  # @return [String]
48
48
  def vpc_id
49
- data.vpc_id
49
+ data[:vpc_id]
50
50
  end
51
51
 
52
52
  # @!endgroup
@@ -84,6 +84,101 @@ module Aws::EC2
84
84
  !!@data
85
85
  end
86
86
 
87
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
88
+ #
89
+ # Waiter polls an API operation until a resource enters a desired
90
+ # state.
91
+ #
92
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
93
+ #
94
+ # ## Basic Usage
95
+ #
96
+ # Waiter will polls until it is successful, it fails by
97
+ # entering a terminal state, or until a maximum number of attempts
98
+ # are made.
99
+ #
100
+ # # polls in a loop until condition is true
101
+ # resource.wait_until(options) {|resource| condition}
102
+ #
103
+ # ## Example
104
+ #
105
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
106
+ #
107
+ # ## Configuration
108
+ #
109
+ # You can configure the maximum number of polling attempts, and the
110
+ # delay (in seconds) between each polling attempt. The waiting condition is set
111
+ # by passing a block to {#wait_until}:
112
+ #
113
+ # # poll for ~25 seconds
114
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
115
+ #
116
+ # ## Callbacks
117
+ #
118
+ # You can be notified before each polling attempt and before each
119
+ # delay. If you throw `:success` or `:failure` from these callbacks,
120
+ # it will terminate the waiter.
121
+ #
122
+ # started_at = Time.now
123
+ # # poll for 1 hour, instead of a number of attempts
124
+ # proc = Proc.new do |attempts, response|
125
+ # throw :failure if Time.now - started_at > 3600
126
+ # end
127
+ #
128
+ # # disable max attempts
129
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
130
+ #
131
+ # ## Handling Errors
132
+ #
133
+ # When a waiter is successful, it returns the Resource. When a waiter
134
+ # fails, it raises an error.
135
+ #
136
+ # begin
137
+ # resource.wait_until(...)
138
+ # rescue Aws::Waiters::Errors::WaiterFailed
139
+ # # resource did not enter the desired state in time
140
+ # end
141
+ #
142
+ #
143
+ # @yield param [Resource] resource to be used in the waiting condition
144
+ #
145
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
146
+ # because the waiter has entered a state that it will not transition
147
+ # out of, preventing success.
148
+ #
149
+ # yet successful.
150
+ #
151
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
152
+ # while polling for a resource that is not expected.
153
+ #
154
+ # @raise [NotImplementedError] Raised when the resource does not
155
+ #
156
+ # @option options [Integer] :max_attempts (10) Maximum number of
157
+ # attempts
158
+ # @option options [Integer] :delay (10) Delay between each
159
+ # attempt in seconds
160
+ # @option options [Proc] :before_attempt (nil) Callback
161
+ # invoked before each attempt
162
+ # @option options [Proc] :before_wait (nil) Callback
163
+ # invoked before each wait
164
+ # @return [Resource] if the waiter was successful
165
+ def wait_until(options = {}, &block)
166
+ self_copy = self.dup
167
+ attempts = 0
168
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
169
+ options[:delay] ||= 10
170
+ options[:poller] = Proc.new do
171
+ attempts += 1
172
+ if block.call(self_copy)
173
+ [:success, self_copy]
174
+ else
175
+ self_copy.reload unless attempts == options[:max_attempts]
176
+ :retry
177
+ end
178
+ end
179
+ Aws::Waiters::Waiter.new(options).wait({})
180
+ end
181
+
87
182
  # @!group Actions
88
183
 
89
184
  # @example Request syntax with placeholder values
@@ -221,10 +316,10 @@ module Aws::EC2
221
316
  # @return [RouteTableAssociation::Collection]
222
317
  def associations
223
318
  batch = []
224
- data.associations.each do |a|
319
+ data[:associations].each do |d|
225
320
  batch << RouteTableAssociation.new(
226
- id: a.route_table_association_id,
227
- data: a,
321
+ id: d[:route_table_association_id],
322
+ data: d,
228
323
  client: @client
229
324
  )
230
325
  end
@@ -234,11 +329,11 @@ module Aws::EC2
234
329
  # @return [Route::Collection]
235
330
  def routes
236
331
  batch = []
237
- data.routes.each do |r|
332
+ data[:routes].each do |d|
238
333
  batch << Route.new(
239
334
  route_table_id: @id,
240
- destination_cidr_block: r.destination_cidr_block,
241
- data: r,
335
+ destination_cidr_block: d[:destination_cidr_block],
336
+ data: d,
242
337
  client: @client
243
338
  )
244
339
  end
@@ -247,9 +342,9 @@ module Aws::EC2
247
342
 
248
343
  # @return [Vpc, nil]
249
344
  def vpc
250
- if data.vpc_id
345
+ if data[:vpc_id]
251
346
  Vpc.new(
252
- id: data.vpc_id,
347
+ id: data[:vpc_id],
253
348
  client: @client
254
349
  )
255
350
  else
@@ -34,20 +34,20 @@ module Aws::EC2
34
34
  # Indicates whether this is the main route table.
35
35
  # @return [Boolean]
36
36
  def main
37
- data.main
37
+ data[:main]
38
38
  end
39
39
 
40
40
  # The ID of the route table.
41
41
  # @return [String]
42
42
  def route_table_id
43
- data.route_table_id
43
+ data[:route_table_id]
44
44
  end
45
45
 
46
46
  # The ID of the subnet. A subnet ID is not returned for an implicit
47
47
  # association.
48
48
  # @return [String]
49
49
  def subnet_id
50
- data.subnet_id
50
+ data[:subnet_id]
51
51
  end
52
52
 
53
53
  # @!endgroup
@@ -80,6 +80,101 @@ module Aws::EC2
80
80
  !!@data
81
81
  end
82
82
 
83
+ # @deprecated Use [Aws::EC2::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
@@ -128,9 +223,9 @@ module Aws::EC2
128
223
 
129
224
  # @return [RouteTable, nil]
130
225
  def route_table
131
- if data.route_table_id
226
+ if data[:route_table_id]
132
227
  RouteTable.new(
133
- id: data.route_table_id,
228
+ id: data[:route_table_id],
134
229
  client: @client
135
230
  )
136
231
  else
@@ -140,9 +235,9 @@ module Aws::EC2
140
235
 
141
236
  # @return [Subnet, nil]
142
237
  def subnet
143
- if data.subnet_id
238
+ if data[:subnet_id]
144
239
  Subnet.new(
145
- id: data.subnet_id,
240
+ id: data[:subnet_id],
146
241
  client: @client
147
242
  )
148
243
  else