Reference documentation and code samples for the Cloud Spanner V1 Client class InstanceAdminClient.
Service Description: Cloud Spanner Instance Admin API
This class is currently experimental and may be subject to changes.
Namespace
Google \ Cloud \ Spanner \ Admin \ Instance \ V1 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
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 $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
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() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
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. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
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' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
createInstance
Creates an instance and begins preparing it to begin serving. The
returned long-running operation
can be used to track the progress of preparing the new
instance. The instance name is assigned by the caller. If the
named instance already exists, CreateInstance
returns
ALREADY_EXISTS
.
Immediately upon completion of this request:
- The instance is readable via the API, with all requested attributes
but no allocated resources. Its state is
CREATING
.
Until completion of the returned operation:
- Cancelling the operation renders the instance immediately unreadable via the API.
- The instance can be deleted.
- All other attempts to modify the instance are rejected.
Upon completion of the returned operation:
- Billing for all successfully-allocated resources begins (some types may have lower than the requested levels).
- Databases can be created in the instance.
- The instance's allocated resource levels are readable via the API.
- The instance's state becomes
READY
.
The returned long-running operation will
have a name of the format <instance_name>/operations/<operation_id>
and
can be used to track creation of the instance. The
metadata field type is
CreateInstanceMetadata.
The response field type is
Instance, if successful.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::createInstanceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
createInstanceConfig
Creates an instance config and begins preparing it to be used. The
returned long-running operation
can be used to track the progress of preparing the new
instance config. The instance config name is assigned by the caller. If the
named instance config already exists, CreateInstanceConfig
returns
ALREADY_EXISTS
.
Immediately after the request returns:
- The instance config is readable via the API, with all requested
attributes. The instance config's
reconciling
field is set to true. Its state is
CREATING
.
While the operation is pending:
- Cancelling the operation renders the instance config immediately unreadable via the API.
- Except for deleting the creating resource, all other attempts to modify the instance config are rejected.
Upon completion of the returned operation:
- Instances can be created using the instance configuration.
- The instance config's
reconciling
field becomes false. Its state becomes
READY
.
The returned long-running operation will
have a name of the format
<instance_config_name>/operations/<operation_id>
and can be used to track
creation of the instance config. The
metadata field type is
CreateInstanceConfigMetadata.
The response field type is
InstanceConfig, if
successful.
Authorization requires spanner.instanceConfigs.create
permission on
the resource
parent.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::createInstanceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
deleteInstance
Deletes an instance.
Immediately upon completion of the request:
- Billing ceases for all of the instance's reserved resources.
Soon afterward:
- The instance and all of its databases immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::deleteInstanceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
deleteInstanceConfig
Deletes the instance config. Deletion is only allowed when no
instances are using the configuration. If any instances are using
the config, returns FAILED_PRECONDITION
.
Only user managed configurations can be deleted.
Authorization requires spanner.instanceConfigs.delete
permission on
the resource name.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::deleteInstanceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
getIamPolicy
Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.
Authorization requires spanner.instances.getIamPolicy
on
resource.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::getIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
getInstance
Gets information about a particular instance.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::getInstanceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Spanner\Admin\Instance\V1\Instance |
getInstanceConfig
Gets information about a particular instance configuration.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::getInstanceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig |
listInstanceConfigOperations
Lists the user-managed instance config long-running
operations in the given project. An instance
config operation has a name of the form
projects/<project>/instanceConfigs/<instance_config>/operations/<operation>
.
The long-running operation
metadata field type
metadata.type_url
describes the type of the metadata. Operations returned
include those that have completed/failed/canceled within the last 7 days,
and pending operations. Operations returned are ordered by
operation.metadata.value.start_time
in descending order starting
from the most recently started operation.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::listInstanceConfigOperationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
listInstanceConfigs
Lists the supported instance configurations for a given project.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::listInstanceConfigsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
listInstances
Lists all instances in the given project.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::listInstancesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
setIamPolicy
Sets the access control policy on an instance resource. Replaces any existing policy.
Authorization requires spanner.instances.setIamPolicy
on
resource.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::setIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
testIamPermissions
Returns permissions that the caller has on the specified instance resource.
Attempting this RPC on a non-existent Cloud Spanner instance resource will
result in a NOT_FOUND error if the user has spanner.instances.list
permission on the containing Google Cloud Project. Otherwise returns an
empty set of permissions.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::testIamPermissionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
updateInstance
Updates an instance, and begins allocating or releasing resources
as requested. The returned long-running
operation can be used to track the
progress of updating the instance. If the named instance does not
exist, returns NOT_FOUND
.
Immediately upon completion of this request:
- For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.
Until completion of the returned operation:
- Cancelling the operation sets its metadata's
cancel_time,
and begins restoring resources to their pre-request values. The
operation is guaranteed to succeed at undoing all resource changes,
after which point it terminates with a
CANCELLED
status. - All other attempts to modify the instance are rejected.
- Reading the instance via the API continues to give the pre-request resource levels.
Upon completion of the returned operation:
- Billing begins for all successfully-allocated resources (some types may have lower than the requested levels).
- All newly-reserved resources are available for serving the instance's tables.
- The instance's new resource levels are readable via the API.
The returned long-running operation will
have a name of the format <instance_name>/operations/<operation_id>
and
can be used to track the instance modification. The
metadata field type is
UpdateInstanceMetadata.
The response field type is
Instance, if successful.
Authorization requires spanner.instances.update
permission on
the resource name.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::updateInstanceAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
updateInstanceConfig
Updates an instance config. The returned
long-running operation can be used to track
the progress of updating the instance. If the named instance config does
not exist, returns NOT_FOUND
.
Only user managed configurations can be updated.
Immediately after the request returns:
- The instance config's reconciling field is set to true.
While the operation is pending:
- Cancelling the operation sets its metadata's
cancel_time.
The operation is guaranteed to succeed at undoing all changes, after
which point it terminates with a
CANCELLED
status. - All other attempts to modify the instance config are rejected.
- Reading the instance config via the API continues to give the pre-request values.
Upon completion of the returned operation:
- Creating instances using the instance configuration uses the new values.
- The instance config's new values are readable via the API.
- The instance config's reconciling field becomes false.
The returned long-running operation will
have a name of the format
<instance_config_name>/operations/<operation_id>
and can be used to track
the instance config modification. The
metadata field type is
UpdateInstanceConfigMetadata.
The response field type is
InstanceConfig, if
successful.
Authorization requires spanner.instanceConfigs.update
permission on
the resource name.
The async variant is Google\Cloud\Spanner\Admin\Instance\V1\Client\BaseClient\self::updateInstanceConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
createInstanceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createInstanceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteInstanceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteInstanceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getInstanceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getInstanceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listInstanceConfigOperationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listInstanceConfigsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listInstancesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
setIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
testIamPermissionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateInstanceAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateInstanceConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
static::instanceName
Formats a string containing the fully-qualified path to represent a instance resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted instance resource. |
static::instanceConfigName
Formats a string containing the fully-qualified path to represent a instance_config resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instanceConfig |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted instance_config resource. |
static::projectName
Formats a string containing the fully-qualified path to represent a project resource.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- instance: projects/{project}/instances/{instance}
- instanceConfig: projects/{project}/instanceConfigs/{instance_config}
- project: projects/{project}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |