Service Description: Manages long-running operations with an API service.
When an API method normally takes long time to complete, it can be designed
to return [Operation][google.longrunning.Operation] to the client, and the
client can use this interface to receive the real response asynchronously by
polling the operation resource, or pass the operation resource to another API
(such as Pub/Sub API) to receive the response. Any API service that returns
long-running operations should implement the Operations interface so
developers can have a consistent client experience.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$operationsClient = new OperationsClient();
try {
$name = 'name';
$operationsClient->cancelOperation($name);
} finally {
$operationsClient->close();
}
- deprecated Please use the new service client {@see \Google\LongRunning\Client\OperationsClient}.
| Constants |
| public Google The name of the code generator, to be included in the agent header. |
| public Google The default port of the service. |
| public Google The default address of the service.
|
| public Google The name of the service. |
| Properties |
| public static $serviceScopes = [] The default scopes required by the service. |
| Methods |
| public __construct(array $options = []) Constructor.
|
| public addMiddleware(callable $middlewareCallable) : void Add a middleware to the call stack by providing a callable which will be invoked at the start of each call, and will return an instance of {@see MiddlewareInterface} when invoked. The callable must have the following method signature:
An implementation may look something like this:
|
| public cancelOperation( $name, array $optionalArgs = []) Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
Sample code:
|
| public close() Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.
|
| public deleteOperation( $name, array $optionalArgs = []) Deletes a long-running operation. This method indicates that the client is
no longer interested in the operation result. It does not cancel the
operation. If the server doesn't support this method, it returns
Sample code:
|
| public getOperation( $name, array $optionalArgs = []) Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. Sample code:
|
| public listOperations( $name, $filter, array $optionalArgs = []) Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns Sample code:
|
| public prependMiddleware(callable $middlewareCallable) : void Prepend a middleware to the call stack by providing a callable which will be invoked at the end of each call, and will return an instance of {@see MiddlewareInterface} when invoked. The callable must have the following method signature:
An implementation may look something like this:
|
public static traitValidate(array $arr, array $requiredKeys)
|
public static validate(array $arr, array $requiredKeys)
|
public static validateNotNull(array $arr, array $requiredKeys)
|
| public waitOperation(array $optionalArgs = []) Waits until the specified long-running operation is done or reaches at most
a specified timeout, returning the latest state. If the operation is
already done, the latest state is immediately returned. If the timeout
specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
timeout is used. If the server does not support this method, it returns
Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done. Sample code:
|
| Methods |
| protected getCredentialsWrapper() Get the credentials for the client. This method is protected to support use by customized clients.
|
| protected getTransport() Get the transport for the client. This method is protected to support use by customized clients.
|
| protected modifyClientOptions(array $options) Modify options passed to the client before calling setClientOptions.
|
| protected modifyStreamingCallable(callable $callable) Modify the streaming callable.
|
| protected modifyUnaryCallable(callable $callable) Modify the unary callable.
|
| Constants |
| private Google The address template of the service. |
| Properties |
| private array $agentHeader = [] |
| private bool $backwardsCompatibilityMode |
| private ?Google |
| private array $descriptors = [] |
| private static $gapicVersionFromFile = NULL |
private array $middlewareCallables = []
|
private array $prependMiddlewareCallables = []
|
private array $retrySettings = []
|
| private string $serviceName = '' |
| private ?Google |
| private array $transportCallMethods = ['startUnaryCall', 'startBidiStreamingCall', 'startClientStreamingCall', 'startServerStreamingCall'] |
| Methods |
| private arrayFilterRemoveNull(array $arr) Just like array_filter(), but preserves falsey values except null.
|
| private arrayMergeRecursive(array $array1, array $array2) A method, similar to PHP's
|
| private buildClientOptions(Google Resolve client options based on the client's default ({@see ClientOptionsTrait::getClientDefault}) and the default for all Google APIs.
|
private buildMethod(?string $interfaceName = NULL, ?string $methodName = NULL)
|
private buildRequestParamsHeader(array $headerParams, ?Google
|
private configureCallConstructionOptions(string $methodName, array $optionalArgs)
|
private configureCallOptions(array $optionalArgs) : array
|
private createCallStack(array $callConstructionOptions)
|
private createCredentialsWrapper( $credentials, array $credentialsConfig, string $universeDomain)
|
private createOperationsClient(array $options)
|
private createTransport(string $apiEndpoint, $transport, $transportConfig, ?callable $clientCertSource = NULL, bool $hasEmulator = false)
|
private static defaultTransport()
|
| private static determineMtlsEndpoint(string $apiEndpoint) |
| private static getClientDefaults() |
| private static getDefaultAudience() The SERVICE_ADDRESS constant is set by GAPIC clients |
| private static getGapicVersion(array $options) |
private static getGrpcDependencyStatus()
|
private getPagedListResponse(string $methodName, array $optionalArgs, string $decodeType, Google
|
private getPagedListResponseAsync(string $methodName, array $optionalArgs, string $decodeType, Google
|
| private static initGrpcGcpConfig(string $hostName, string $confPath) |
| private isAssoc(array $arr) Determine whether given array is associative.
|
private isBackwardsCompatibilityMode() : bool
|
private logConfiguration(Psr\Log\LoggerInterface|false|?null $logger, array $options) : void
|
| private pluck(string $key, array $arr, bool $isRequired = true) Pluck a value out of an array.
|
| private pluckArray(array $keys, array $arr) Pluck a subset of an array.
|
| private setClientOptions(array $options) Configures the GAPIC client based on an array of options.
|
| private shouldUseMtlsEndpoint(array $options) |
private startApiCall(string $methodName, ?Google
|
private startAsyncCall(string $methodName, Google
|
private startCall(string $methodName, string $decodeType, array $optionalArgs = [], ?Google
|
private startOperationsCall(string $methodName, array $optionalArgs, Google
|
| private subsetArray(array $keys, array $arr) Return a subset of an array, like pluckArray, without modifying the original array.
|
| private static supportedTransports() This defaults to all three transports, which One-Platform supports. Discovery clients should define this function and only return ['rest']. |
| private validateCallConfig(string $methodName) |
private static validateFileExists(string $filePath)
|
private static validateGrpcSupport()
|
| private static validateImpl( $arr, $requiredKeys, $allowNull) |
| Properties |
| private static $gapicVersionFromFile = NULL |
| public static $serviceScopes = [] The default scopes required by the service. |
| Methods |
private static defaultTransport()
|
| private static determineMtlsEndpoint(string $apiEndpoint) |
| private static getClientDefaults() |
| private static getDefaultAudience() The SERVICE_ADDRESS constant is set by GAPIC clients |
| private static getGapicVersion(array $options) |
private static getGrpcDependencyStatus()
|
| private static initGrpcGcpConfig(string $hostName, string $confPath) |
| private static supportedTransports() This defaults to all three transports, which One-Platform supports. Discovery clients should define this function and only return ['rest']. |
public static traitValidate(array $arr, array $requiredKeys)
|
public static validate(array $arr, array $requiredKeys)
|
private static validateFileExists(string $filePath)
|
private static validateGrpcSupport()
|
| private static validateImpl( $arr, $requiredKeys, $allowNull) |
public static validateNotNull(array $arr, array $requiredKeys)
|