class ClientOptions implements ArrayAccess (View source)

The ClientOptions class adds typing to the associative array of options passed into each API client constructor. To use this class directly, pass the result of {ClientOptions::toArray} to the client constructor:

use Google\ApiCore\ClientOptions;
use Google\Cloud\SecretManager\Client\SecretManagerClient;

$options = new ClientOptions([
    'credentials' => '/path/to/my/credentials.json'
]);
$secretManager = new SecretManagerClient($options->toArray());

Note: It's possible to pass an associative array to the API clients as well, as ClientOptions will still be used internally for validation.

Traits

Trait implemented by any class representing an associative array of PHP options.

Methods

bool
offsetExists($offset)

No description

offsetGet($offset)

No description

void
offsetSet($offset, $value)

No description

void
offsetUnset($offset)

No description

array
toArray()

No description

__construct(array $options)

No description

void
setApiEndpoint(string|null $apiEndpoint)

No description

void
setDisableRetries(bool $disableRetries)

No description

void
setClientConfig(string|array $clientConfig)

No description

void
setCredentials(string|array|FetchAuthTokenInterface|CredentialsWrapper|null $credentials)

No description

void
setCredentialsConfig(array $credentialsConfig)

No description

void
setTransport(string|TransportInterface|null $transport)

No description

void
setTransportConfig(TransportOptions $transportConfig)

No description

void
setVersionFile(string|null $versionFile)

No description

void
setServiceName(string|null $serviceName)

No description

void
setLibName(string|null $libName)

No description

void
setLibVersion(string|null $libVersion)

No description

void
setGapicVersion(string|null $gapicVersion)

No description

setClientCertSource(callable|null $clientCertSource)

No description

setUniverseDomain(string|null $universeDomain)

No description

Details

bool offsetExists($offset)

No description

Parameters

$offset

Return Value

bool

offsetGet($offset)

No description

Parameters

$offset

void offsetSet($offset, $value)

No description

Parameters

$offset
$value

Return Value

void

Exceptions

BadMethodCallException

void offsetUnset($offset)

No description

Parameters

$offset

Return Value

void

Exceptions

BadMethodCallException

array toArray()

No description

Return Value

array

__construct(array $options)

No description

Parameters

array $options

{ @type string $apiEndpoint The address of the API remote host, for example "example.googleapis.com. May also include the port, for example "example.googleapis.com:443" @type bool $disableRetries Determines whether or not retries defined by the client configuration should be disabled. Defaults to false. @type string|array $clientConfig Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed \Google\Auth\FetchAuthTokenInterface object or \Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $authConfig will be ignored. @type array $credentialsConfig Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see \Google\ApiCore\CredentialsWrapper::build. @type string|TransportInterface|null $transport The transport used for executing network requests. May be either the string rest, grpc, or 'grpc-fallback'. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated TransportInterface object. Note that when this objects is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored. @type array $transportConfig Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], 'grpc-fallback' => [...], ]; See the GrpcTransport::build and RestTransport::build methods for the supported options. @type string $versionFile The path to a file which contains the current version of the client. @type string $descriptorsConfigPath The path to a descriptor configuration file. @type string $serviceName The name of the service. @type string $libName The name of the client application. @type string $libVersion The version of the client application. @type string $gapicVersion The code generator version of the GAPIC library. @type callable $clientCertSource A callable which returns the client cert as a string. @type string $universeDomain The default service domain for a given Cloud universe. }

void setApiEndpoint(string|null $apiEndpoint)

No description

Parameters

string|null $apiEndpoint

Return Value

void

void setDisableRetries(bool $disableRetries)

No description

Parameters

bool $disableRetries

Return Value

void

void setClientConfig(string|array $clientConfig)

No description

Parameters

string|array $clientConfig

Return Value

void

Exceptions

InvalidArgumentException

void setCredentials(string|array|FetchAuthTokenInterface|CredentialsWrapper|null $credentials)

No description

Parameters

string|array|FetchAuthTokenInterface|CredentialsWrapper|null $credentials

Return Value

void

void setCredentialsConfig(array $credentialsConfig)

No description

Parameters

array $credentialsConfig

Return Value

void

void setTransport(string|TransportInterface|null $transport)

No description

Parameters

string|TransportInterface|null $transport

Return Value

void

void setTransportConfig(TransportOptions $transportConfig)

No description

Parameters

TransportOptions $transportConfig

Return Value

void

void setVersionFile(string|null $versionFile)

No description

Parameters

string|null $versionFile

Return Value

void

void setServiceName(string|null $serviceName)

No description

Parameters

string|null $serviceName

Return Value

void

void setLibName(string|null $libName)

No description

Parameters

string|null $libName

Return Value

void

void setLibVersion(string|null $libVersion)

No description

Parameters

string|null $libVersion

Return Value

void

void setGapicVersion(string|null $gapicVersion)

No description

Parameters

string|null $gapicVersion

Return Value

void

setClientCertSource(callable|null $clientCertSource)

No description

Parameters

callable|null $clientCertSource

setUniverseDomain(string|null $universeDomain)

No description

Parameters

string|null $universeDomain