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.
@@ -35,56 +35,56 @@ module Aws::EC2
35
35
  # launch group.
36
36
  # @return [Integer]
37
37
  def ami_launch_index
38
- data.ami_launch_index
38
+ data[:ami_launch_index]
39
39
  end
40
40
 
41
41
  # The ID of the AMI used to launch the instance.
42
42
  # @return [String]
43
43
  def image_id
44
- data.image_id
44
+ data[:image_id]
45
45
  end
46
46
 
47
47
  # The instance type.
48
48
  # @return [String]
49
49
  def instance_type
50
- data.instance_type
50
+ data[:instance_type]
51
51
  end
52
52
 
53
53
  # The kernel associated with this instance, if applicable.
54
54
  # @return [String]
55
55
  def kernel_id
56
- data.kernel_id
56
+ data[:kernel_id]
57
57
  end
58
58
 
59
59
  # The name of the key pair, if this instance was launched with an
60
60
  # associated key pair.
61
61
  # @return [String]
62
62
  def key_name
63
- data.key_name
63
+ data[:key_name]
64
64
  end
65
65
 
66
66
  # The time the instance was launched.
67
67
  # @return [Time]
68
68
  def launch_time
69
- data.launch_time
69
+ data[:launch_time]
70
70
  end
71
71
 
72
72
  # The monitoring for the instance.
73
73
  # @return [Types::Monitoring]
74
74
  def monitoring
75
- data.monitoring
75
+ data[:monitoring]
76
76
  end
77
77
 
78
78
  # The location where the instance launched, if applicable.
79
79
  # @return [Types::Placement]
80
80
  def placement
81
- data.placement
81
+ data[:placement]
82
82
  end
83
83
 
84
84
  # The value is `Windows` for Windows instances; otherwise blank.
85
85
  # @return [String]
86
86
  def platform
87
- data.platform
87
+ data[:platform]
88
88
  end
89
89
 
90
90
  # (IPv4 only) The private DNS hostname name assigned to the instance.
@@ -98,19 +98,19 @@ module Aws::EC2
98
98
  # servers must resolve the hostname as appropriate.
99
99
  # @return [String]
100
100
  def private_dns_name
101
- data.private_dns_name
101
+ data[:private_dns_name]
102
102
  end
103
103
 
104
104
  # The private IPv4 address assigned to the instance.
105
105
  # @return [String]
106
106
  def private_ip_address
107
- data.private_ip_address
107
+ data[:private_ip_address]
108
108
  end
109
109
 
110
110
  # The product codes attached to this instance, if applicable.
111
111
  # @return [Array<Types::ProductCode>]
112
112
  def product_codes
113
- data.product_codes
113
+ data[:product_codes]
114
114
  end
115
115
 
116
116
  # (IPv4 only) The public DNS name assigned to the instance. This name is
@@ -119,63 +119,63 @@ module Aws::EC2
119
119
  # for your VPC.
120
120
  # @return [String]
121
121
  def public_dns_name
122
- data.public_dns_name
122
+ data[:public_dns_name]
123
123
  end
124
124
 
125
125
  # The public IPv4 address assigned to the instance, if applicable.
126
126
  # @return [String]
127
127
  def public_ip_address
128
- data.public_ip_address
128
+ data[:public_ip_address]
129
129
  end
130
130
 
131
131
  # The RAM disk associated with this instance, if applicable.
132
132
  # @return [String]
133
133
  def ramdisk_id
134
- data.ramdisk_id
134
+ data[:ramdisk_id]
135
135
  end
136
136
 
137
137
  # The current state of the instance.
138
138
  # @return [Types::InstanceState]
139
139
  def state
140
- data.state
140
+ data[:state]
141
141
  end
142
142
 
143
143
  # The reason for the most recent state transition. This might be an
144
144
  # empty string.
145
145
  # @return [String]
146
146
  def state_transition_reason
147
- data.state_transition_reason
147
+ data[:state_transition_reason]
148
148
  end
