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,13 +34,13 @@ module Aws::EC2
34
34
  # Any VPCs attached to the Internet gateway.
35
35
  # @return [Array<Types::InternetGatewayAttachment>]
36
36
  def attachments
37
- data.attachments
37
+ data[:attachments]
38
38
  end
39
39
 
40
40
  # Any tags assigned to the Internet gateway.
41
41
  # @return [Array<Types::Tag>]
42
42
  def tags
43
- data.tags
43
+ data[:tags]
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
@@ -34,13 +34,13 @@ module Aws::EC2
34
34
  # The SHA-1 digest of the DER encoded private key.
35
35
  # @return [String]
36
36
  def key_fingerprint
37
- data.key_fingerprint
37
+ data[:key_fingerprint]
38
38
  end
39
39
 
40
40
  # An unencrypted PEM encoded RSA private key.
41
41
  # @return [String]
42
42
  def key_material
43
- data.key_material
43
+ data[:key_material]
44
44
  end
45
45
 
46
46
  # @!endgroup
@@ -73,6 +73,101 @@ module Aws::EC2
73
73
  !!@data
74
74
  end
75
75
 
76
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
77
+ #
78
+ # Waiter polls an API operation until a resource enters a desired
79
+ # state.
80
+ #
81
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
82
+ #
83
+ # ## Basic Usage
84
+ #
85
+ # Waiter will polls until it is successful, it fails by
86
+ # entering a terminal state, or until a maximum number of attempts
87
+ # are made.
88
+ #
89
+ # # polls in a loop until condition is true
90
+ # resource.wait_until(options) {|resource| condition}
91
+ #
92
+ # ## Example
93
+ #
94
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
95
+ #
96
+ # ## Configuration
97
+ #
98
+ # You can configure the maximum number of polling attempts, and the
99
+ # delay (in seconds) between each polling attempt. The waiting condition is set
100
+ # by passing a block to {#wait_until}:
101
+ #
102
+ # # poll for ~25 seconds
103
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
104
+ #
105
+ # ## Callbacks
106
+ #
107
+ # You can be notified before each polling attempt and before each
108
+ # delay. If you throw `:success` or `:failure` from these callbacks,
109
+ # it will terminate the waiter.
110
+ #
111
+ # started_at = Time.now
112
+ # # poll for 1 hour, instead of a number of attempts
113
+ # proc = Proc.new do |attempts, response|
114
+ # throw :failure if Time.now - started_at > 3600
115
+ # end
116
+ #
117
+ # # disable max attempts
118
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
119
+ #
120
+ # ## Handling Errors
121
+ #
122
+ # When a waiter is successful, it returns the Resource. When a waiter
123
+ # fails, it raises an error.
124
+ #
125
+ # begin
126
+ # resource.wait_until(...)
127
+ # rescue Aws::Waiters::Errors::WaiterFailed
128
+ # # resource did not enter the desired state in time
129
+ # end
130
+ #
131
+ #
132
+ # @yield param [Resource] resource to be used in the waiting condition
133
+ #
134
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
135
+ # because the waiter has entered a state that it will not transition
136
+ # out of, preventing success.
137
+ #
138
+ # yet successful.
139
+ #
140
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
141
+ # while polling for a resource that is not expected.
142
+ #
143
+ # @raise [NotImplementedError] Raised when the resource does not
144
+ #
145
+ # @option options [Integer] :max_attempts (10) Maximum number of
146
+ # attempts
147
+ # @option options [Integer] :delay (10) Delay between each
148
+ # attempt in seconds
149
+ # @option options [Proc] :before_attempt (nil) Callback
150
+ # invoked before each attempt
151
+ # @option options [Proc] :before_wait (nil) Callback
152
+ # invoked before each wait
153
+ # @return [Resource] if the waiter was successful
154
+ def wait_until(options = {}, &block)
155
+ self_copy = self.dup
156
+ attempts = 0
157
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
158
+ options[:delay] ||= 10
159
+ options[:poller] = Proc.new do
160
+ attempts += 1
161
+ if block.call(self_copy)
162
+ [:success, self_copy]
163
+ else
164
+ self_copy.reload unless attempts == options[:max_attempts]
165
+ :retry
166
+ end
167
+ end
168
+ Aws::Waiters::Waiter.new(options).wait({})
169
+ end
170
+
76
171
  # @!group Actions
77
172
 
78
173
  # @example Request syntax with placeholder values
