Google Cloud Bigtable C++ Client
1.42.0
A C++ Client Library for Google Cloud Bigtable
|
Implements the API to administer tables in a Cloud Bigtable instance. More...
#include <google/cloud/bigtable/table_admin.h>
Classes | |
struct | CreateBackupParams |
Parameters for CreateBackup . More... | |
struct | ListBackupsParams |
Parameters for ListBackups . More... | |
struct | RestoreTableFromInstanceParams |
Parameters for RestoreTable . More... | |
struct | RestoreTableParams |
Parameters for RestoreTable . More... | |
struct | UpdateBackupParams |
Parameters for UpdateBackup . More... | |
Public Member Functions | |
TableAdmin (std::shared_ptr< AdminClient > client, std::string instance_id) | |
template<typename... Policies> | |
TableAdmin (std::shared_ptr< AdminClient > client, std::string instance_id, Policies &&... policies) | |
Create a new TableAdmin using explicit policies to handle RPC errors. More... | |
TableAdmin (TableAdmin const &)=default | |
TableAdmin & | operator= (TableAdmin const &)=default |
Convenience shorthands for the schema views. | |
using | TableView = ::google::bigtable::admin::v2::Table::View |
Only populate 'name' and fields related to the table's encryption state. More... | |
static constexpr auto | ENCRYPTION_VIEW |
Only populate 'name' and fields related to the table's encryption state. More... | |
static constexpr auto | FULL |
Populate all the fields in the response. More... | |
static constexpr auto | NAME_ONLY |
Populate only the name in the responses. More... | |
static constexpr auto | REPLICATION_VIEW |
Populate only the name and the fields related to the table replication state. More... | |
static constexpr auto | SCHEMA_VIEW |
Populate only the name and the fields related to the table schema. More... | |
static constexpr auto | VIEW_UNSPECIFIED |
Use the default view as defined for each function. More... | |
std::string const & | project () const |
Only populate 'name' and fields related to the table's encryption state. More... | |
std::string const & | instance_id () const |
Only populate 'name' and fields related to the table's encryption state. More... | |
std::string const & | instance_name () const |
Only populate 'name' and fields related to the table's encryption state. More... | |
TableAdmin | WithNewTarget (std::string project_id, std::string instance_id) const |
Returns a TableAdmin that reuses the connection and configuration of this TableAdmin, but with a different resource name. More... | |
StatusOr<::google::bigtable::admin::v2::Table > | CreateTable (std::string table_id, TableConfig config) |
Create a new table in the instance. More... | |
StatusOr< std::vector<::google::bigtable::admin::v2::Table > > | ListTables (::google::bigtable::admin::v2::Table::View view) |
Return all the tables in the instance. More... | |
StatusOr<::google::bigtable::admin::v2::Table > | GetTable (std::string const &table_id, TableView view=SCHEMA_VIEW) |
Get information about a single table. More... | |
Status | DeleteTable (std::string const &table_id) |
Delete a table. More... | |
StatusOr< google::bigtable::admin::v2::Backup > | CreateBackup (CreateBackupParams const ¶ms) |
Create a new backup of a table in the instance. More... | |
StatusOr< google::bigtable::admin::v2::Backup > | GetBackup (std::string const &cluster_id, std::string const &backup_id) |
Get information about a single backup. More... | |
StatusOr< google::bigtable::admin::v2::Backup > | UpdateBackup (UpdateBackupParams const ¶ms) |
Updates a backup of a table in the instance. More... | |
Status | DeleteBackup (std::string const &cluster_id, std::string const &backup_id) |
Delete a backup. More... | |
Status | DeleteBackup (google::bigtable::admin::v2::Backup const &backup) |
Delete a backup. More... | |
StatusOr< std::vector< google::bigtable::admin::v2::Backup > > | ListBackups (ListBackupsParams const ¶ms) |
Retrieves a list of backups. More... | |
StatusOr< google::bigtable::admin::v2::Table > | RestoreTable (RestoreTableParams const ¶ms) |
Restore a backup into a new table in the instance. More... | |
StatusOr< google::bigtable::admin::v2::Table > | RestoreTable (RestoreTableFromInstanceParams params) |
Restore a backup into a new table in the instance. More... | |
StatusOr<::google::bigtable::admin::v2::Table > | ModifyColumnFamilies (std::string const &table_id, std::vector< ColumnFamilyModification > modifications) |
Modify the schema for an existing table. More... | |
Status | DropRowsByPrefix (std::string const &table_id, std::string row_key_prefix) |
Delete all the rows that start with a given prefix. More... | |
StatusOr< std::string > | GenerateConsistencyToken (std::string const &table_id) |
Generates consistency token for a table. More... | |
StatusOr< Consistency > | CheckConsistency (std::string const &table_id, std::string const &consistency_token) |
Checks consistency of a table. More... | |
google::cloud::future< StatusOr< Consistency > > | WaitForConsistency (std::string const &table_id, std::string const &consistency_token) |
Checks consistency of a table with multiple calls using a separate thread. More... | |
Status | DropAllRows (std::string const &table_id) |
Delete all the rows in a table. More... | |
StatusOr< google::iam::v1::Policy > | GetIamPolicy (std::string const &table_id) |
Gets the policy for table_id . More... | |
StatusOr< google::iam::v1::Policy > | GetIamPolicy (std::string const &cluster_id, std::string const &backup_id) |
Gets the policy for backup_id . More... | |
StatusOr< google::iam::v1::Policy > | SetIamPolicy (std::string const &table_id, google::iam::v1::Policy const &iam_policy) |
Sets the IAM policy for a table. More... | |
StatusOr< google::iam::v1::Policy > | SetIamPolicy (std::string const &cluster_id, std::string const &backup_id, google::iam::v1::Policy const &iam_policy) |
Sets the IAM policy for a backup. More... | |
StatusOr< std::vector< std::string > > | TestIamPermissions (std::string const &table_id, std::vector< std::string > const &permissions) |
Returns a permission set that the caller has on the specified table. More... | |
StatusOr< std::vector< std::string > > | TestIamPermissions (std::string const &cluster_id, std::string const &backup_id, std::vector< std::string > const &permissions) |
Returns a permission set that the caller has on the specified backup. More... | |
std::string | TableName (std::string const &table_id) const |
Return the fully qualified name of a table in this object's instance. More... | |
std::string | ClusterName (std::string const &cluster_id) const |
Return the fully qualified name of a Cluster. More... | |
std::string | BackupName (std::string const &cluster_id, std::string const &backup_id) const |
Return the fully qualified name of a Backup. More... | |
Implements the API to administer tables in a Cloud Bigtable instance.
TableAdmin
is comparable to creating a few objects of type std::string
or a few objects of type std::shared_ptr<int>
. The class represents a shallow handle to a remote object.StatusOr<T>
to report errors. When an operation fails to perform its work the returned StatusOr<T>
contains the error details. If the ok()
member function in the StatusOr<T>
returns true
then it contains the expected result. Operations that do not return a value simply return a google::cloud::Status
indicating success or the details of the error Please consult the StatusOr<T>
documentation for more details.In addition, the main page contains examples using StatusOr<T>
to handle errors.
The application can override these policies when constructing objects of this class. The documentation for the constructors show examples of this in action.
LimitedTimeRetryPolicy
and LimitedErrorCountRetryPolicy
for alternative retry policies.ExponentialBackoffPolicy
to configure different parameters for the exponential backoff policy.SafeIdempotentMutationPolicy
and AlwaysRetryMutationPolicy
for alternative idempotency policies. Definition at line 141 of file table_admin.h.
using google::cloud::bigtable::TableAdmin::TableView = ::google::bigtable::admin::v2::Table::View |
Only populate 'name' and fields related to the table's encryption state.
Definition at line 218 of file table_admin.h.
|
inline |
client | the interface to create grpc stubs, report errors, etc. |
instance_id | the id of the instance, e.g., "my-instance", the full name (e.g. '/projects/my-project/instances/my-instance') is built using the project id in the client parameter. |
Definition at line 150 of file table_admin.h.
|
inline |
Create a new TableAdmin using explicit policies to handle RPC errors.
client | the interface to create grpc stubs, report errors, etc. |
instance_id | the id of the instance, e.g., "my-instance", the full name (e.g. '/projects/my-project/instances/my-instance') is built using the project id in the client parameter. |
policies | the set of policy overrides for this object. |
Policies | the types of the policies to override, the types must derive from one of the following types:
|
Definition at line 194 of file table_admin.h.
|
default |
|
inline |
Return the fully qualified name of a Backup.
Definition at line 1039 of file table_admin.h.
StatusOr<Consistency> google::cloud::bigtable::TableAdmin::CheckConsistency | ( | std::string const & | table_id, |
std::string const & | consistency_token | ||
) |
Checks consistency of a table.
table_id | the id of the table for which we want to check consistency. |
consistency_token | the consistency token of the table. |
|
inline |
Return the fully qualified name of a Cluster.
Definition at line 1033 of file table_admin.h.
StatusOr<google::bigtable::admin::v2::Backup> google::cloud::bigtable::TableAdmin::CreateBackup | ( | CreateBackupParams const & | params | ) |
Create a new backup of a table in the instance.
params | instance of CreateBackupParams . |
StatusOr<::google::bigtable::admin::v2::Table> google::cloud::bigtable::TableAdmin::CreateTable | ( | std::string | table_id, |
TableConfig | config | ||
) |
Create a new table in the instance.
table_id | the name of the table relative to the instance managed by this object. The full table name is projects/<PROJECT_ID>/instances/<INSTANCE_ID>/tables/<table_id> where PROJECT_ID is obtained from the associated AdminClient and INSTANCE_ID is the instance_id() of this object. |
config | the initial schema for the table. |
Status google::cloud::bigtable::TableAdmin::DeleteBackup | ( | google::bigtable::admin::v2::Backup const & | backup | ) |
Delete a backup.
backup | typically returned by a call to GetBackup or ListBackups . |
Status google::cloud::bigtable::TableAdmin::DeleteBackup | ( | std::string const & | cluster_id, |
std::string const & | backup_id | ||
) |
Delete a backup.
cluster_id | the name of the cluster relative to the instance managed by the TableAdmin object. The full cluster name is projects/<PROJECT_ID>/instances/<INSTANCE_ID>/clusters/<cluster_id> where PROJECT_ID is obtained from the associated AdminClient and INSTANCE_ID is the instance_id() of the TableAdmin object. |
backup_id | the name of the backup relative to the cluster specified. The full backup name is projects/<PROJECT_ID>/instances/<INSTANCE_ID>/clusters/<CLUSTER_ID>/backups/<backup_id> where PROJECT_ID is obtained from the associated AdminClient, INSTANCE_ID is the instance_id() of the TableAdmin object, and CLUSTER_ID is the cluster_id previously specified. |
Status google::cloud::bigtable::TableAdmin::DeleteTable | ( | std::string const & | table_id | ) |
Delete a table.
table_id | the id of the table within the instance associated with this object. The full name of the table is this->instance_name() + "/tables/" + table_id |
Status google::cloud::bigtable::TableAdmin::DropAllRows | ( | std::string const & | table_id | ) |
Delete all the rows in a table.
table_id | the id of the table within the instance associated with this object. The full name of the table is this->instance_name() + "/tables/" + table_id |
Status google::cloud::bigtable::TableAdmin::DropRowsByPrefix | ( | std::string const & | table_id, |
std::string | row_key_prefix | ||
) |
Delete all the rows that start with a given prefix.
table_id | the id of the table within the instance associated with this object. The full name of the table is this->instance_name() + "/tables/" + table_id |
row_key_prefix | drop any rows that start with this prefix. |
StatusOr<std::string> google::cloud::bigtable::TableAdmin::GenerateConsistencyToken | ( | std::string const & | table_id | ) |
Generates consistency token for a table.
table_id | the id of the table for which we want to generate consistency token. |
StatusOr<google::bigtable::admin::v2::Backup> google::cloud::bigtable::TableAdmin::GetBackup | ( | std::string const & | cluster_id, |
std::string const & | backup_id | ||
) |
Get information about a single backup.
cluster_id | the name of the cluster relative to the instance managed by the TableAdmin object. The full cluster name is projects/<PROJECT_ID>/instances/<INSTANCE_ID>/clusters/<cluster_id> where PROJECT_ID is obtained from the associated AdminClient and INSTANCE_ID is the instance_id() of the TableAdmin object. |
backup_id | the name of the backup relative to the cluster specified. The full backup name is projects/<PROJECT_ID>/instances/<INSTANCE_ID>/clusters/<CLUSTER_ID>/backups/<backup_id> where PROJECT_ID is obtained from the associated AdminClient, INSTANCE_ID is the instance_id() of the TableAdmin object, and CLUSTER_ID is the cluster_id previously specified. |
StatusOr<google::iam::v1::Policy> google::cloud::bigtable::TableAdmin::GetIamPolicy | ( | std::string const & | cluster_id, |
std::string const & | backup_id | ||
) |
Gets the policy for backup_id
.
cluster_id | the associated cluster that contains backup. |
backup_id | the backup to query. |
StatusOr<google::iam::v1::Policy> google::cloud::bigtable::TableAdmin::GetIamPolicy | ( | std::string const & | table_id | ) |
Gets the policy for table_id
.
table_id | the table to query. |
StatusOr<::google::bigtable::admin::v2::Table> google::cloud::bigtable::TableAdmin::GetTable | ( | std::string const & | table_id, |
TableView | view = SCHEMA_VIEW |
||
) |
Get information about a single table.
table_id | the id of the table within the instance associated with this object. The full name of the table is this->instance_name() + "/tables/" + table_id |
view | describes how much information to get about the name.
|
|
inline |
Only populate 'name' and fields related to the table's encryption state.
Definition at line 241 of file table_admin.h.
|
inline |
Only populate 'name' and fields related to the table's encryption state.
Definition at line 242 of file table_admin.h.
StatusOr<std::vector<google::bigtable::admin::v2::Backup> > google::cloud::bigtable::TableAdmin::ListBackups | ( | ListBackupsParams const & | params | ) |
Retrieves a list of backups.
params | instance of ListBackupsParams . |
StatusOr<std::vector<::google::bigtable::admin::v2::Table> > google::cloud::bigtable::TableAdmin::ListTables | ( | ::google::bigtable::admin::v2::Table::View | view | ) |
Return all the tables in the instance.
view | define what information about the tables is retrieved.
|
StatusOr<::google::bigtable::admin::v2::Table> google::cloud::bigtable::TableAdmin::ModifyColumnFamilies | ( | std::string const & | table_id, |
std::vector< ColumnFamilyModification > | modifications | ||
) |
Modify the schema for an existing table.
table_id | the id of the table within the instance associated with this object. The full name of the table is this->instance_name() + "/tables/" + table_id |
modifications | the list of modifications to the schema. |
|
default |
|
inline |
Only populate 'name' and fields related to the table's encryption state.
Definition at line 240 of file table_admin.h.
StatusOr<google::bigtable::admin::v2::Table> google::cloud::bigtable::TableAdmin::RestoreTable | ( | RestoreTableFromInstanceParams | params | ) |
Restore a backup into a new table in the instance.
params | instance of RestoreTableFromInstanceParams . |
StatusOr<google::bigtable::admin::v2::Table> google::cloud::bigtable::TableAdmin::RestoreTable | ( | RestoreTableParams const & | params | ) |
Restore a backup into a new table in the instance.
params | instance of RestoreTableParams . |
StatusOr<google::iam::v1::Policy> google::cloud::bigtable::TableAdmin::SetIamPolicy | ( | std::string const & | cluster_id, |
std::string const & | backup_id, | ||
google::iam::v1::Policy const & | iam_policy | ||
) |
Sets the IAM policy for a backup.
This is the preferred way to overload IamBindings
. This is more closely coupled to the underlying protocol, enable more actions and is more likely to tolerate future protocol changes.
cluster_id | which is the cluster containing the backup. |
backup_id | which backup to set the IAM policy for. |
iam_policy | google::iam::v1::Policy object containing role and members. |
StatusOr<google::iam::v1::Policy> google::cloud::bigtable::TableAdmin::SetIamPolicy | ( | std::string const & | table_id, |
google::iam::v1::Policy const & | iam_policy | ||
) |
Sets the IAM policy for a table.
This is the preferred way to overload IamBindings
. This is more closely coupled to the underlying protocol, enable more actions and is more likely to tolerate future protocol changes.
table_id | which table to set the IAM policy for. |
iam_policy | google::iam::v1::Policy object containing role and members. |
|
inline |
Return the fully qualified name of a table in this object's instance.
Definition at line 1027 of file table_admin.h.
StatusOr<std::vector<std::string> > google::cloud::bigtable::TableAdmin::TestIamPermissions | ( | std::string const & | cluster_id, |
std::string const & | backup_id, | ||
std::vector< std::string > const & | permissions | ||
) |
Returns a permission set that the caller has on the specified backup.
cluster_id | the ID of the cluster that contains the backup. |
backup_id | the ID of the backup to query. |
permissions | set of permissions to check for the resource. |
StatusOr<std::vector<std::string> > google::cloud::bigtable::TableAdmin::TestIamPermissions | ( | std::string const & | table_id, |
std::vector< std::string > const & | permissions | ||
) |
Returns a permission set that the caller has on the specified table.
table_id | the ID of the table to query. |
permissions | set of permissions to check for the resource. |
StatusOr<google::bigtable::admin::v2::Backup> google::cloud::bigtable::TableAdmin::UpdateBackup | ( | UpdateBackupParams const & | params | ) |
Updates a backup of a table in the instance.
params | instance of UpdateBackupParams . |
google::cloud::future<StatusOr<Consistency> > google::cloud::bigtable::TableAdmin::WaitForConsistency | ( | std::string const & | table_id, |
std::string const & | consistency_token | ||
) |
Checks consistency of a table with multiple calls using a separate thread.
table_id | the id of the table for which we want to check consistency. |
consistency_token | the consistency token of the table. |
|
inline |
Returns a TableAdmin that reuses the connection and configuration of this TableAdmin, but with a different resource name.
Definition at line 248 of file table_admin.h.
|
staticconstexpr |
Only populate 'name' and fields related to the table's encryption state.
Definition at line 220 of file table_admin.h.
|
staticconstexpr |
Populate all the fields in the response.
Definition at line 223 of file table_admin.h.
|
staticconstexpr |
Populate only the name in the responses.
Definition at line 226 of file table_admin.h.
|
staticconstexpr |
Populate only the name and the fields related to the table replication state.
Definition at line 230 of file table_admin.h.
|
staticconstexpr |
Populate only the name and the fields related to the table schema.
Definition at line 233 of file table_admin.h.
|
staticconstexpr |
Use the default view as defined for each function.
Definition at line 236 of file table_admin.h.