Reference documentation and code samples for the Cloud Bigtable V2 Client class BigtableTableAdminClient.
Service Description: Service for creating, configuring, and deleting Cloud Bigtable tables.
Provides access to the table schemas only, not the data stored within the tables.
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:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$consistencyToken = 'consistency_token';
$response = $bigtableTableAdminClient->checkConsistency($formattedName, $consistencyToken);
} finally {
$bigtableTableAdminClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
This service has a new (beta) implementation. See Google\Cloud\Bigtable\Admin\V2\Client\BigtableTableAdminClient to use the new surface.
Namespace
Google \ Cloud \ Bigtable \ Admin \ V2Methods
__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. |
checkConsistency
Checks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$consistencyToken = 'consistency_token';
$response = $bigtableTableAdminClient->checkConsistency($formattedName, $consistencyToken);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the Table for which to check replication
consistency. Values are of the form
|
consistencyToken |
string
Required. The token created using GenerateConsistencyToken for the Table. |
optionalArgs |
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\Bigtable\Admin\V2\CheckConsistencyResponse |
copyBackup
Copy a Cloud Bigtable backup to a new backup in the destination cluster located in the destination instance and project.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
$backupId = 'backup_id';
$formattedSourceBackup = $bigtableTableAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[BACKUP]');
$expireTime = new Timestamp();
$operationResponse = $bigtableTableAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'copyBackup');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the destination cluster that will contain the backup
copy. The cluster must already exists. Values are of the form:
|
backupId |
string
Required. The id of the new backup. The |
sourceBackup |
string
Required. The source backup to be copied from.
The source backup needs to be in READY state for it to be copied.
Copying a copied backup is not allowed.
Once CopyBackup is in progress, the source backup cannot be deleted or
cleaned up on expiration until CopyBackup is finished.
Values are of the form:
|
expireTime |
Google\Protobuf\Timestamp
Required. Required. The expiration time of the copied backup with
microsecond granularity that must be at least 6 hours and at most 30 days
from the time the request is received. Once the |
optionalArgs |
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 |
createBackup
Starts creating a new Cloud Bigtable Backup. The returned backup long-running operation can be used to track creation of the backup. The metadata field type is CreateBackupMetadata. The response field type is Backup, if successful. Cancelling the returned operation will stop the creation and delete the backup.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
$backupId = 'backup_id';
$backup = new Backup();
$operationResponse = $bigtableTableAdminClient->createBackup($formattedParent, $backupId, $backup);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->createBackup($formattedParent, $backupId, $backup);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'createBackup');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. This must be one of the clusters in the instance in which this
table is located. The backup will be stored in this cluster. Values are
of the form |
backupId |
string
Required. The id of the backup to be created. The |
backup |
Google\Cloud\Bigtable\Admin\V2\Backup
Required. The backup to create. |
optionalArgs |
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 |
createTable
Creates a new table in the specified instance.
The table can be created with a full set of initial column families, specified in the request.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
$tableId = 'table_id';
$table = new Google\Cloud\Bigtable\Admin\V2\Table();
$response = $bigtableTableAdminClient->createTable($formattedParent, $tableId, $table);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The unique name of the instance in which to create the table.
Values are of the form |
tableId |
string
Required. The name by which the new table should be referred to within the
parent instance, e.g., |
table |
Google\Cloud\Bigtable\Admin\V2\Table
Required. The Table to create. |
optionalArgs |
array
Optional. |
↳ initialSplits |
Split[]
The optional list of row keys that will be used to initially split the table into several tablets (tablets are similar to HBase regions). Given two split keys, |
↳ 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\Bigtable\Admin\V2\Table |
createTableFromSnapshot
Creates a new table from the specified snapshot. The target table must not exist. The snapshot and the table must be in the same instance.
Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
$tableId = 'table_id';
$formattedSourceSnapshot = $bigtableTableAdminClient->snapshotName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]');
$operationResponse = $bigtableTableAdminClient->createTableFromSnapshot($formattedParent, $tableId, $formattedSourceSnapshot);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->createTableFromSnapshot($formattedParent, $tableId, $formattedSourceSnapshot);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'createTableFromSnapshot');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The unique name of the instance in which to create the table.
Values are of the form |
tableId |
string
Required. The name by which the new table should be referred to within the
parent instance, e.g., |
sourceSnapshot |
string
Required. The unique name of the snapshot from which to restore the table.
The snapshot and the table must be in the same instance. Values are of the
form
|
optionalArgs |
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 |
deleteBackup
Deletes a pending or completed Cloud Bigtable backup.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[BACKUP]');
$bigtableTableAdminClient->deleteBackup($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the backup to delete.
Values are of the form
|
optionalArgs |
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. |
deleteSnapshot
Permanently deletes the specified snapshot.
Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->snapshotName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]');
$bigtableTableAdminClient->deleteSnapshot($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the snapshot to be deleted.
Values are of the form
|
optionalArgs |
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. |
deleteTable
Permanently deletes a specified table and all of its data.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$bigtableTableAdminClient->deleteTable($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the table to be deleted.
Values are of the form
|
optionalArgs |
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. |
dropRowRange
Permanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$bigtableTableAdminClient->dropRowRange($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the table on which to drop a range of rows.
Values are of the form
|
optionalArgs |
array
Optional. |
↳ rowKeyPrefix |
string
Delete all rows that start with this row key prefix. Prefix cannot be zero length. |
↳ deleteAllDataFromTable |
bool
Delete all rows in the table. Setting this to false is a no-op. |
↳ 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. |
generateConsistencyToken
Generates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$response = $bigtableTableAdminClient->generateConsistencyToken($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the Table for which to create a consistency
token. Values are of the form
|
optionalArgs |
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\Bigtable\Admin\V2\GenerateConsistencyTokenResponse |
getBackup
Gets metadata on a pending or completed Cloud Bigtable Backup.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[BACKUP]');
$response = $bigtableTableAdminClient->getBackup($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the backup.
Values are of the form
|
optionalArgs |
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\Bigtable\Admin\V2\Backup |
getIamPolicy
Gets the access control policy for a Table or Backup resource.
Returns an empty policy if the resource exists but does not have a policy set.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$resource = 'resource';
$response = $bigtableTableAdminClient->getIamPolicy($resource);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
optionalArgs |
array
Optional. |
↳ options |
GetPolicyOptions
OPTIONAL: A |
↳ 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 |
getSnapshot
Gets metadata information about the specified snapshot.
Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->snapshotName('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]');
$response = $bigtableTableAdminClient->getSnapshot($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the requested snapshot.
Values are of the form
|
optionalArgs |
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\Bigtable\Admin\V2\Snapshot |
getTable
Gets metadata information about the specified table.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$response = $bigtableTableAdminClient->getTable($formattedName);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the requested table.
Values are of the form
|
optionalArgs |
array
Optional. |
↳ view |
int
The view to be applied to the returned table's fields. Defaults to |
↳ 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\Bigtable\Admin\V2\Table |
listBackups
Lists Cloud Bigtable backups. Returns both completed and pending backups.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
// Iterate over pages of elements
$pagedResponse = $bigtableTableAdminClient->listBackups($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $bigtableTableAdminClient->listBackups($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The cluster to list backups from. Values are of the
form |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters backups listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be <, >, <=, >=, !=, =, or :. Colon ':' represents a HAS operator which is roughly synonymous with equality. Filter rules are case insensitive. The fields eligible for filtering are: * |
↳ orderBy |
string
An expression for specifying the sort order of the results of the request. The string value should specify one or more fields in Backup. The full syntax is described at https://aip.dev/132#ordering. Fields supported are: * name * source_table * expire_time * start_time * end_time * size_bytes * state For example, "start_time". The default sorting order is ascending. To specify descending order for the field, a suffix " desc" should be appended to the field name. For example, "start_time desc". Redundant space characters in the syntax are insigificant. If order_by is empty, results will be sorted by |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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 |
listSnapshots
Lists all snapshots associated with the specified cluster.
Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
// Iterate over pages of elements
$pagedResponse = $bigtableTableAdminClient->listSnapshots($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $bigtableTableAdminClient->listSnapshots($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The unique name of the cluster for which snapshots should be
listed. Values are of the form
|
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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 |
listTables
Lists all tables served from a specified instance.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
// Iterate over pages of elements
$pagedResponse = $bigtableTableAdminClient->listTables($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $bigtableTableAdminClient->listTables($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The unique name of the instance for which tables should be
listed. Values are of the form |
optionalArgs |
array
Optional. |
↳ view |
int
The view to be applied to the returned tables' fields. NAME_ONLY view (default) and REPLICATION_VIEW are supported. For allowed values, use constants defined on Google\Cloud\Bigtable\Admin\V2\Table\View |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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 |
modifyColumnFamilies
Performs a series of column family modifications on the specified table.
Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$modifications = [];
$response = $bigtableTableAdminClient->modifyColumnFamilies($formattedName, $modifications);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the table whose families should be modified.
Values are of the form
|
modifications |
array<Google\Cloud\Bigtable\Admin\V2\ModifyColumnFamiliesRequest\Modification>
Required. Modifications to be atomically applied to the specified table's families. Entries are applied in order, meaning that earlier modifications can be masked by later ones (in the case of repeated updates to the same family, for example). |
optionalArgs |
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\Bigtable\Admin\V2\Table |
restoreTable
Create a new table by restoring from a completed backup. The returned table long-running operation can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreTableMetadata. The response type is Table, if successful.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedParent = $bigtableTableAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
$tableId = 'table_id';
$operationResponse = $bigtableTableAdminClient->restoreTable($formattedParent, $tableId);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->restoreTable($formattedParent, $tableId);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'restoreTable');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the instance in which to create the restored
table. Values are of the form |
tableId |
string
Required. The id of the table to create and restore to. This
table must not already exist. The |
optionalArgs |
array
Optional. |
↳ backup |
string
Name of the backup from which to restore. Values are of the form |
↳ 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 |
setIamPolicy
Sets the access control policy on a Table or Backup resource.
Replaces any existing policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$resource = 'resource';
$policy = new Google\Cloud\Iam\V1\Policy();
$response = $bigtableTableAdminClient->setIamPolicy($resource, $policy);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
Google\Cloud\Iam\V1\Policy
REQUIRED: The complete policy to be applied to the |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: |
↳ 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 |
snapshotTable
Creates a new snapshot in the specified cluster from the specified source table. The cluster and the table must be in the same instance.
Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not currently available to most Cloud Bigtable customers. This feature might be changed in backward-incompatible ways and is not recommended for production use. It is not subject to any SLA or deprecation policy.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$formattedCluster = $bigtableTableAdminClient->clusterName('[PROJECT]', '[INSTANCE]', '[CLUSTER]');
$snapshotId = 'snapshot_id';
$operationResponse = $bigtableTableAdminClient->snapshotTable($formattedName, $formattedCluster, $snapshotId);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->snapshotTable($formattedName, $formattedCluster, $snapshotId);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'snapshotTable');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the table to have the snapshot taken.
Values are of the form
|
cluster |
string
Required. The name of the cluster where the snapshot will be created in.
Values are of the form
|
snapshotId |
string
Required. The ID by which the new snapshot should be referred to within the
parent cluster, e.g., |
optionalArgs |
array
Optional. |
↳ ttl |
Duration
The amount of time that the new snapshot can stay active after it is created. Once 'ttl' expires, the snapshot will get deleted. The maximum amount of time a snapshot can stay active is 7 days. If 'ttl' is not specified, the default value of 24 hours will be used. |
↳ description |
string
Description of the snapshot. |
↳ 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 |
testIamPermissions
Returns permissions that the caller has on the specified Table or Backup resource.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$resource = 'resource';
$permissions = [];
$response = $bigtableTableAdminClient->testIamPermissions($resource, $permissions);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
string[]
The set of permissions to check for the |
optionalArgs |
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 |
undeleteTable
Restores a specified table which was accidentally deleted.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$formattedName = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]');
$operationResponse = $bigtableTableAdminClient->undeleteTable($formattedName);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->undeleteTable($formattedName);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'undeleteTable');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
name |
string
Required. The unique name of the table to be restored.
Values are of the form
|
optionalArgs |
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 |
updateBackup
Updates a pending or completed Cloud Bigtable Backup.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$backup = new Backup();
$updateMask = new Google\Protobuf\FieldMask();
$response = $bigtableTableAdminClient->updateBackup($backup, $updateMask);
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
backup |
Google\Cloud\Bigtable\Admin\V2\Backup
Required. The backup to update.
|
updateMask |
Google\Protobuf\FieldMask
Required. A mask specifying which fields (e.g. |
optionalArgs |
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\Bigtable\Admin\V2\Backup |
updateTable
Updates a specified table.
Sample code:
$bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
try {
$table = new Google\Cloud\Bigtable\Admin\V2\Table();
$updateMask = new Google\Protobuf\FieldMask();
$operationResponse = $bigtableTableAdminClient->updateTable($table, $updateMask);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $bigtableTableAdminClient->updateTable($table, $updateMask);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'updateTable');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$bigtableTableAdminClient->close();
}
Parameters | |
---|---|
Name | Description |
table |
Google\Cloud\Bigtable\Admin\V2\Table
Required. The table to update.
The table's |
updateMask |
Google\Protobuf\FieldMask
Required. The list of fields to update.
A mask specifying which fields (e.g.
If |
optionalArgs |
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 |
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::backupName
Formats a string containing the fully-qualified path to represent a backup resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
cluster |
string
|
backup |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted backup resource. |
static::clusterName
Formats a string containing the fully-qualified path to represent a cluster resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
cluster |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted cluster resource. |
static::cryptoKeyVersionName
Formats a string containing the fully-qualified path to represent a crypto_key_version resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
keyRing |
string
|
cryptoKey |
string
|
cryptoKeyVersion |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted crypto_key_version resource. |
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::snapshotName
Formats a string containing the fully-qualified path to represent a snapshot resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
cluster |
string
|
snapshot |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted snapshot resource. |
static::tableName
Formats a string containing the fully-qualified path to represent a table resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
instance |
string
|
table |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted table 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
- backup: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}
- cluster: projects/{project}/instances/{instance}/clusters/{cluster}
- cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
- instance: projects/{project}/instances/{instance}
- snapshot: projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}
- table: projects/{project}/instances/{instance}/tables/{table}
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. |
Constants
SERVICE_NAME
Value: 'google.bigtable.admin.v2.BigtableTableAdmin'
The name of the service.
SERVICE_ADDRESS
Value: 'bigtableadmin.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.