@@ -37,7 +37,7 @@ module Aws::EC2
37
37
  # specified in section 4 of RFC4716.
38
38
  # @return [String]
39
39
  def key_fingerprint
40
- data.key_fingerprint
40
+ data[:key_fingerprint]
41
41
  end
42
42
 
43
43
  # @!endgroup
@@ -75,6 +75,101 @@ module Aws::EC2
75
75
  !!@data
76
76
  end
77
77
 
78
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
79
+ #
80
+ # Waiter polls an API operation until a resource enters a desired
81
+ # state.
82
+ #
83
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
84
+ #
85
+ # ## Basic Usage
86
+ #
87
+ # Waiter will polls until it is successful, it fails by
88
+ # entering a terminal state, or until a maximum number of attempts
89
+ # are made.
90
+ #
91
+ # # polls in a loop until condition is true
92
+ # resource.wait_until(options) {|resource| condition}
93
+ #
94
+ # ## Example
95
+ #
96
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
97
+ #
98
+ # ## Configuration
99
+ #
100
+ # You can configure the maximum number of polling attempts, and the
101
+ # delay (in seconds) between each polling attempt. The waiting condition is set
102
+ # by passing a block to {#wait_until}:
103
+ #
104
+ # # poll for ~25 seconds
105
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
106
+ #
107
+ # ## Callbacks
108
+ #
109
+ # You can be notified before each polling attempt and before each
110
+ # delay. If you throw `:success` or `:failure` from these callbacks,
111
+ # it will terminate the waiter.
112
+ #
113
+ # started_at = Time.now
114
+ # # poll for 1 hour, instead of a number of attempts
115
+ # proc = Proc.new do |attempts, response|
116
+ # throw :failure if Time.now - started_at > 3600
117
+ # end
118
+ #
119
+ # # disable max attempts
120
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
121
+ #
122
+ # ## Handling Errors
123
+ #
124
+ # When a waiter is successful, it returns the Resource. When a waiter
125
+ # fails, it raises an error.
126
+ #
127
+ # begin
128
+ # resource.wait_until(...)
129
+ # rescue Aws::Waiters::Errors::WaiterFailed
130
+ # # resource did not enter the desired state in time
131
+ # end
132
+ #
133
+ #
134
+ # @yield param [Resource] resource to be used in the waiting condition
135
+ #
136
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
137
+ # because the waiter has entered a state that it will not transition
138
+ # out of, preventing success.
139
+ #
140
+ # yet successful.
141
+ #
142
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
143
+ # while polling for a resource that is not expected.
144
+ #
145
+ # @raise [NotImplementedError] Raised when the resource does not
146
+ #
147
+ # @option options [Integer] :max_attempts (10) Maximum number of
148
+ # attempts
149
+ # @option options [Integer] :delay (10) Delay between each
150
+ # attempt in seconds
151
+ # @option options [Proc] :before_attempt (nil) Callback
152
+ # invoked before each attempt
153
+ # @option options [Proc] :before_wait (nil) Callback
154
+ # invoked before each wait
155
+ # @return [Resource] if the waiter was successful
156
+ def wait_until(options = {}, &block)
157
+ self_copy = self.dup
158
+ attempts = 0
159
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
160
+ options[:delay] ||= 10
161
+ options[:poller] = Proc.new do
162
+ attempts += 1
163
+ if block.call(self_copy)
164
+ [:success, self_copy]
165
+ else
166
+ self_copy.reload unless attempts == options[:max_attempts]
167
+ :retry
168
+ end
169
+ end
170
+ Aws::Waiters::Waiter.new(options).wait({})
171
+ end
172
+
78
173
  # @!group Actions
79
174
 
80
175
  # @example Request syntax with placeholder values
@@ -34,31 +34,31 @@ module Aws::EC2
34
34
  # Any associations between the network ACL and one or more subnets
35
35
  # @return [Array<Types::NetworkAclAssociation>]
36
36
  def associations
37
- data.associations
37
+ data[:associations]
38
38
  end
39
39
 
40
40
  # One or more entries (rules) in the network ACL.
41
41
  # @return [Array<Types::NetworkAclEntry>]
42
42
  def entries
43
- data.entries
43
+ data[:entries]
44
44
  end
45
45
 
46
46
  # Indicates whether this is the default network ACL for the VPC.
47
47
  # @return [Boolean]
48
48
  def is_default
