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.
@@ -34,110 +34,110 @@ module Aws::EC2
34
34
  # The network interface attachment.
35
35
  # @return [Types::NetworkInterfaceAttachment]
36
36
  def attachment
37
- data.attachment
37
+ data[:attachment]
38
38
  end
39
39
 
40
40
  # The Availability Zone.
41
41
  # @return [String]
42
42
  def availability_zone
43
- data.availability_zone
43
+ data[:availability_zone]
44
44
  end
45
45
 
46
46
  # A description.
47
47
  # @return [String]
48
48
  def description
49
- data.description
49
+ data[:description]
50
50
  end
51
51
 
52
52
  # Any security groups for the network interface.
53
53
  # @return [Array<Types::GroupIdentifier>]
54
54
  def groups
55
- data.groups
55
+ data[:groups]
56
56
  end
57
57
 
58
58
  # The type of interface.
59
59
  # @return [String]
60
60
  def interface_type
61
- data.interface_type
61
+ data[:interface_type]
62
62
  end
63
63
 
64
64
  # The IPv6 addresses associated with the network interface.
65
65
  # @return [Array<Types::NetworkInterfaceIpv6Address>]
66
66
  def ipv_6_addresses
67
- data.ipv_6_addresses
67
+ data[:ipv_6_addresses]
68
68
  end
69
69
 
70
70
  # The MAC address.
71
71
  # @return [String]
72
72
  def mac_address
73
- data.mac_address
73
+ data[:mac_address]
74
74
  end
75
75
 
76
76
  # The AWS account ID of the owner of the network interface.
77
77
  # @return [String]
78
78
  def owner_id
79
- data.owner_id
79
+ data[:owner_id]
80
80
  end
81
81
 
82
82
  # The private DNS name.
83
83
  # @return [String]
84
84
  def private_dns_name
85
- data.private_dns_name
85
+ data[:private_dns_name]
86
86
  end
87
87
 
88
88
  # The IPv4 address of the network interface within the subnet.
89
89
  # @return [String]
90
90
  def private_ip_address
91
- data.private_ip_address
91
+ data[:private_ip_address]
92
92
  end
93
93
 
94
94
  # The private IPv4 addresses associated with the network interface.
95
95
  # @return [Array<Types::NetworkInterfacePrivateIpAddress>]
96
96
  def private_ip_addresses
97
- data.private_ip_addresses
97
+ data[:private_ip_addresses]
98
98
  end
99
99
 
100
100
  # The ID of the entity that launched the instance on your behalf (for
101
101
  # example, AWS Management Console or Auto Scaling).
102
102
  # @return [String]
103
103
  def requester_id
104
- data.requester_id
104
+ data[:requester_id]
105
105
  end
106
106
 
107
107
  # Indicates whether the network interface is being managed by AWS.
108
108
  # @return [Boolean]
109
109
  def requester_managed
110
- data.requester_managed
110
+ data[:requester_managed]
111
111
  end
112
112
 
113
113
  # Indicates whether traffic to or from the instance is validated.
114
114
  # @return [Boolean]
115
115
  def source_dest_check
116
- data.source_dest_check
116
+ data[:source_dest_check]
117
117
  end
118
118
 
119
119
  # The status of the network interface.
120
120
  # @return [String]
121
121
  def status
122
- data.status
122
+ data[:status]
123
123
  end
124
124
 
125
125
  # The ID of the subnet.
126
126
  # @return [String]
127
127
  def subnet_id
128
- data.subnet_id
128
+ data[:subnet_id]
129
129
  end
130
130
 
131
131
  # Any tags assigned to the network interface.
132
132
  # @return [Array<Types::Tag>]
133
133
  def tag_set
134
- data.tag_set
134
+ data[:tag_set]
135
135
  end
136
136
 
137
137
  # The ID of the VPC.
138
138
  # @return [String]
139
139
  def vpc_id
140
- data.vpc_id
140
+ data[:vpc_id]
141
141
  end
142
142
 
143
143
  # @!endgroup
@@ -175,6 +175,101 @@ module Aws::EC2
175
175
  !!@data
176
176
  end
177
177
 
