Class: Aws::Resources::Operations::WaiterOperation

Inherits:
Base
  • Object
show all
Includes:
Aws::Resources::Options
Defined in:
lib/aws-sdk-resources/operations.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#source

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ WaiterOperation

Returns a new instance of WaiterOperation.



202
203
204
205
206
207
# File 'lib/aws-sdk-resources/operations.rb', line 202

def initialize(options = {})
  @waiter_name = option(:waiter_name, options)
  @waiter_params = option(:waiter_params, options)
  @path = options[:path]
  super
end

Instance Attribute Details

#pathString<JMESPathExpression>? (readonly)

Returns:

  • (String<JMESPathExpression>, nil)


216
217
218
# File 'lib/aws-sdk-resources/operations.rb', line 216

def path
  @path
end

#waiter_nameSymbol (readonly)

Returns:

  • (Symbol)


210
211
212
# File 'lib/aws-sdk-resources/operations.rb', line 210

def waiter_name
  @waiter_name
end

#waiter_paramsArray<RequestParams::Base> (readonly)

Returns:

  • (Array<RequestParams::Base>)


213
214
215
# File 'lib/aws-sdk-resources/operations.rb', line 213

def waiter_params
  @waiter_params
end

Instance Method Details

#call(options) ⇒ Object

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :resource (required, Resource)
  • :args (required, Array<Mixed>)


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/aws-sdk-resources/operations.rb', line 220

def call(options)

  resource = options[:resource]

  params_hash = options[:args].first || {}
  @waiter_params.each do |param|
    param.apply(params_hash, options)
  end

  resp = resource.client.wait_until(@waiter_name, params_hash, &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