49
- data.is_default
49
+ data[:is_default]
50
50
  end
51
51
 
52
52
  # Any tags assigned to the network ACL.
53
53
  # @return [Array<Types::Tag>]
54
54
  def tags
55
- data.tags
55
+ data[:tags]
56
56
  end
57
57
 
58
58
  # The ID of the VPC for the network ACL.
59
59
  # @return [String]
60
60
  def vpc_id
61
- data.vpc_id
61
+ data[:vpc_id]
62
62
  end
63
63
 
64
64
  # @!endgroup
@@ -96,6 +96,101 @@ module Aws::EC2
96
96
  !!@data
97
97
  end
98
98
 
99
+ # @deprecated Use [Aws::EC2::Client] #wait_until instead
100
+ #
101
+ # Waiter polls an API operation until a resource enters a desired
102
+ # state.
103
+ #
104
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
105
+ #
106
+ # ## Basic Usage
107
+ #
108
+ # Waiter will polls until it is successful, it fails by
109
+ # entering a terminal state, or until a maximum number of attempts
110
+ # are made.
111
+ #
112
+ # # polls in a loop until condition is true
113
+ # resource.wait_until(options) {|resource| condition}
114
+ #
115
+ # ## Example
116
+ #
117
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
118
+ #
119
+ # ## Configuration
120
+ #
121
+ # You can configure the maximum number of polling attempts, and the
122
+ # delay (in seconds) between each polling attempt. The waiting condition is set
123
+ # by passing a block to {#wait_until}:
124
+ #
125
+ # # poll for ~25 seconds
126
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
127
+ #
128
+ # ## Callbacks
129
+ #
130
+ # You can be notified before each polling attempt and before each
131
+ # delay. If you throw `:success` or `:failure` from these callbacks,
132
+ # it will terminate the waiter.
133
+ #
134
+ # started_at = Time.now
135
+ # # poll for 1 hour, instead of a number of attempts
136
+ # proc = Proc.new do |attempts, response|
137
+ # throw :failure if Time.now - started_at > 3600
138
+ # end
139
+ #
140
+ # # disable max attempts
141
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
142
+ #
143
+ # ## Handling Errors
144
+ #
145
+ # When a waiter is successful, it returns the Resource. When a waiter
146
+ # fails, it raises an error.
147
+ #
148
+ # begin
149
+ # resource.wait_until(...)
150
+ # rescue Aws::Waiters::Errors::WaiterFailed
151
+ # # resource did not enter the desired state in time
152
+ # end
153
+ #
154
+ #
155
+ # @yield param [Resource] resource to be used in the waiting condition
156
+ #
157
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
158
+ # because the waiter has entered a state that it will not transition
159
+ # out of, preventing success.
160
+ #
161
+ # yet successful.
162
+ #
163
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
164
+ # while polling for a resource that is not expected.
165
+ #
166
+ # @raise [NotImplementedError] Raised when the resource does not
167
+ #
168
+ # @option options [Integer] :max_attempts (10) Maximum number of
169
+ # attempts
170
+ # @option options [Integer] :delay (10) Delay between each
171
+ # attempt in seconds
172
+ # @option options [Proc] :before_attempt (nil) Callback
173
+ # invoked before each attempt
174
+ # @option options [Proc] :before_wait (nil) Callback
175
+ # invoked before each wait
176
+ # @return [Resource] if the waiter was successful
177
+ def wait_until(options = {}, &block)
178
+ self_copy = self.dup
179
+ attempts = 0
180
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
181
+ options[:delay] ||= 10
182
+ options[:poller] = Proc.new do
183
+ attempts += 1
184
+ if block.call(self_copy)
185
+ [:success, self_copy]
186
+ else
187
+ self_copy.reload unless attempts == options[:max_attempts]
188
+ :retry
189
+ end
190
+ end
191
+ Aws::Waiters::Waiter.new(options).wait({})
192
+ end
193
+
99
194
  # @!group Actions
100
195
 
101
196
  # @example Request syntax with placeholder values
@@ -329,9 +424,9 @@ module Aws::EC2
329
424
 
330
425
  # @return [Vpc, nil]
331
426
  def vpc
332
- if data.vpc_id
427
+ if data[:vpc_id]
333
428
  Vpc.new(
334
- id: data.vpc_id,
429
+ id: data[:vpc_id],
335
430
  client: @client
336
431
  )
337
432
  else