Documentation

Waiter
in package
implements PromisorInterface

"Waiters" are associated with an AWS resource (e.g., EC2 instance), and poll that resource and until it is in a particular state.

The Waiter object produces a promise that is either a.) resolved once the waiting conditions are met, or b.) rejected if the waiting conditions cannot be met or has exceeded the number of allowed attempts at meeting the conditions. You can use waiters in a blocking or non-blocking way, depending on whether you call wait() on the promise.

The configuration for the waiter must include information about the operation and the conditions for wait completion.

Interfaces, Classes and Traits

PromisorInterface
Interface used with classes that return a promise.

Table of Contents

$args  : array<string|int, mixed>
$client  : AwsClientInterface
$config  : array<string|int, mixed>
$defaults  : array<string|int, mixed>
$name  : string
$required  : array<string|int, mixed>
__construct()  : mixed
The array of configuration options include:
promise()  : PromiseInterface
Returns a promise.
determineState()  : string
Determines the state of the waiter attempt, based on the result of polling the resource. A waiter can have the state of "success", "failed", or "retry".
getArgsForAttempt()  : mixed
Gets the operation arguments for the attempt, including the delay.
matchesError()  : bool
matchesPath()  : bool
matchesPathAll()  : bool
matchesPathAny()  : bool
matchesStatus()  : bool

Properties

$args

private array<string|int, mixed> $args

Params to use with each attempt operation.

$config

private array<string|int, mixed> $config

Waiter configuration.

$defaults

private static array<string|int, mixed> $defaults = ['initDelay' => 0, 'before' => null]

Default configuration options.

$name

private string $name

Name of the waiter.

$required

private static array<string|int, mixed> $required = ['acceptors', 'delay', 'maxAttempts', 'operation']

Required configuration options.

Methods

__construct()

The array of configuration options include:

public __construct(AwsClientInterface $client, string $name[, array<string|int, mixed> $args = [] ][, array<string|int, mixed> $config = [] ]) : mixed
  • acceptors: (array) Array of acceptor options
  • delay: (int) Number of seconds to delay between attempts
  • maxAttempts: (int) Maximum number of attempts before failing
  • operation: (string) Name of the API operation to use for polling
  • before: (callable) Invoked before attempts. Accepts command and tries.
Parameters
$client : AwsClientInterface

Client used to execute commands.

$name : string

Waiter name.

$args : array<string|int, mixed> = []

Command arguments.

$config : array<string|int, mixed> = []

Waiter config that overrides defaults.

Tags
throws
InvalidArgumentException

if the configuration is incomplete.

Return values
mixed

determineState()

Determines the state of the waiter attempt, based on the result of polling the resource. A waiter can have the state of "success", "failed", or "retry".

private determineState(mixed $result) : string
Parameters
$result : mixed
Return values
string

Will be "success", "failed", or "retry"

getArgsForAttempt()

Gets the operation arguments for the attempt, including the delay.

private getArgsForAttempt( $attempt) : mixed
Parameters
$attempt :

Number of the current attempt.

Return values
mixed

integer

matchesError()

private matchesError(Result $result, array<string|int, mixed> $acceptor) : bool
Parameters
$result : Result

Result or exception.

$acceptor : array<string|int, mixed>

Acceptor configuration being checked.

Return values
bool

matchesPath()

private matchesPath(Result $result, array<string|int, mixed> $acceptor) : bool
Parameters
$result : Result

Result or exception.

$acceptor : array<string|int, mixed>

Acceptor configuration being checked.

Return values
bool

matchesPathAll()

private matchesPathAll(Result $result, array<string|int, mixed> $acceptor) : bool
Parameters
$result : Result

Result or exception.

$acceptor : array<string|int, mixed>

Acceptor configuration being checked.

Return values
bool

matchesPathAny()

private matchesPathAny(Result $result, array<string|int, mixed> $acceptor) : bool
Parameters
$result : Result

Result or exception.

$acceptor : array<string|int, mixed>

Acceptor configuration being checked.

Return values
bool

matchesStatus()

private matchesStatus(Result $result, array<string|int, mixed> $acceptor) : bool
Parameters
$result : Result

Result or exception.

$acceptor : array<string|int, mixed>

Acceptor configuration being checked.

Return values
bool

Search results