Class: Aws::Resources::Operations::WaiterOperation
- Includes:
- Aws::Resources::Options
- Defined in:
- lib/aws-sdk-resources/operations.rb
Instance Attribute Summary collapse
- #path ⇒ String<JMESPathExpression>? readonly
- #waiter_name ⇒ Symbol readonly
- #waiter_params ⇒ Array<RequestParams::Base> readonly
Attributes inherited from Base
Instance Method Summary collapse
- #call(options) ⇒ Object
- #deep_merge(obj1, obj2) ⇒ Object
-
#initialize(options = {}) ⇒ WaiterOperation
constructor
A new instance of WaiterOperation.
Constructor Details
#initialize(options = {}) ⇒ WaiterOperation
Returns a new instance of WaiterOperation.
190 191 192 193 194 195 |
# File 'lib/aws-sdk-resources/operations.rb', line 190 def initialize( = {}) @waiter_name = option(:waiter_name, ) @waiter_params = option(:waiter_params, ) @path = [:path] super end |
Instance Attribute Details
#path ⇒ String<JMESPathExpression>? (readonly)
204 205 206 |
# File 'lib/aws-sdk-resources/operations.rb', line 204 def path @path end |
#waiter_name ⇒ Symbol (readonly)
198 199 200 |
# File 'lib/aws-sdk-resources/operations.rb', line 198 def waiter_name @waiter_name end |
#waiter_params ⇒ Array<RequestParams::Base> (readonly)
201 202 203 |
# File 'lib/aws-sdk-resources/operations.rb', line 201 def waiter_params @waiter_params end |
Instance Method Details
#call(options) ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/aws-sdk-resources/operations.rb', line 208 def call() resource = [:resource] params_hash = {} @waiter_params.each do |param| param.apply(params_hash, ) end user_params = [:params] || {} params = deep_merge(user_params, params_hash) resp = resource.client.wait_until(@waiter_name, params, &[:block]) resource_opts = resource.identifiers.dup if @path && resp.respond_to?(:data) resource_opts[:data] = JMESPath.search(@path, resp.data) end resource_opts[:client] = resource.client resource.class.new(resource_opts) end |
#deep_merge(obj1, obj2) ⇒ Object
229 230 231 232 233 234 235 |
# File 'lib/aws-sdk-resources/operations.rb', line 229 def deep_merge(obj1, obj2) case obj1 when Hash then obj1.merge(obj2) { |key, v1, v2| deep_merge(v1, v2) } when Array then obj2 + obj1 else obj2 end end |