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.
@@ -34,44 +34,44 @@ module Aws::EC2
34
34
  # A description of the security group.
35
35
  # @return [String]
36
36
  def description
37
- data.description
37
+ data[:description]
38
38
  end
39
39
 
40
40
  # The name of the security group.
41
41
  # @return [String]
42
42
  def group_name
43
- data.group_name
43
+ data[:group_name]
44
44
  end
45
45
 
46
46
  # One or more inbound rules associated with the security group.
47
47
  # @return [Array<Types::IpPermission>]
48
48
  def ip_permissions
49
- data.ip_permissions
49
+ data[:ip_permissions]
50
50
  end
51
51
 
52
52
  # The AWS account ID of the owner of the security group.
53
53
  # @return [String]
54
54
  def owner_id
55
- data.owner_id
55
+ data[:owner_id]
56
56
  end
57
57
 
58
58
  # \[EC2-VPC\] One or more outbound rules associated with the security
59
59
  # group.
60
60
  # @return [Array<Types::IpPermission>]
61
61
  def ip_permissions_egress
62
- data.ip_permissions_egress
62
+ data[:ip_permissions_egress]
63
63
  end
64
64
 
65
65
  # Any tags assigned to the security group.
66
66
  # @return [Array<Types::Tag>]
67
67
  def tags
68
- data.tags
68
+ data[:tags]
69
69
  end
70
70
 
71
71
  # \[EC2-VPC\] The ID of the VPC for the security group.
72
72
  # @return [String]
73
73
  def vpc_id
74
- data.vpc_id
74
+ data[:vpc_id]
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
@@ -40,19 +40,19 @@ module Aws::EC2
40
40
  # parameter is only returned by the DescribeSnapshots API operation.
41
41
  # @return [String]
42
42
  def data_encryption_key_id
43
- data.data_encryption_key_id
43
+ data[:data_encryption_key_id]
44
44
  end
45
45
 
46
46
  # The description for the snapshot.
47
47
  # @return [String]
48
48
  def description
49
- data.description
49
+ data[:description]
50
50
  end
51
51
 
52
52
  # Indicates whether the snapshot is encrypted.
53
53
  # @return [Boolean]
54
54
  def encrypted
55
- data.encrypted
55
+ data[:encrypted]
56
56
  end
57
57
 
58
58
  # The full ARN of the AWS Key Management Service (AWS KMS) customer
@@ -60,31 +60,31 @@ module Aws::EC2
60
60
  # for the parent volume.
61
61
  # @return [String]
62
62
  def kms_key_id
63
- data.kms_key_id
63
+ data[:kms_key_id]
64
64
  end
65
65
 
66
66
  # The AWS account ID of the EBS snapshot owner.
67
67
  # @return [String]
68
68
  def owner_id
69
- data.owner_id
69
+ data[:owner_id]
70
70
  end
71
71
 
72
72
  # The progress of the snapshot, as a percentage.
73
73
  # @return [String]
74
74
  def progress
75
- data.progress
75
+ data[:progress]
76
76
  end
77
77
 
78
78
  # The time stamp when the snapshot was initiated.
79
79
  # @return [Time]
80
80
  def start_time
81
- data.start_time
81
+ data[:start_time]
82
82
  end
83
83
 
84
84
  # The snapshot state.
85
85
  # @return [String]
86
86
  def state
87
- data.state
87
+ data[:state]
88
88
  end
89
89
 
90
90
  # Encrypted Amazon EBS snapshots are copied asynchronously. If a
@@ -95,7 +95,7 @@ module Aws::EC2
95
95
  # operation.
96
96
  # @return [String]
97
97
  def state_message
98
- data.state_message
98
+ data[:state_message]
99
99
  end
100
100
 
101
101
  # The ID of the volume that was used to create the snapshot. Snapshots
@@ -103,13 +103,13 @@ module Aws::EC2
103
103
  # should not be used for any purpose.
104
104
  # @return [String]
105
105
  def volume_id
106
- data.volume_id
106
+ data[:volume_id]
107
107
  end
108
108
 
109
109
  # The size of the volume, in GiB.
110
110
  # @return [Integer]
111
111
  def volume_size
112
- data.volume_size
112
+ data[:volume_size]
113
113
  end
114
114
 
115
115
  # Value from an Amazon-maintained list (`amazon` \| `aws-marketplace` \|
@@ -117,13 +117,13 @@ module Aws::EC2
117
117
  # user-configured AWS account alias, which is set from the IAM console.
118
118
  # @return [String]
119
119
  def owner_alias
120
- data.owner_alias
120
+ data[:owner_alias]
121
121
  end
122
122
 
123
123
  # Any tags assigned to the snapshot.
124
124
  # @return [Array<Types::Tag>]
125
125
  def tags
126
- data.tags
126
+ data[:tags]
127
127
  end
128
128
 
129
129
  # @!endgroup
@@ -179,6 +179,101 @@ module Aws::EC2
179
179
  })
180
180
  end
181
181
 