149
149
 
150
150
  # \[EC2-VPC\] The ID of the subnet in which the instance is running.
151
151
  # @return [String]
152
152
  def subnet_id
153
- data.subnet_id
153
+ data[:subnet_id]
154
154
  end
155
155
 
156
156
  # \[EC2-VPC\] The ID of the VPC in which the instance is running.
157
157
  # @return [String]
158
158
  def vpc_id
159
- data.vpc_id
159
+ data[:vpc_id]
160
160
  end
161
161
 
162
162
  # The architecture of the image.
163
163
  # @return [String]
164
164
  def architecture
165
- data.architecture
165
+ data[:architecture]
166
166
  end
167
167
 
168
168
  # Any block device mapping entries for the instance.
169
169
  # @return [Array<Types::InstanceBlockDeviceMapping>]
170
170
  def block_device_mappings
171
- data.block_device_mappings
171
+ data[:block_device_mappings]
172
172
  end
173
173
 
174
174
  # The idempotency token you provided when you launched the instance, if
175
175
  # applicable.
176
176
  # @return [String]
177
177
  def client_token
178
- data.client_token
178
+ data[:client_token]
179
179
  end
180
180
 
181
181
  # Indicates whether the instance is optimized for EBS I/O. This
@@ -185,56 +185,56 @@ module Aws::EC2
185
185
  # usage charges apply when using an EBS Optimized instance.
186
186
  # @return [Boolean]
187
187
  def ebs_optimized
188
- data.ebs_optimized
188
+ data[:ebs_optimized]
189
189
  end
190
190
 
191
191
  # Specifies whether enhanced networking with ENA is enabled.
192
192
  # @return [Boolean]
193
193
  def ena_support
194
- data.ena_support
194
+ data[:ena_support]
195
195
  end
196
196
 
197
197
  # The hypervisor type of the instance.
198
198
  # @return [String]
199
199
  def hypervisor
200
- data.hypervisor
200
+ data[:hypervisor]
201
201
  end
202
202
 
203
203
  # The IAM instance profile associated with the instance, if applicable.
204
204
  # @return [Types::IamInstanceProfile]
205
205
  def iam_instance_profile
206
- data.iam_instance_profile
206
+ data[:iam_instance_profile]
207
207
  end
208
208
 
209
209
  # Indicates whether this is a Spot instance or a Scheduled Instance.
210
210
  # @return [String]
211
211
  def instance_lifecycle
212
- data.instance_lifecycle
212
+ data[:instance_lifecycle]
213
213
  end
214
214
 
215
215
  # The Elastic GPU associated with the instance.
216
216
  # @return [Array<Types::ElasticGpuAssociation>]
217
217
  def elastic_gpu_associations
218
- data.elastic_gpu_associations
218
+ data[:elastic_gpu_associations]
219
219
  end
220
220
 
221
221
  # The root device name (for example, `/dev/sda1` or `/dev/xvda`).
222
222
  # @return [String]
223
223
  def root_device_name
224
- data.root_device_name
224
+ data[:root_device_name]
225
225
  end
226
226
 
227
227
  # The root device type used by the AMI. The AMI can use an EBS volume or
228
228
  # an instance store volume.
229
229
  # @return [String]
230
230
  def root_device_type
231
- data.root_device_type
231
+ data[:root_device_type]
232
232
  end
233
233
 
234
234
  # One or more security groups for the instance.
235
235
  # @return [Array<Types::GroupIdentifier>]
236
236
  def security_groups
237
- data.security_groups
237
+ data[:security_groups]
238
238
  end
239
239
 
240
240
  # Specifies whether to enable an instance launched in a VPC to perform
@@ -249,38 +249,38 @@ module Aws::EC2
249
249
  # [1]: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html
250
250
  # @return [Boolean]
251
251
  def source_dest_check
252
- data.source_dest_check
252
+ data[:source_dest_check]
253
253
  end
