Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offer Bigtable resource classes for the Data API. #9348

Closed
dbolduc opened this issue Jun 24, 2022 · 1 comment · Fixed by #9377
Closed

Offer Bigtable resource classes for the Data API. #9348

dbolduc opened this issue Jun 24, 2022 · 1 comment · Fixed by #9377
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@dbolduc
Copy link
Member

dbolduc commented Jun 24, 2022

As suggested by @coryan, we should add classes bigtable::TableResource and bigtable::Instance to represent the resource names used by the Data API. This is in a similar vein to google::cloud::Project or google::cloud::spanner::Database.

We have: https://github.com/googleapis/google-cloud-cpp/blob/ee484a2ef86d3e851602430ff72c29899b61141e/google/cloud/bigtable/resource_names.h but we can do better.

At least for the Data API, we want a Table constructor like:

Table(TableResource resource, Options options = {});

Having just a string is error prone. We cannot guarantee that the user made their string with TableName(...). Our API should make it hard/impossible for the user to give us a bad resource name:

// bad, because we cannot control how the user constructed the string.
Table(std::string table_name, Options options = {});

The same sorts of classes could be added for Cluster or Backup or AppProfile. If we want to do that, we can open another issue. (I think we don't want to do it. The Admin API already accepts strings, and it is final.)

@dbolduc dbolduc added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Jun 24, 2022
@dbolduc dbolduc added this to the Modernize Bigtable milestone Jun 24, 2022
@dbolduc
Copy link
Member Author

dbolduc commented Jun 25, 2022

blast. InstanceResource it is.

namespace google {
namespace cloud {
namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
using Instance = ::google::bigtable::admin::v2::Instance;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant