File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ this library.
4545#include < stdexcept>
4646
4747int main (int argc, char* argv[ ] ) try {
48- if (argc != 2 ) {
48+ if (argc != 3 ) {
4949 std::cerr << "Usage: " << argv[ 0] << " project-id location-id\n";
5050 return 1;
5151 }
@@ -54,7 +54,7 @@ int main(int argc, char* argv[]) try {
5454 auto client = gkehub::GkeHubClient(gkehub::MakeGkeHubConnection());
5555
5656 auto const location =
57- "projects/" + std::string( argv[ 0 ] ) + "/locations/" + std::string( argv[ 1 ] ) ;
57+ std::string{ "projects/"} + argv[ 1 ] + "/locations/" + argv[ 2 ] ;
5858 for (auto r : client.ListMemberships(location)) {
5959 if (!r) throw std::runtime_error(r.status().message());
6060 std::cout << r->DebugString() << "\n";
Original file line number Diff line number Diff line change 1717#include < stdexcept>
1818
1919int main (int argc, char * argv[]) try {
20- if (argc != 2 ) {
20+ if (argc != 3 ) {
2121 std::cerr << " Usage: " << argv[0 ] << " project-id location-id\n " ;
2222 return 1 ;
2323 }
@@ -26,7 +26,7 @@ int main(int argc, char* argv[]) try {
2626 auto client = gkehub::GkeHubClient (gkehub::MakeGkeHubConnection ());
2727
2828 auto const location =
29- " projects/" + std::string ( argv[0 ]) + " /locations/" + std::string ( argv[1 ]) ;
29+ std::string{ " projects/" } + argv[1 ] + " /locations/" + argv[2 ] ;
3030 for (auto r : client.ListMemberships (location)) {
3131 if (!r) throw std::runtime_error (r.status ().message ());
3232 std::cout << r->DebugString () << " \n " ;
Original file line number Diff line number Diff line change @@ -46,17 +46,18 @@ this library.
4646#include < stdexcept>
4747
4848int main (int argc, char* argv[ ] ) try {
49- if (argc != 2 ) {
50- std::cerr << "Usage: " << argv[ 0] << " project-id\n";
49+ if (argc != 3 ) {
50+ std::cerr << "Usage: " << argv[ 0] << " project-id location-id \n";
5151 return 1;
5252 }
5353
5454 namespace kms = ::google::cloud : :kms;
5555 auto client = kms::KeyManagementServiceClient(
5656 kms::MakeKeyManagementServiceConnection());
57- auto const project = google::cloud : :Project(argv[ 1] );
5857
59- for (auto r : client.ListKeyRings(project.FullName())) {
58+ auto const parent =
59+ std::string{"projects/"} + argv[ 1] + "/locations/" + argv[ 2] ;
60+ for (auto r : client.ListKeyRings(parent)) {
6061 if (!r) throw std::runtime_error(r.status().message());
6162 std::cout << r->DebugString() << "\n";
6263 }
Original file line number Diff line number Diff line change 1818#include < stdexcept>
1919
2020int main (int argc, char * argv[]) try {
21- if (argc != 2 ) {
22- std::cerr << " Usage: " << argv[0 ] << " project-id\n " ;
21+ if (argc != 3 ) {
22+ std::cerr << " Usage: " << argv[0 ] << " project-id location-id \n " ;
2323 return 1 ;
2424 }
2525
2626 namespace kms = ::google::cloud::kms;
2727 auto client = kms::KeyManagementServiceClient (
2828 kms::MakeKeyManagementServiceConnection ());
29- auto const project = google::cloud::Project (argv[1 ]);
3029
31- for (auto r : client.ListKeyRings (project.FullName ())) {
30+ auto const parent =
31+ std::string{" projects/" } + argv[1 ] + " /locations/" + argv[2 ];
32+ for (auto r : client.ListKeyRings (parent)) {
3233 if (!r) throw std::runtime_error (r.status ().message ());
3334 std::cout << r->DebugString () << " \n " ;
3435 }
Original file line number Diff line number Diff line change @@ -43,21 +43,23 @@ this library.
4343<!-- inject-quickstart-start -->
4444``` cc
4545#include " google/cloud/logging/logging_service_v2_client.h"
46+ #include " google/cloud/project.h"
4647#include < iostream>
4748#include < stdexcept>
4849
4950int main (int argc, char* argv[ ] ) try {
50- if (argc != 4 ) {
51+ if (argc != 2 ) {
5152 std::cerr << "Usage: " << argv[ 0] << " project-id\n";
5253 return 1;
5354 }
5455
5556 namespace logging = ::google::cloud : :logging;
5657 auto client = logging::LoggingServiceV2Client(
5758 logging::MakeLoggingServiceV2Connection());
58- auto const parent = std::string("projects/") + argv[ 1] ;
59- for (auto const& logs : client.ListLogs(parent)) {
60- std::cout << logs.value() << "\n";
59+ auto const project = google::cloud : :Project(argv[ 1] );
60+ for (auto l : client.ListLogs(project.FullName())) {
61+ if (!l) throw std::runtime_error(l.status().message());
62+ std::cout << * l << "\n";
6163 }
6264
6365 return 0;
Original file line number Diff line number Diff line change 1313// limitations under the License.
1414
1515#include " google/cloud/logging/logging_service_v2_client.h"
16+ #include " google/cloud/project.h"
1617#include < iostream>
1718#include < stdexcept>
1819
1920int main (int argc, char * argv[]) try {
20- if (argc != 4 ) {
21+ if (argc != 2 ) {
2122 std::cerr << " Usage: " << argv[0 ] << " project-id\n " ;
2223 return 1 ;
2324 }
2425
2526 namespace logging = ::google::cloud::logging;
2627 auto client = logging::LoggingServiceV2Client (
2728 logging::MakeLoggingServiceV2Connection ());
28- auto const parent = std::string (" projects/" ) + argv[1 ];
29- for (auto const & logs : client.ListLogs (parent)) {
30- std::cout << logs.value () << " \n " ;
29+ auto const project = google::cloud::Project (argv[1 ]);
30+ for (auto l : client.ListLogs (project.FullName ())) {
31+ if (!l) throw std::runtime_error (l.status ().message ());
32+ std::cout << *l << " \n " ;
3133 }
3234
3335 return 0 ;
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ int main(int argc, char* argv[]) try {
5555 memcache::CloudMemcacheClient(memcache::MakeCloudMemcacheConnection());
5656
5757 auto const project_id = std::string(argv[ 1] );
58- auto const parent = "projects/" + project_id + "locations/-";
58+ auto const parent = "projects/" + project_id + "/ locations/-";
5959 for (auto r : client.ListInstances(parent)) {
6060 if (!r) throw std::runtime_error(r.status().message());
6161 std::cout << r->DebugString() << "\n";
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) try {
2828 memcache::CloudMemcacheClient (memcache::MakeCloudMemcacheConnection ());
2929
3030 auto const project_id = std::string (argv[1 ]);
31- auto const parent = " projects/" + project_id + " locations/-" ;
31+ auto const parent = " projects/" + project_id + " / locations/-" ;
3232 for (auto r : client.ListInstances (parent)) {
3333 if (!r) throw std::runtime_error (r.status ().message ());
3434 std::cout << r->DebugString () << " \n " ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) try {
5454 auto client = redis::CloudRedisClient(redis::MakeCloudRedisConnection());
5555
5656 auto const project_id = std::string(argv[ 1] );
57- auto const parent = "projects/" + project_id + "locations/-";
57+ auto const parent = "projects/" + project_id + "/ locations/-";
5858 for (auto r : client.ListInstances(parent)) {
5959 if (!r) throw std::runtime_error(r.status().message());
6060 std::cout << r->DebugString() << "\n";
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) try {
2727 auto client = redis::CloudRedisClient (redis::MakeCloudRedisConnection ());
2828
2929 auto const project_id = std::string (argv[1 ]);
30- auto const parent = " projects/" + project_id + " locations/-" ;
30+ auto const parent = " projects/" + project_id + " / locations/-" ;
3131 for (auto r : client.ListInstances (parent)) {
3232 if (!r) throw std::runtime_error (r.status ().message ());
3333 std::cout << r->DebugString () << " \n " ;
You can’t perform that action at this time.
0 commit comments