254
254
 
255
255
  # If the request is a Spot instance request, the ID of the request.
256
256
  # @return [String]
257
257
  def spot_instance_request_id
258
- data.spot_instance_request_id
258
+ data[:spot_instance_request_id]
259
259
  end
260
260
 
261
261
  # Specifies whether enhanced networking with the Intel 82599 Virtual
262
262
  # Function interface is enabled.
263
263
  # @return [String]
264
264
  def sriov_net_support
265
- data.sriov_net_support
265
+ data[:sriov_net_support]
266
266
  end
267
267
 
268
268
  # The reason for the most recent state transition.
269
269
  # @return [Types::StateReason]
270
270
  def state_reason
271
- data.state_reason
271
+ data[:state_reason]
272
272
  end
273
273
 
274
274
  # Any tags assigned to the instance.
275
275
  # @return [Array<Types::Tag>]
276
276
  def tags
277
- data.tags
277
+ data[:tags]
278
278
  end
279
279
 
280
280
  # The virtualization type of the instance.
281
281
  # @return [String]
282
282
  def virtualization_type
283
- data.virtualization_type
283
+ data[:virtualization_type]
284
284
  end
285
285
 
286
286
  # @!endgroup
@@ -404,6 +404,101 @@ module Aws::EC2
404
404
  })
405
405
  end
406
406
 
407
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
408
+ #
409
+ # Waiter polls an API operation until a resource enters a desired
410
+ # state.
411
+ #
412
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
413
+ #
414
+ # ## Basic Usage
415
+ #
416
+ # Waiter will polls until it is successful, it fails by
417
+ # entering a terminal state, or until a maximum number of attempts
418
+ # are made.
419
+ #
420
+ # # polls in a loop until condition is true
421
+ # resource.wait_until(options) {|resource| condition}
422
+ #
423
+ # ## Example
424
+ #
425
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
426
+ #
427
+ # ## Configuration
428
+ #
429
+ # You can configure the maximum number of polling attempts, and the
430
+ # delay (in seconds) between each polling attempt. The waiting condition is set
431
+ # by passing a block to {#wait_until}:
432
+ #
433
+ # # poll for ~25 seconds
434
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
435
+ #
436
+ # ## Callbacks
437
+ #
438
+ # You can be notified before each polling attempt and before each
439
+ # delay. If you throw `:success` or `:failure` from these callbacks,
440
+ # it will terminate the waiter.
441
+ #
442
+ # started_at = Time.now
443
+ # # poll for 1 hour, instead of a number of attempts
444
+ # proc = Proc.new do |attempts, response|
445
+ # throw :failure if Time.now - started_at > 3600
446
+ # end
447
+ #
448
+ # # disable max attempts
449
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
450
+ #
451
+ # ## Handling Errors
452
+ #
453
+ # When a waiter is successful, it returns the Resource. When a waiter
454
+ # fails, it raises an error.
455
+ #
456
+ # begin
457
+ # resource.wait_until(...)
458
+ # rescue Aws::Waiters::Errors::WaiterFailed
459
+ # # resource did not enter the desired state in time
460
+ # end
461
+ #
462
+ #
463
+ # @yield param [Resource] resource to be used in the waiting condition
464
+ #
465
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
466
+ # because the waiter has entered a state that it will not transition
467
+ # out of, preventing success.
468
+ #
469
+ # yet successful.
470
+ #
471
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
472
+ # while polling for a resource that is not expected.
473
+ #
474
+ # @raise [NotImplementedError] Raised when the resource does not
475
+ #
476
+ # @option options [Integer] :max_attempts (10) Maximum number of
477
+ # attempts
478
+ # @option options [Integer] :delay (10) Delay between each
479
+ # attempt in seconds
480
+ # @option options [Proc] :before_attempt (nil) Callback
481
+ # invoked before each attempt
482
+ # @option options [Proc] :before_wait (nil) Callback
483
+ # invoked before each wait
484
+ # @return [Resource] if the waiter was successful
485
+ def wait_until(options = {}, &block)
486
+ self_copy = self.dup
487
+ attempts = 0
488
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
489
+ options[:delay] ||= 10
490
+ options[:poller] = Proc.new do
491
+ attempts += 1
492
+ if block.call(self_copy)
493
+ [:success, self_copy]
494
+ else
495
+ self_copy.reload unless attempts == options[:max_attempts]
496
+ :retry
497
+ end
498
+ end
499
+ Aws::Waiters::Waiter.new(options).wait({})
500
+ end
501
+
407
502
  # @!group Actions