182
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
183
+ #
184
+ # Waiter polls an API operation until a resource enters a desired
185
+ # state.
186
+ #
187
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
188
+ #
189
+ # ## Basic Usage
190
+ #
191
+ # Waiter will polls until it is successful, it fails by
192
+ # entering a terminal state, or until a maximum number of attempts
193
+ # are made.
194
+ #
195
+ # # polls in a loop until condition is true
196
+ # resource.wait_until(options) {|resource| condition}
197
+ #
198
+ # ## Example
199
+ #
200
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
201
+ #
202
+ # ## Configuration
203
+ #
204
+ # You can configure the maximum number of polling attempts, and the
205
+ # delay (in seconds) between each polling attempt. The waiting condition is set
206
+ # by passing a block to {#wait_until}:
207
+ #
208
+ # # poll for ~25 seconds
209
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
210
+ #
211
+ # ## Callbacks
212
+ #
213
+ # You can be notified before each polling attempt and before each
214
+ # delay. If you throw `:success` or `:failure` from these callbacks,
215
+ # it will terminate the waiter.
216
+ #
217
+ # started_at = Time.now
218
+ # # poll for 1 hour, instead of a number of attempts
219
+ # proc = Proc.new do |attempts, response|
220
+ # throw :failure if Time.now - started_at > 3600
221
+ # end
222
+ #
223
+ # # disable max attempts
224
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
225
+ #
226
+ # ## Handling Errors
227
+ #
228
+ # When a waiter is successful, it returns the Resource. When a waiter
229
+ # fails, it raises an error.
230
+ #
231
+ # begin
232
+ # resource.wait_until(...)
233
+ # rescue Aws::Waiters::Errors::WaiterFailed
234
+ # # resource did not enter the desired state in time
235
+ # end
236
+ #
237
+ #
238
+ # @yield param [Resource] resource to be used in the waiting condition
239
+ #
240
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
241
+ # because the waiter has entered a state that it will not transition
242
+ # out of, preventing success.
243
+ #
244
+ # yet successful.
245
+ #
246
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
247
+ # while polling for a resource that is not expected.
248
+ #
249
+ # @raise [NotImplementedError] Raised when the resource does not
250
+ #
251
+ # @option options [Integer] :max_attempts (10) Maximum number of
252
+ # attempts
253
+ # @option options [Integer] :delay (10) Delay between each
254
+ # attempt in seconds
255
+ # @option options [Proc] :before_attempt (nil) Callback
256
+ # invoked before each attempt
257
+ # @option options [Proc] :before_wait (nil) Callback
258
+ # invoked before each wait
259
+ # @return [Resource] if the waiter was successful
260
+ def wait_until(options = {}, &block)
261
+ self_copy = self.dup
262
+ attempts = 0
263
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
264
+ options[:delay] ||= 10
265
+ options[:poller] = Proc.new do
266
+ attempts += 1
267
+ if block.call(self_copy)
268
+ [:success, self_copy]
269
+ else
270
+ self_copy.reload unless attempts == options[:max_attempts]
271
+ :retry
272
+ end
273
+ end
274
+ Aws::Waiters::Waiter.new(options).wait({})
275
+ end
276
+
182
277
  # @!group Actions
183
278
 
184
279
  # @example Request syntax with placeholder values
@@ -416,9 +511,9 @@ module Aws::EC2
416
511
 
417
512
  # @return [Volume, nil]
418
513
  def volume
419
- if data.volume_id
514
+ if data[:volume_id]
420
515
  Volume.new(
421
- id: data.volume_id,
516
+ id: data[:volume_id],
422
517
  client: @client
423
518
  )
424
519
  else
@@ -34,7 +34,7 @@ module Aws::EC2
34
34
  # The Availability Zone of the subnet.
35
35
  # @return [String]
36
36
  def availability_zone
37
- data.availability_zone
37
+ data[:availability_zone]
38
38
  end
39
39
 
40
40
  # The number of unused private IPv4 addresses in the subnet. Note that
@@ -42,39 +42,39 @@ module Aws::EC2
42
42
  # unavailable.
43
43
  # @return [Integer]
44
44
  def available_ip_address_count
45
- data.available_ip_address_count
45
+ data[:available_ip_address_count]
46
46
  end
47
47
 
48
48
  # The IPv4 CIDR block assigned to the subnet.
49
49
  # @return [String]
50
50
  def cidr_block
51
- data.cidr_block
51
+ data[:cidr_block]
52
52
  end
53
53
 
54
54
  # Indicates whether this is the default subnet for the Availability
55
55
  # Zone.
56
56
  # @return [Boolean]
57
57
  def default_for_az
58
- data.default_for_az
58
+ data[:default_for_az]
59
59
  end
60
60
 
61
61
  # Indicates whether instances launched in this subnet receive a public
62
62
  # IPv4 address.
63
63
  # @return [Boolean]
64
64
  def map_public_ip_on_launch
65
- data.map_public_ip_on_launch
65
+ data[:map_public_ip_on_launch]
66
66
  end
67
67
 
68
68
  # The current state of the subnet.
69
69
  # @return [String]
70
70
  def state
71
- data.state
71
+ data[:state]
72
72
  end
