Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions google/cloud/bigtable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,26 @@ this library.
#include "google/cloud/bigtable/table.h"

int main(int argc, char* argv[]) try {
if (argc != 4) {
if (argc != 4 && argc != 5) {
std::string const cmd = argv[0];
auto last_slash = std::string(cmd).find_last_of('/');
std::cerr << "Usage: " << cmd.substr(last_slash + 1)
<< " <project_id> <instance_id> <table_id>\n";
<< " <project_id> <instance_id> <table_id> [app_profile_id]\n";
return 1;
}

std::string const project_id = argv[1];
std::string const instance_id = argv[2];
std::string const table_id = argv[3];
std::string const app_profile_id = (argc == 5 ? argv[4] : "default");

// Create a namespace alias to make the code easier to read.
namespace cbt = ::google::cloud::bigtable;

cbt::Table table(cbt::MakeDataConnection(),
cbt::TableResource(project_id, instance_id, table_id));
cbt::Table table(
cbt::MakeDataConnection(),
cbt::TableResource(project_id, instance_id, table_id),
google::cloud::Options{}.set<cbt::AppProfileIdOption>(app_profile_id));

std::string row_key = "r1";
std::string column_family = "cf1";
Expand Down
10 changes: 6 additions & 4 deletions google/cloud/bigtable/quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ review the [Authentication methods at Google][authentication-quickstart].
project. As it is often the case with C++ libraries, compiling these
dependencies may take several minutes.

1. Run the example, changing the placeholder(s) to appropriate values:
1. Run the example, changing the placeholder(s) to appropriate values (the app
profile ID is optional):

```bash
bazel run :quickstart -- [GCP PROJECT] [CLOUD BIGTABLE INSTANCE] [CLOUD BIGTABLE TABLE]
bazel run :quickstart -- [GCP PROJECT] [CLOUD BIGTABLE INSTANCE] [CLOUD BIGTABLE TABLE] [[APP PROFILE ID]]
```

## Using with CMake
Expand Down Expand Up @@ -92,10 +93,11 @@ review the [Authentication methods at Google][authentication-quickstart].
cmake --build .build
```

1. Run the example, changing the placeholder(s) to appropriate values:
1. Run the example, changing the placeholder(s) to appropriate values (the app
profile ID is optional):

```bash
.build/quickstart [GCP PROJECT] [CLOUD BIGTABLE INSTANCE] [CLOUD BIGTABLE TABLE]
.build/quickstart [GCP PROJECT] [CLOUD BIGTABLE INSTANCE] [CLOUD BIGTABLE TABLE] [[APP PROFILE ID]]
```

## Platform Specific Notes
Expand Down
11 changes: 7 additions & 4 deletions google/cloud/bigtable/quickstart/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@
#include "google/cloud/bigtable/table.h"

int main(int argc, char* argv[]) try {
if (argc != 4) {
if (argc != 4 && argc != 5) {
std::string const cmd = argv[0];
auto last_slash = std::string(cmd).find_last_of('/');
std::cerr << "Usage: " << cmd.substr(last_slash + 1)
<< " <project_id> <instance_id> <table_id>\n";
<< " <project_id> <instance_id> <table_id> [app_profile_id]\n";
return 1;
}

std::string const project_id = argv[1];
std::string const instance_id = argv[2];
std::string const table_id = argv[3];
std::string const app_profile_id = (argc == 5 ? argv[4] : "default");

// Create a namespace alias to make the code easier to read.
namespace cbt = ::google::cloud::bigtable;

cbt::Table table(cbt::MakeDataConnection(),
cbt::TableResource(project_id, instance_id, table_id));
cbt::Table table(
cbt::MakeDataConnection(),
cbt::TableResource(project_id, instance_id, table_id),
google::cloud::Options{}.set<cbt::AppProfileIdOption>(app_profile_id));

std::string row_key = "r1";
std::string column_family = "cf1";
Expand Down
Loading