Cloud Bigtable V2 Client - Class BigtableTableAdminClient (1.28.3)

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 \ V2

Methods

__construct

Constructor.

Parameters
NameDescription
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 false.

↳ 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 rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ 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
NameDescription
name string

Required. The unique name of the Table for which to check replication consistency. Values are of the form projects/{project}/instances/{instance}/tables/{table}.

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
TypeDescription
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
NameDescription
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: projects/{project}/instances/{instance}/clusters/{cluster}.

backupId string

Required. The id of the new backup. The backup_id along with parent are combined as {parent}/backups/{backup_id} to create the full backup name, of the form: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}. This string must be between 1 and 50 characters in length and match the regex [a-zA-Z0-9][-.a-zA-Z0-9]*.

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: projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>.

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 expire_time has passed, Cloud Bigtable will delete the backup and free the resources used by the backup.

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
TypeDescription
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
NameDescription
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 projects/{project}/instances/{instance}/clusters/{cluster}.

backupId string

Required. The id of the backup to be created. The backup_id along with the parent parent are combined as {parent}/backups/{backup_id} to create the full backup name, of the form: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}. This string must be between 1 and 50 characters in length and match the regex [a-zA-Z0-9][-.a-zA-Z0-9]*.

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
TypeDescription
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
NameDescription
parent string

Required. The unique name of the instance in which to create the table. Values are of the form projects/{project}/instances/{instance}.

tableId string

Required. The name by which the new table should be referred to within the parent instance, e.g., foobar rather than {parent}/tables/foobar. Maximum 50 characters.

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, s1 and s2, three tablets will be created, spanning the key ranges: [, s1), [s1, s2), [s2, ). Example: * Row keys := ["a", "apple", "custom", "customer_1", "customer_2", "other", "zz"] * initial_split_keys := ["apple", "customer_1", "customer_2", "other"] * Key assignment: - Tablet 1 [, apple) => {"a"}. - Tablet 2 [apple, customer_1) => {"apple", "custom"}. - Tablet 3 [customer_1, customer_2) => {"customer_1"}. - Tablet 4 [customer_2, other) => {"customer_2"}. - Tablet 5 [other, ) => {"other", "zz"}.

↳ 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
TypeDescription
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
NameDescription
parent string

Required. The unique name of the instance in which to create the table. Values are of the form projects/{project}/instances/{instance}.

tableId string

Required. The name by which the new table should be referred to within the parent instance, e.g., foobar rather than {parent}/tables/foobar.

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 projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}.

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
TypeDescription
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
NameDescription
name string

Required. Name of the backup to delete. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}.

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
NameDescription
name string

Required. The unique name of the snapshot to be deleted. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}.

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
NameDescription
name string

Required. The unique name of the table to be deleted. Values are of the form projects/{project}/instances/{instance}/tables/{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.

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
NameDescription
name string

Required. The unique name of the table on which to drop a range of rows. Values are of the form projects/{project}/instances/{instance}/tables/{table}.

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
NameDescription
name string

Required. The unique name of the Table for which to create a consistency token. Values are of the form projects/{project}/instances/{instance}/tables/{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
TypeDescription
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
NameDescription
name string

Required. Name of the backup. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}.

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
TypeDescription
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
NameDescription
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 GetPolicyOptions object for specifying options to GetIamPolicy.

↳ 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
TypeDescription
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
NameDescription
name string

Required. The unique name of the requested snapshot. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}.

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
TypeDescription
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
NameDescription
name string

Required. The unique name of the requested table. Values are of the form projects/{project}/instances/{instance}/tables/{table}.

optionalArgs array

Optional.

↳ view int

The view to be applied to the returned table's fields. Defaults to SCHEMA_VIEW if unspecified. For allowed values, use constants defined on Google\Cloud\Bigtable\Admin\V2\Table\View

↳ 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
TypeDescription
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
NameDescription
parent string

Required. The cluster to list backups from. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}. Use {cluster} = '-' to list backups for all clusters in an instance, e.g., projects/{project}/instances/{instance}/clusters/-.

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: * name * source_table * state * start_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * end_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * expire_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ) * size_bytes To filter on multiple expressions, provide each separate expression within parentheses. By default, each expression is an AND expression. However, you can include AND, OR, and NOT expressions explicitly. Some examples of using filters are: * name:"exact" --> The backup's name is the string "exact". * name:howl --> The backup's name contains the string "howl". * source_table:prod --> The source_table's name contains the string "prod". * state:CREATING --> The backup is pending creation. * state:READY --> The backup is fully created and ready for use. * (name:howl) AND (start_time < \"2018-03-28T14:50:00Z\") --> The backup name contains the string "howl" and start_time of the backup is before 2018-03-28T14:50:00Z. * size_bytes > 10000000000 --> The backup's size is greater than 10GB

↳ 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 start_time in descending order starting from the most recently created backup.

↳ 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
TypeDescription
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
NameDescription
parent string

Required. The unique name of the cluster for which snapshots should be listed. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}. Use {cluster} = '-' to list snapshots for all clusters in an instance, e.g., projects/{project}/instances/{instance}/clusters/-.

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
TypeDescription
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
NameDescription
parent string

Required. The unique name of the instance for which tables should be listed. Values are of the form projects/{project}/instances/{instance}.

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
TypeDescription
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
NameDescription
name string

Required. The unique name of the table whose families should be modified. Values are of the form projects/{project}/instances/{instance}/tables/{table}.

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
TypeDescription
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
NameDescription
parent string

Required. The name of the instance in which to create the restored table. Values are of the form projects/<project>/instances/<instance>.

tableId string

Required. The id of the table to create and restore to. This table must not already exist. The table_id appended to parent forms the full table name of the form projects/<project>/instances/<instance>/tables/<table_id>.

optionalArgs array

Optional.

↳ backup string

Name of the backup from which to restore. Values are of the form projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>.

↳ 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
TypeDescription
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
NameDescription
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 resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

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: paths: "bindings, etag"

↳ 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
TypeDescription
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
NameDescription
name string

Required. The unique name of the table to have the snapshot taken. Values are of the form projects/{project}/instances/{instance}/tables/{table}.

cluster string

Required. The name of the cluster where the snapshot will be created in. Values are of the form projects/{project}/instances/{instance}/clusters/{cluster}.

snapshotId string

Required. The ID by which the new snapshot should be referred to within the parent cluster, e.g., mysnapshot of the form: [_a-zA-Z0-9][-_.a-zA-Z0-9]* rather than projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot.

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
TypeDescription
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
NameDescription
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 resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

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
TypeDescription
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
NameDescription
name string

Required. The unique name of the table to be restored. Values are of the form projects/{project}/instances/{instance}/tables/{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
TypeDescription
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
NameDescription
backup Google\Cloud\Bigtable\Admin\V2\Backup

Required. The backup to update. backup.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored. Update is only supported for the following fields:

  • backup.expire_time.
updateMask Google\Protobuf\FieldMask

Required. A mask specifying which fields (e.g. expire_time) in the Backup resource should be updated. This mask is relative to the Backup resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally by clients that do not know about them.

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
TypeDescription
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
NameDescription
table Google\Cloud\Bigtable\Admin\V2\Table

Required. The table to update. The table's name field is used to identify the table to update.

updateMask Google\Protobuf\FieldMask

Required. The list of fields to update. A mask specifying which fields (e.g. change_stream_config) in the table field should be updated. This mask is relative to the table field, not to the request message. The wildcard (*) path is currently not supported. Currently UpdateTable is only supported for the following fields:

  • change_stream_config
  • change_stream_config.retention_period
  • deletion_protection

If column_families is set in update_mask, it will return an UNIMPLEMENTED error.

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
TypeDescription
Google\ApiCore\OperationResponse

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
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
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::backupName

Formats a string containing the fully-qualified path to represent a backup resource.

Parameters
NameDescription
project string
instance string
cluster string
backup string
Returns
TypeDescription
stringThe formatted backup resource.

static::clusterName

Formats a string containing the fully-qualified path to represent a cluster resource.

Parameters
NameDescription
project string
instance string
cluster string
Returns
TypeDescription
stringThe formatted cluster resource.

static::cryptoKeyVersionName

Formats a string containing the fully-qualified path to represent a crypto_key_version resource.

Parameters
NameDescription
project string
location string
keyRing string
cryptoKey string
cryptoKeyVersion string
Returns
TypeDescription
stringThe formatted crypto_key_version resource.

static::instanceName

Formats a string containing the fully-qualified path to represent a instance resource.

Parameters
NameDescription
project string
instance string
Returns
TypeDescription
stringThe formatted instance resource.

static::snapshotName

Formats a string containing the fully-qualified path to represent a snapshot resource.

Parameters
NameDescription
project string
instance string
cluster string
snapshot string
Returns
TypeDescription
stringThe formatted snapshot resource.

static::tableName

Formats a string containing the fully-qualified path to represent a table resource.

Parameters
NameDescription
project string
instance string
table string
Returns
TypeDescription
stringThe 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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn 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.