lib/aws-sdk-lambda/waiters.rb in aws-sdk-lambda-1.87.0 vs lib/aws-sdk-lambda/waiters.rb in aws-sdk-lambda-1.88.0
- old
+ new
@@ -65,17 +65,18 @@
# # Available Waiters
#
# The following table lists the valid waiter names, the operations they call,
# and the default `:delay` and `:max_attempts` values.
#
- # | waiter_name | params | :delay | :max_attempts |
- # | ------------------- | ----------------------------------- | -------- | ------------- |
- # | function_active | {Client#get_function_configuration} | 5 | 60 |
- # | function_active_v2 | {Client#get_function} | 1 | 300 |
- # | function_exists | {Client#get_function} | 1 | 20 |
- # | function_updated | {Client#get_function_configuration} | 5 | 60 |
- # | function_updated_v2 | {Client#get_function} | 1 | 300 |
+ # | waiter_name | params | :delay | :max_attempts |
+ # | ------------------------ | ----------------------------------- | -------- | ------------- |
+ # | function_active | {Client#get_function_configuration} | 5 | 60 |
+ # | function_active_v2 | {Client#get_function} | 1 | 300 |
+ # | function_exists | {Client#get_function} | 1 | 20 |
+ # | function_updated | {Client#get_function_configuration} | 5 | 60 |
+ # | function_updated_v2 | {Client#get_function} | 1 | 300 |
+ # | published_version_active | {Client#get_function_configuration} | 5 | 312 |
#
module Waiters
# Waits for the function's State to be Active. This waiter uses GetFunctionConfiguration API. This should be used after new function creation.
class FunctionActive
@@ -312,9 +313,60 @@
}.merge(options))
end
# @option (see Client#get_function)
# @return (see Client#get_function)
+ def wait(params = {})
+ @waiter.wait(client: @client, params: params)
+ end
+
+ # @api private
+ attr_reader :waiter
+
+ end
+
+ # Waits for the published version's State to be Active. This waiter uses GetFunctionConfiguration API. This should be used after new version is published.
+ class PublishedVersionActive
+
+ # @param [Hash] options
+ # @option options [required, Client] :client
+ # @option options [Integer] :max_attempts (312)
+ # @option options [Integer] :delay (5)
+ # @option options [Proc] :before_attempt
+ # @option options [Proc] :before_wait
+ def initialize(options)
+ @client = options.fetch(:client)
+ @waiter = Aws::Waiters::Waiter.new({
+ max_attempts: 312,
+ delay: 5,
+ poller: Aws::Waiters::Poller.new(
+ operation_name: :get_function_configuration,
+ acceptors: [
+ {
+ "state" => "success",
+ "matcher" => "path",
+ "argument" => "state",
+ "expected" => "Active"
+ },
+ {
+ "state" => "failure",
+ "matcher" => "path",
+ "argument" => "state",
+ "expected" => "Failed"
+ },
+ {
+ "state" => "retry",
+ "matcher" => "path",
+ "argument" => "state",
+ "expected" => "Pending"
+ }
+ ]
+ )
+ }.merge(options))
+ end
+
+ # @option (see Client#get_function_configuration)
+ # @return (see Client#get_function_configuration)
def wait(params = {})
@waiter.wait(client: @client, params: params)
end
# @api private