408
503
 
409
504
  # @example Request syntax with placeholder values
@@ -1072,9 +1167,9 @@ module Aws::EC2
1072
1167
 
1073
1168
  # @return [ClassicAddress, nil]
1074
1169
  def classic_address
1075
- if data.public_ip_address
1170
+ if data[:public_ip_address]
1076
1171
  ClassicAddress.new(
1077
- public_ip: data.public_ip_address,
1172
+ public_ip: data[:public_ip_address],
1078
1173
  client: @client
1079
1174
  )
1080
1175
  else
@@ -1084,9 +1179,9 @@ module Aws::EC2
1084
1179
 
1085
1180
  # @return [Image, nil]
1086
1181
  def image
1087
- if data.image_id
1182
+ if data[:image_id]
1088
1183
  Image.new(
1089
- id: data.image_id,
1184
+ id: data[:image_id],
1090
1185
  client: @client
1091
1186
  )
1092
1187
  else
@@ -1096,9 +1191,9 @@ module Aws::EC2
1096
1191
 
1097
1192
  # @return [KeyPairInfo, nil]
1098
1193
  def key_pair
1099
- if data.key_name
1194
+ if data[:key_name]
1100
1195
  KeyPairInfo.new(
1101
- name: data.key_name,
1196
+ name: data[:key_name],
1102
1197
  client: @client
1103
1198
  )
1104
1199
  else
@@ -1109,10 +1204,10 @@ module Aws::EC2
1109
1204
  # @return [NetworkInterface::Collection]
1110
1205
  def network_interfaces
1111
1206
  batch = []
1112
- data.network_interfaces.each do |n|
1207
+ data[:network_interfaces].each do |d|
1113
1208
  batch << NetworkInterface.new(
1114
- id: n.network_interface_id,
1115
- data: n,
1209
+ id: d[:network_interface_id],
1210
+ data: d,
1116
1211
  client: @client
1117
1212
  )
1118
1213
  end
@@ -1121,9 +1216,9 @@ module Aws::EC2
1121
1216
 
1122
1217
  # @return [PlacementGroup, nil]
1123
1218
  def placement_group
1124
- if data.placement.group_name
1219
+ if data[:placement][:group_name]
1125
1220
  PlacementGroup.new(
1126
- name: data.placement.group_name,
1221
+ name: data[:placement][:group_name],
1127
1222
  client: @client
1128
1223
  )
1129
1224
  else
@@ -1133,9 +1228,9 @@ module Aws::EC2
1133
1228
 
1134
1229
  # @return [Subnet, nil]
1135
1230
  def subnet
1136
- if data.subnet_id
1231
+ if data[:subnet_id]
1137
1232
  Subnet.new(
1138
- id: data.subnet_id,
1233
+ id: data[:subnet_id],
1139
1234
  client: @client
1140
1235
  )
1141
1236
  else
@@ -1243,9 +1338,9 @@ module Aws::EC2
1243
1338
 
1244
1339
  # @return [Vpc, nil]
1245
1340
  def vpc
1246
- if data.vpc_id
1341
+ if data[:vpc_id]
1247
1342
  Vpc.new(
1248
- id: data.vpc_id,
1343
+ id: data[:vpc_id],
1249
1344
  client: @client
1250
1345
  )
1251
1346
  else