class Aws::Resources::Operations::WaiterOperation

Attributes

path[R]

@return [String<JMESPathExpression>, nil]

waiter_name[R]

@return [Symbol]

waiter_params[R]

@return [Array<RequestParams::Base>]

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method Aws::Resources::Operations::Base.new
# File lib/aws-sdk-resources/operations.rb, line 185
def initialize(options = {})
  @waiter_name = option(:waiter_name, options)
  @waiter_params = option(:waiter_params, options)
  @path = options[:path]
  super
end

Public Instance Methods

call(options) click to toggle source

@option options [required,Resource] :resource @option options [required,Array<Mixed>] :args

# File lib/aws-sdk-resources/operations.rb, line 203
def call(options)

  resource = options[:resource]

  params_hash = {}
  @waiter_params.each do |param|
    param.apply(params_hash, options)
  end

  user_params = options[:params] || {}
  params = deep_merge(user_params, params_hash)
  resp = resource.client.wait_until(@waiter_name, params, &options[: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) click to toggle source
# File lib/aws-sdk-resources/operations.rb, line 224
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