178
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
179
+ #
180
+ # Waiter polls an API operation until a resource enters a desired
181
+ # state.
182
+ #
183
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
184
+ #
185
+ # ## Basic Usage
186
+ #
187
+ # Waiter will polls until it is successful, it fails by
188
+ # entering a terminal state, or until a maximum number of attempts
189
+ # are made.
190
+ #
191
+ # # polls in a loop until condition is true
192
+ # resource.wait_until(options) {|resource| condition}
193
+ #
194
+ # ## Example
195
+ #
196
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
197
+ #
198
+ # ## Configuration
199
+ #
200
+ # You can configure the maximum number of polling attempts, and the
201
+ # delay (in seconds) between each polling attempt. The waiting condition is set
202
+ # by passing a block to {#wait_until}:
203
+ #
204
+ # # poll for ~25 seconds
205
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
206
+ #
207
+ # ## Callbacks
208
+ #
209
+ # You can be notified before each polling attempt and before each
210
+ # delay. If you throw `:success` or `:failure` from these callbacks,
211
+ # it will terminate the waiter.
212
+ #
213
+ # started_at = Time.now
214
+ # # poll for 1 hour, instead of a number of attempts
215
+ # proc = Proc.new do |attempts, response|
216
+ # throw :failure if Time.now - started_at > 3600
217
+ # end
218
+ #
219
+ # # disable max attempts
220
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
221
+ #
222
+ # ## Handling Errors
223
+ #
224
+ # When a waiter is successful, it returns the Resource. When a waiter
225
+ # fails, it raises an error.
226
+ #
227
+ # begin
228
+ # resource.wait_until(...)
229
+ # rescue Aws::Waiters::Errors::WaiterFailed
230
+ # # resource did not enter the desired state in time
231
+ # end
232
+ #
233
+ #
234
+ # @yield param [Resource] resource to be used in the waiting condition
235
+ #
236
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
237
+ # because the waiter has entered a state that it will not transition
238
+ # out of, preventing success.
239
+ #
240
+ # yet successful.
241
+ #
242
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
243
+ # while polling for a resource that is not expected.
244
+ #
245
+ # @raise [NotImplementedError] Raised when the resource does not
246
+ #
247
+ # @option options [Integer] :max_attempts (10) Maximum number of
248
+ # attempts
249
+ # @option options [Integer] :delay (10) Delay between each
250
+ # attempt in seconds
251
+ # @option options [Proc] :before_attempt (nil) Callback
252
+ # invoked before each attempt
253
+ # @option options [Proc] :before_wait (nil) Callback
254
+ # invoked before each wait
255
+ # @return [Resource] if the waiter was successful
256
+ def wait_until(options = {}, &block)
257
+ self_copy = self.dup
258
+ attempts = 0
259
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
260
+ options[:delay] ||= 10
261
+ options[:poller] = Proc.new do
262
+ attempts += 1
263
+ if block.call(self_copy)
264
+ [:success, self_copy]
265
+ else
266
+ self_copy.reload unless attempts == options[:max_attempts]
267
+ :retry
268
+ end
269
+ end
270
+ Aws::Waiters::Waiter.new(options).wait({})
271
+ end
272
+
178
273
  # @!group Actions
179
274
 
180
275
  # @example Request syntax with placeholder values
@@ -323,7 +418,7 @@ module Aws::EC2
323
418
  # Specifies whether to force a detachment.
324
419
  # @return [EmptyStructure]
325
420
  def detach(options = {})
326
- options = options.merge(attachment_id: data.attachment.attachment_id)
421
+ options = options.merge(attachment_id: data[:attachment][:attachment_id])
327
422
  resp = @client.detach_network_interface(options)
328
423
  resp.data
329
424
  end
@@ -418,10 +513,10 @@ module Aws::EC2
418
513
 
419
514
  # @return [NetworkInterfaceAssociation, nil]
420
515
  def association
421
- if data.association.association_id
516
+ if data[:association][:association_id]
422
517
  NetworkInterfaceAssociation.new(
423
- id: data.association.association_id,
424
- data: data.association,
518
+ id: data[:association][:association_id],
519
+ data: data[:association],
425
520
  client: @client
426
521
  )
427
522
  else
@@ -431,9 +526,9 @@ module Aws::EC2
431
526
 
432
527
  # @return [Subnet, nil]
433
528
  def subnet
434
- if data.subnet_id
529
+ if data[:subnet_id]
435
530
  Subnet.new(
436
- id: data.subnet_id,
531
+ id: data[:subnet_id],
437
532
  client: @client
438
533
  )
439
534
  else
