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
Google Cloud 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.

EXPERIMENTAL: This client library class has not yet been declared GA (1.0). This means that
even though we intend the surface to be stable, we may make backwards incompatible changes
if necessary.

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:

$options = [
    'apiEndpoint' => 'my-service-address',
    'scopes' => ['my-service-scope'],
];
$operationsClient = new OperationsClient($options);
try {
    $name = '';
    $response = $operationsClient->getOperation($name);
} finally {
    if (isset($operationsClient)) {
        $operationsClient->close();
    }
}
  • experimental
CloneableInstantiable
Constants
public Google\ApiCore\LongRunning\Gapic\OperationsGapicClient::CODEGEN_NAME = 'gapic'
 

The name of the code generator, to be included in the agent header.

public Google\ApiCore\LongRunning\Gapic\OperationsGapicClient::DEFAULT_SERVICE_PORT = 443
 

The default port of the service.

public Google\ApiCore\LongRunning\Gapic\OperationsGapicClient::SERVICE_NAME = 'google.longrunning.Operations'
 

The name of the service.

Methods
public __construct( $options = [])
 

Constructor.

  • experimental
public cancelOperation( $name, $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
google.rpc.Code.UNIMPLEMENTED. Clients can use
[Operations.GetOperation][google.longrunning.Operations.GetOperation] or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
corresponding to Code.CANCELLED.

Sample code:

$options = [
    'apiEndpoint' => 'my-service-address',
    'scopes' => ['my-service-scope'],
];
$operationsClient = new OperationsClient($options);
try {
    $name = '';
    $operationsClient->cancelOperation($name);
} finally {
    if (isset($operationsClient)) {
        $operationsClient->close();
    }
}
  • throws ApiException if the remote call fails
  • experimental
public close()
 

Initiates an orderly shutdown in which preexisting calls continue but new
calls are immediately cancelled.

  • experimental
public deleteOperation( $name, $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
google.rpc.Code.UNIMPLEMENTED.

Sample code:

$options = [
    'apiEndpoint' => 'my-service-address',
    'scopes' => ['my-service-scope'],
];
$operationsClient = new OperationsClient($options);
try {
    $name = '';
    $operationsClient->deleteOperation($name);
} finally {
    if (isset($operationsClient)) {
        $operationsClient->close();
    }
}
  • throws ApiException if the remote call fails
  • experimental
public getOperation( $name, $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:

$options = [
    'apiEndpoint' => 'my-service-address',
    'scopes' => ['my-service-scope'],
];
$operationsClient = new OperationsClient($options);
try {
    $name = '';
    $response = $operationsClient->getOperation($name);
} finally {
    if (isset($operationsClient)) {
        $operationsClient->close();
    }
}
public listOperations( $name, $filter, $optionalArgs = [])
 

Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED.

NOTE: the name binding below allows API services to override the binding
to use different resource name schemes, such as users/*/operations.

Sample code:

$options = [
    'apiEndpoint' => 'my-service-address',
    'scopes' => ['my-service-scope'],
];
$operationsClient = new OperationsClient($options);
try {
    $name = '';
    $filter = '';
    // Iterate through all elements
    $pagedResponse = $operationsClient->listOperations($name, $filter);
    foreach ($pagedResponse->iterateAllElements() as $element) {
        // doSomethingWith($element);
    }

    // OR iterate over pages of elements
    $pagedResponse = $operationsClient->listOperations($name, $filter);
    foreach ($pagedResponse->iteratePages() as $page) {
        foreach ($page as $element) {
            // doSomethingWith($element);
        }
    }
} finally {
    if (isset($operationsClient)) {
        $operationsClient->close();
    }
}
public static validate( $arr, $requiredKeys)
 
  • return array Returns $arr for fluent use
public static validateNotNull( $arr, $requiredKeys)
 
  • return array Returns $arr for fluent use
Methods
protected getCredentialsWrapper()
 

Get the credentials for the client. This method is protected to support
use by customized clients.

  • access private
  • return CredentialsWrapper
protected getTransport()
 

Get the transport for the client. This method is protected to support
use by customized clients.

  • access private
  • return TransportInterface
protected modifyClientOptions(array $options)
 

Modify options passed to the client before calling setClientOptions.

  • access private
protected modifyStreamingCallable(callable $callable)
 

Modify the streaming callable.

  • access private
protected modifyUnaryCallable(callable $callable)
 

Modify the unary callable.

  • access private
Properties
private $agentHeader
private $credentialsWrapper
private $descriptors
private static $gapicVersionFromFile
private $retrySettings
 
  • var RetrySettings[] $retrySettings
private $serviceName
private $transport
 
  • var TransportInterface
private $transportCallMethods
Methods
private arrayFilterRemoveNull(array $arr)
 

Just like array_filter(), but preserves falsey values except null.

  • return array
private buildClientOptions(array $options)
private buildMethod( $interfaceName, $methodName)
 
  • return string
private configureCallConstructionOptions( $methodName, array $optionalArgs)
 
  • return array
private createCallStack(array $callConstructionOptions)
 
  • return callable
private createCredentialsWrapper( $credentials, array $credentialsConfig)
 
  • return CredentialsWrapper
  • throws ValidationException
private createOperationsClient(array $options)
 
  • return OperationsClient
private createTransport( $apiEndpoint, $transport, array $transportConfig)
 
  • return TransportInterface
  • throws ValidationException
private static defaultTransport()
 
  • return string
private static getClientDefaults()
private static getGapicVersion(array $options)
private static getGrpcDependencyStatus()
 
  • return bool
private getPagedListResponse( $methodName, array $optionalArgs, $decodeType, Google\Protobuf\Internal\Message $request, $interfaceName = NULL)
 
  • return PagedListResponse
private static initGrpcGcpConfig( $hostName, $confPath)
private isAssoc(array $arr)
 

Determine whether given array is associative.

  • return bool
private pluck( $key, array $arr, $isRequired = true)
 

Pluck a value out of an array.

  • return mixed|null
  • throws InvalidArgumentException
private pluckArray(array $keys, $arr)
 

Pluck a subset of an array.

  • return array
private setClientOptions(array $options)
 

Configures the GAPIC client based on an array of options.

  • throws ValidationException
private startCall( $methodName, $decodeType, array $optionalArgs = [], ?Google\Protobuf\Internal\Message $request = NULL, $callType = 0, $interfaceName = NULL)
 
  • return PromiseInterface|\BidiStream|\ClientStream|\ServerStream
private startOperationsCall( $methodName, array $optionalArgs, Google\Protobuf\Internal\Message $request, Google\ApiCore\LongRunning\OperationsClient $client, $interfaceName = NULL)
 
  • return PromiseInterface
private subsetArray(array $keys, $arr)
 

Return a subset of an array, like pluckArray, without modifying the original array.

  • return array
private static validateFileExists( $filePath)
 
  • throws ValidationException
private static validateGrpcSupport()
 
  • throws ValidationException
private static validateImpl( $arr, $requiredKeys, $allowNull)
Properties
private static $gapicVersionFromFile
Methods
private static defaultTransport()
 
  • return string
private static getClientDefaults()
private static getGapicVersion(array $options)
private static getGrpcDependencyStatus()
 
  • return bool
private static initGrpcGcpConfig( $hostName, $confPath)
public static validate( $arr, $requiredKeys)
 
  • return array Returns $arr for fluent use
private static validateFileExists( $filePath)
 
  • throws ValidationException
private static validateGrpcSupport()
 
  • throws ValidationException
private static validateImpl( $arr, $requiredKeys, $allowNull)
public static validateNotNull( $arr, $requiredKeys)
 
  • return array Returns $arr for fluent use
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only