Cloud Spanner Client - Class InstanceConfiguration (2.0.0-RC1)

Reference documentation and code samples for the Cloud Spanner Client class InstanceConfiguration.

Represents a Cloud Spanner Instance Configuration.

Example:

use Google\Cloud\Spanner\SpannerClient;

$spanner = new SpannerClient(['projectId' => $projectId]);

$configuration = $spanner->instanceConfiguration('regional-europe-west');

Namespace

Google \ Cloud \ Spanner

Methods

__construct

Create an instance configuration object.

Parameters
Name Description
instanceAdminClient Admin\Instance\V1\Client\InstanceAdminClient

The client library to use for the request

serializer Serializer

The serializer instance to encode/decode messages.

projectId string

The current project ID.

name string

The configuration name or ID.

options array

[Optional] { Instance Configuration options.

@type array $instanceConfig The instance configuration info.

}

name

Return the configuration name.

Example:

$name = $configuration->name();
Returns
Type Description
string

info

Return the service representation of the configuration.

This method may require a service call.

NOTE: Requires https://www.googleapis.com/auth/spanner.admin scope.

Example:

$info = $configuration->info();
Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
array [InstanceConfig](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#instanceconfig)

exists

Check if the configuration exists.

This method requires a service call.

NOTE: Requires https://www.googleapis.com/auth/spanner.admin scope.

Example:

if ($configuration->exists()) {
   echo 'Configuration exists!';
}
Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
bool

reload

Fetch a fresh representation of the configuration from the service.

NOTE: Requires https://www.googleapis.com/auth/spanner.admin scope.

Example:

$info = $configuration->reload();
Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
array [InstanceConfig](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#instanceconfig)

create

Parameters
Name Description
baseConfig InstanceConfiguration

The base configuration to extend for this custom instance configuration.

replicas array<Admin\Instance\V1\ReplicaInfo>|array

The replica information for the new instance configuration. This array must contain all the replicas from the base configuration, plus at least one from list of optional replicas of the base configuration. One of the replicas must be set as the default leader location.

options array

Configuration options

↳ displayName string

Defaults to the name of this instance configuration.

↳ leaderOptions array

Allowed values of the "default_leader" schema option for databases in instances that use this instance configuration. Defaults to the leader options of the base configuration. Please note it may be possible for the default value to be an empty array when lazy loading the base configuration. To ensure the default value matches the upstream values please make sure to trigger a network request on the base configuration with either InstanceConfiguration::reload() or InstanceConfiguration::info().

↳ labels array

For more information, see Using labels to organize Google Cloud Platform resources.

↳ validateOnly bool

An option to validate, but not actually execute, the request, and provide the same response. Defaults to false.

Returns
Type Description
Google\Cloud\Core\LongRunning\LongRunningOperation

update

Parameters
Name Description
options array

Configuration options

↳ displayName string

The descriptive name for this instance as it appears in UIs. Defaults to the name of this instance configuration.

↳ labels array

For more information, see Using labels to organize Google Cloud Platform resources.

↳ validateOnly bool

An option to validate, but not actually execute, the request, and provide the same response. Defaults to false.

Returns
Type Description
Google\Cloud\Core\LongRunning\LongRunningOperation

delete

Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
void

resumeOperation

Resume a Long Running Operation

Example:

$operation = $spanner->resumeOperation($operationName);
Parameters
Name Description
operationName string

The Long Running Operation name.

options array
Returns
Type Description
Google\Cloud\Core\LongRunning\LongRunningOperation

__debugInfo

A more readable representation of the object.