@@ -443,9 +538,9 @@ module Aws::EC2
443
538
 
444
539
  # @return [Vpc, nil]
445
540
  def vpc
446
- if data.vpc_id
541
+ if data[:vpc_id]
447
542
  Vpc.new(
448
- id: data.vpc_id,
543
+ id: data[:vpc_id],
449
544
  client: @client
450
545
  )
451
546
  else
@@ -33,20 +33,20 @@ module Aws::EC2
33
33
  # The ID of the owner of the Elastic IP address.
34
34
  # @return [String]
35
35
  def ip_owner_id
36
- data.ip_owner_id
36
+ data[:ip_owner_id]
37
37
  end
38
38
 
39
39
  # The public DNS name.
40
40
  # @return [String]
41
41
  def public_dns_name
42
- data.public_dns_name
42
+ data[:public_dns_name]
43
43
  end
44
44
 
45
45
  # The public IP address or Elastic IP address bound to the network
46
46
  # interface.
47
47
  # @return [String]
48
48
  def public_ip
49
- data.public_ip
49
+ data[:public_ip]
50
50
  end
51
51
 
52
52
  # @!endgroup
@@ -87,6 +87,101 @@ module Aws::EC2
87
87
  !!@data
88
88
  end
89
89
 
90
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
91
+ #
92
+ # Waiter polls an API operation until a resource enters a desired
93
+ # state.
94
+ #
95
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
96
+ #
97
+ # ## Basic Usage
98
+ #
99
+ # Waiter will polls until it is successful, it fails by
100
+ # entering a terminal state, or until a maximum number of attempts
101
+ # are made.
102
+ #
103
+ # # polls in a loop until condition is true
104
+ # resource.wait_until(options) {|resource| condition}
105
+ #
106
+ # ## Example
107
+ #
108
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
109
+ #
110
+ # ## Configuration
111
+ #
112
+ # You can configure the maximum number of polling attempts, and the
113
+ # delay (in seconds) between each polling attempt. The waiting condition is set
114
+ # by passing a block to {#wait_until}:
115
+ #
116
+ # # poll for ~25 seconds
117
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
118
+ #
119
+ # ## Callbacks
120
+ #
121
+ # You can be notified before each polling attempt and before each
122
+ # delay. If you throw `:success` or `:failure` from these callbacks,
123
+ # it will terminate the waiter.
124
+ #
125
+ # started_at = Time.now
126
+ # # poll for 1 hour, instead of a number of attempts
127
+ # proc = Proc.new do |attempts, response|
128
+ # throw :failure if Time.now - started_at > 3600
129
+ # end
130
+ #
131
+ # # disable max attempts
132
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
133
+ #
134
+ # ## Handling Errors
135
+ #
136
+ # When a waiter is successful, it returns the Resource. When a waiter
137
+ # fails, it raises an error.
138
+ #
139
+ # begin
140
+ # resource.wait_until(...)
141
+ # rescue Aws::Waiters::Errors::WaiterFailed
142
+ # # resource did not enter the desired state in time
143
+ # end
144
+ #
145
+ #
146
+ # @yield param [Resource] resource to be used in the waiting condition
147
+ #
148
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
149
+ # because the waiter has entered a state that it will not transition
150
+ # out of, preventing success.
151
+ #
152
+ # yet successful.
153
+ #
154
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
155
+ # while polling for a resource that is not expected.
156
+ #
157
+ # @raise [NotImplementedError] Raised when the resource does not
158
+ #
159
+ # @option options [Integer] :max_attempts (10) Maximum number of
160
+ # attempts
161
+ # @option options [Integer] :delay (10) Delay between each
162
+ # attempt in seconds
163
+ # @option options [Proc] :before_attempt (nil) Callback
164
+ # invoked before each attempt
165
+ # @option options [Proc] :before_wait (nil) Callback
166
+ # invoked before each wait
167
+ # @return [Resource] if the waiter was successful
168
+ def wait_until(options = {}, &block)
169
+ self_copy = self.dup
170
+ attempts = 0
171
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
172
+ options[:delay] ||= 10
173
+ options[:poller] = Proc.new do
174
+ attempts += 1
175
+ if block.call(self_copy)
176
+ [:success, self_copy]
177
+ else
178
+ self_copy.reload unless attempts == options[:max_attempts]
179
+ :retry
180
+ end
181
+ end
182
+ Aws::Waiters::Waiter.new(options).wait({})
183
+ end
184
+
90
185
  # @!group Actions
91
186
 
92
187
  # @example Request syntax with placeholder values
@@ -114,9 +209,9 @@ module Aws::EC2
114
209
 
115
210
  # @return [VpcAddress, nil]
116
211
  def address
117
- if data.allocation_id
212
+ if data[:allocation_id]
118
213
  VpcAddress.new(
119
- allocation_id: data.allocation_id,
214
+ allocation_id: data[:allocation_id],
120
215
  client: @client
121
216
  )
122
217
  else
@@ -34,13 +34,13 @@ module Aws::EC2
34
34
  # The state of the placement group.
35
35
  # @return [String]
36
36
  def state
37
- data.state
37
+ data[:state]
38
38
  end
39
39
 
40
40
  # The placement strategy.
41
41
  # @return [String]
42
42
  def strategy
43
- data.strategy
43
+ data[:strategy]
44
44
  end
45
45
 
46
46
  # @!endgroup
@@ -78,6 +78,101 @@ module Aws::EC2
78
78
  !!@data
79
79
  end
80
80
 
81
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
82
+ #
83
+ # Waiter polls an API operation until a resource enters a desired
84
+ # state.
85
+ #
86
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
87
+ #
88
+ # ## Basic Usage
89
+ #
90
+ # Waiter will polls until it is successful, it fails by
91
+ # entering a terminal state, or until a maximum number of attempts
92
+ # are made.
93
+ #
94
+ # # polls in a loop until condition is true
95
+ # resource.wait_until(options) {|resource| condition}
96
+ #
97
+ # ## Example
98
+ #
99
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
100
+ #
101
+ # ## Configuration
102
+ #
103
+ # You can configure the maximum number of polling attempts, and the
104
+ # delay (in seconds) between each polling attempt. The waiting condition is set
105
+ # by passing a block to {#wait_until}:
106
+ #
107
+ # # poll for ~25 seconds
108
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
109
+ #
110
+ # ## Callbacks
111
+ #
112
+ # You can be notified before each polling attempt and before each
113
+ # delay. If you throw `:success` or `:failure` from these callbacks,
114
+ # it will terminate the waiter.
115
+ #
116
+ # started_at = Time.now
117
+ # # poll for 1 hour, instead of a number of attempts
118
+ # proc = Proc.new do |attempts, response|
119
+ # throw :failure if Time.now - started_at > 3600
120
+ # end
121
+ #
122
+ # # disable max attempts
123
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
124
+ #
125
+ # ## Handling Errors
126
+ #
127
+ # When a waiter is successful, it returns the Resource. When a waiter
128
+ # fails, it raises an error.
129
+ #
130
+ # begin
131
+ # resource.wait_until(...)
132
+ # rescue Aws::Waiters::Errors::WaiterFailed
133
+ # # resource did not enter the desired state in time
134
+ # end
135
+ #
136
+ #
137
+ # @yield param [Resource] resource to be used in the waiting condition
138
+ #
139
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
140
+ # because the waiter has entered a state that it will not transition
141
+ # out of, preventing success.
142
+ #
143
+ # yet successful.
144
+ #
145
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
146
+ # while polling for a resource that is not expected.
147
+ #
148
+ # @raise [NotImplementedError] Raised when the resource does not
149
+ #
150
+ # @option options [Integer] :max_attempts (10) Maximum number of
151
+ # attempts
152
+ # @option options [Integer] :delay (10) Delay between each
153
+ # attempt in seconds
154
+ # @option options [Proc] :before_attempt (nil) Callback
155
+ # invoked before each attempt
156
+ # @option options [Proc] :before_wait (nil) Callback
157
+ # invoked before each wait
158
+ # @return [Resource] if the waiter was successful
159
+ def wait_until(options = {}, &block)
160
+ self_copy = self.dup
161
+ attempts = 0
162
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
163
+ options[:delay] ||= 10
164
+ options[:poller] = Proc.new do
165
+ attempts += 1
166
+ if block.call(self_copy)
167
+ [:success, self_copy]
168
+ else
169
+ self_copy.reload unless attempts == options[:max_attempts]
170
+ :retry
171
+ end
172
+ end
173
+ Aws::Waiters::Waiter.new(options).wait({})
174
+ end
175
+
81
176
  # @!group Actions
82
177
 
83
178
  # @example Request syntax with placeholder values