@@ -60,7 +60,8 @@ void ApplyRelaxedIdempotency(google::cloud::bigtable::Table const& table,
6060 namespace cbt = ::google::cloud::bigtable;
6161 [](std::string const & project_id, std::string const & instance_id,
6262 std::string const & table_id, std::string const & row_key) {
63- cbt::Table table (cbt::MakeDataConnection (),
63+ cbt::Table table (cbt::MakeDataConnection ({cbt::InstanceResource (
64+ google::cloud::Project (project_id), instance_id)}),
6465 cbt::TableResource (project_id, instance_id, table_id),
6566 Options{}.set <cbt::IdempotentMutationPolicyOption>(
6667 cbt::AlwaysRetryMutationPolicy ().clone ()));
@@ -83,7 +84,8 @@ void ApplyCustomRetry(google::cloud::bigtable::Table const& table,
8384 namespace cbt = ::google::cloud::bigtable;
8485 [](std::string const & project_id, std::string const & instance_id,
8586 std::string const & table_id, std::string const & row_key) {
86- cbt::Table table (cbt::MakeDataConnection (),
87+ cbt::Table table (cbt::MakeDataConnection ({cbt::InstanceResource (
88+ google::cloud::Project (project_id), instance_id)}),
8789 cbt::TableResource (project_id, instance_id, table_id),
8890 Options{}.set <cbt::DataRetryPolicyOption>(
8991 cbt::DataLimitedErrorCountRetryPolicy (7 ).clone ()));
@@ -348,7 +350,10 @@ void MutateDeleteColumns(std::vector<std::string> const& argv) {
348350 }
349351 // ! [connect data]
350352 google::cloud::bigtable::Table table (
351- google::cloud::bigtable::MakeDataConnection (),
353+ google::cloud::bigtable::MakeDataConnection ({
354+ google::cloud::bigtable::InstanceResource (
355+ google::cloud::Project (project_id), instance_id),
356+ }),
352357 google::cloud::bigtable::TableResource (project_id, instance_id,
353358 table_id));
354359 // ! [connect data]
@@ -408,7 +413,10 @@ void MutateDeleteRowsCommand(std::vector<std::string> const& argv) {
408413 auto const table_id = *it++;
409414 std::vector<std::string> rows (it, argv.cend ());
410415 google::cloud::bigtable::Table table (
411- google::cloud::bigtable::MakeDataConnection (),
416+ google::cloud::bigtable::MakeDataConnection ({
417+ google::cloud::bigtable::InstanceResource (
418+ google::cloud::Project (project_id), instance_id),
419+ }),
412420 google::cloud::bigtable::TableResource (project_id, instance_id,
413421 table_id));
414422 MutateDeleteRows (table, std::move (rows));
@@ -477,7 +485,10 @@ void MutateInsertUpdateRowsCommand(std::vector<std::string> const& argv) {
477485 auto const table_id = *it++;
478486 std::vector<std::string> rows (it, argv.cend ());
479487 google::cloud::bigtable::Table table (
480- google::cloud::bigtable::MakeDataConnection (),
488+ google::cloud::bigtable::MakeDataConnection ({
489+ google::cloud::bigtable::InstanceResource (
490+ google::cloud::Project (project_id), instance_id),
491+ }),
481492 google::cloud::bigtable::TableResource (project_id, instance_id,
482493 table_id));
483494 MutateInsertUpdateRows (table, std::move (rows));
@@ -708,8 +719,11 @@ void ConfigureConnectionPoolSize(std::vector<std::string> const& argv) {
708719 std::string const & table_id) {
709720 auto constexpr kPoolSize = 10 ;
710721 auto options = gc::Options{}.set <gc::GrpcNumChannelsOption>(kPoolSize );
711- cbt::Table table (cbt::MakeDataConnection (options),
712- cbt::TableResource (project_id, instance_id, table_id));
722+ cbt::Table table (
723+ cbt::MakeDataConnection (
724+ {cbt::InstanceResource (gc::Project (project_id), instance_id)},
725+ std::move (options)),
726+ cbt::TableResource (project_id, instance_id, table_id));
713727 std::cout << " Connected with channel pool size of " << kPoolSize << " \n " ;
714728 }
715729 // [END bigtable_configure_connection_pool]
@@ -732,7 +746,8 @@ void RunMutateExamples(
732746 if (!schema) throw std::move (schema).status ();
733747
734748 using ::google::cloud::Options;
735- cbt::Table table (cbt::MakeDataConnection (),
749+ cbt::Table table (cbt::MakeDataConnection ({cbt::InstanceResource (
750+ google::cloud::Project (project_id), instance_id)}),
736751 cbt::TableResource (project_id, instance_id, table_id),
737752 Options{}.set <cbt::IdempotentMutationPolicyOption>(
738753 cbt::AlwaysRetryMutationPolicy ().clone ()));
@@ -763,7 +778,8 @@ void RunWriteExamples(
763778 if (!schema) throw std::move (schema).status ();
764779
765780 using ::google::cloud::Options;
766- cbt::Table table (cbt::MakeDataConnection (),
781+ cbt::Table table (cbt::MakeDataConnection ({cbt::InstanceResource (
782+ google::cloud::Project (project_id), instance_id)}),
767783 cbt::TableResource (project_id, instance_id, table_id),
768784 Options{}.set <cbt::IdempotentMutationPolicyOption>(
769785 cbt::AlwaysRetryMutationPolicy ().clone ()));
@@ -829,7 +845,8 @@ void RunDataExamples(
829845 if (!schema) throw std::move (schema).status ();
830846
831847 using ::google::cloud::Options;
832- cbt::Table table (cbt::MakeDataConnection (),
848+ cbt::Table table (cbt::MakeDataConnection ({cbt::InstanceResource (
849+ google::cloud::Project (project_id), instance_id)}),
833850 cbt::TableResource (project_id, instance_id, table_id),
834851 Options{}.set <cbt::IdempotentMutationPolicyOption>(
835852 cbt::AlwaysRetryMutationPolicy ().clone ()));
@@ -914,7 +931,8 @@ void RunDataExamples(
914931 ReadModifyWrite (table, {" read-modify-write" });
915932
916933 if (!google::cloud::bigtable::examples::UsingEmulator ()) {
917- auto client = cbt::Client (cbt::MakeDataConnection ());
934+ auto client = cbt::Client (cbt::MakeDataConnection ({cbt::InstanceResource (
935+ google::cloud::Project (project_id), instance_id)}));
918936 std::cout << " Running PrepareAndExecuteQuery() example" << std::endl;
919937 PrepareAndExecuteQuery (client, {project_id, instance_id, table_id});
920938 }
0 commit comments