73
73
 
74
74
  # The ID of the VPC the subnet is in.
75
75
  # @return [String]
76
76
  def vpc_id
77
- data.vpc_id
77
+ data[:vpc_id]
78
78
  end
79
79
 
80
80
  # Indicates whether a network interface created in this subnet
@@ -82,19 +82,19 @@ module Aws::EC2
82
82
  # IPv6 address.
83
83
  # @return [Boolean]
84
84
  def assign_ipv_6_address_on_creation
85
- data.assign_ipv_6_address_on_creation
85
+ data[:assign_ipv_6_address_on_creation]
86
86
  end
87
87
 
88
88
  # Information about the IPv6 CIDR blocks associated with the subnet.
89
89
  # @return [Array<Types::SubnetIpv6CidrBlockAssociation>]
90
90
  def ipv_6_cidr_block_association_set
91
- data.ipv_6_cidr_block_association_set
91
+ data[:ipv_6_cidr_block_association_set]
92
92
  end
93
93
 
94
94
  # Any tags assigned to the subnet.
95
95
  # @return [Array<Types::Tag>]
96
96
  def tags
97
- data.tags
97
+ data[:tags]
98
98
  end
99
99
 
100
100
  # @!endgroup
@@ -132,6 +132,101 @@ module Aws::EC2
132
132
  !!@data
133
133
  end
134
134
 
135
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
136
+ #
137
+ # Waiter polls an API operation until a resource enters a desired
138
+ # state.
139
+ #
140
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
141
+ #
142
+ # ## Basic Usage
143
+ #
144
+ # Waiter will polls until it is successful, it fails by
145
+ # entering a terminal state, or until a maximum number of attempts
146
+ # are made.
147
+ #
148
+ # # polls in a loop until condition is true
149
+ # resource.wait_until(options) {|resource| condition}
150
+ #
151
+ # ## Example
152
+ #
153
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
154
+ #
155
+ # ## Configuration
156
+ #
157
+ # You can configure the maximum number of polling attempts, and the
158
+ # delay (in seconds) between each polling attempt. The waiting condition is set
159
+ # by passing a block to {#wait_until}:
160
+ #
161
+ # # poll for ~25 seconds
162
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
163
+ #
164
+ # ## Callbacks
165
+ #
166
+ # You can be notified before each polling attempt and before each
167
+ # delay. If you throw `:success` or `:failure` from these callbacks,
168
+ # it will terminate the waiter.
169
+ #
170
+ # started_at = Time.now
171
+ # # poll for 1 hour, instead of a number of attempts
172
+ # proc = Proc.new do |attempts, response|
173
+ # throw :failure if Time.now - started_at > 3600
174
+ # end
175
+ #
176
+ # # disable max attempts
177
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
178
+ #
179
+ # ## Handling Errors
180
+ #
181
+ # When a waiter is successful, it returns the Resource. When a waiter
182
+ # fails, it raises an error.
183
+ #
184
+ # begin
185
+ # resource.wait_until(...)
186
+ # rescue Aws::Waiters::Errors::WaiterFailed
187
+ # # resource did not enter the desired state in time
188
+ # end
189
+ #
190
+ #
191
+ # @yield param [Resource] resource to be used in the waiting condition
192
+ #
193
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
194
+ # because the waiter has entered a state that it will not transition
195
+ # out of, preventing success.
196
+ #
197
+ # yet successful.
198
+ #
199
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
200
+ # while polling for a resource that is not expected.
201
+ #
202
+ # @raise [NotImplementedError] Raised when the resource does not
203
+ #
204
+ # @option options [Integer] :max_attempts (10) Maximum number of
205
+ # attempts
206
+ # @option options [Integer] :delay (10) Delay between each
207
+ # attempt in seconds
208
+ # @option options [Proc] :before_attempt (nil) Callback
209
+ # invoked before each attempt
210
+ # @option options [Proc] :before_wait (nil) Callback
211
+ # invoked before each wait
212
+ # @return [Resource] if the waiter was successful
213
+ def wait_until(options = {}, &block)
214
+ self_copy = self.dup
215
+ attempts = 0
216
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
217
+ options[:delay] ||= 10
218
+ options[:poller] = Proc.new do
219
+ attempts += 1
220
+ if block.call(self_copy)
221
+ [:success, self_copy]
222
+ else
223
+ self_copy.reload unless attempts == options[:max_attempts]
224
+ :retry
225
+ end
226
+ end
227
+ Aws::Waiters::Waiter.new(options).wait({})
228
+ end
229
+
135
230
  # @!group Actions
136
231
 
137
232
  # @example Request syntax with placeholder values
@@ -1025,9 +1120,9 @@ module Aws::EC2
1025
1120
 
1026
1121
  # @return [Vpc, nil]
1027
1122
  def vpc
1028
- if data.vpc_id
1123
+ if data[:vpc_id]
1029
1124
  Vpc.new(
1030
- id: data.vpc_id,
1125
+ id: data[:vpc_id],
1031
1126
  client: @client
1032
1127
  )
1033
1128
  else