Skip to content

Commit

Permalink
docs(quickstart): Replace deprecated RPC in the sample code (#14545)
Browse files Browse the repository at this point in the history
* docs(quickstart): Replace deprecated RPC in the sample code

* fix format

* change error message
  • Loading branch information
cuiy0006 authored Jul 23, 2024
1 parent ea3eb6e commit 8c496df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 5 additions & 3 deletions google/cloud/edgenetwork/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
COMMAND
cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake"
$<TARGET_FILE:edgenetwork_quickstart> GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_CPP_TEST_REGION)
set_tests_properties(edgenetwork_quickstart
PROPERTIES LABELS "integration-test;quickstart")
GOOGLE_CLOUD_CPP_TEST_REGION GOOGLE_CLOUD_CPP_TEST_ZONE)
set_tests_properties(
edgenetwork_quickstart
PROPERTIES LABELS "integration-test;quickstart" PASS_REGULAR_EXPRESSION
"message of Resource 'zones/.*' was not found")
endif ()
7 changes: 4 additions & 3 deletions google/cloud/edgenetwork/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ this library.
#include <iostream>

int main(int argc, char* argv[]) try {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " project-id location-id\n";
if (argc != 4) {
std::cerr << "Usage: " << argv[0] << " project-id location-id zone-id\n";
return 1;
}

Expand All @@ -33,7 +33,8 @@ int main(int argc, char* argv[]) try {
auto client =
edgenetwork::EdgeNetworkClient(edgenetwork::MakeEdgeNetworkConnection());

for (auto r : client.ListZones(location.FullName())) {
for (auto r :
client.ListNetworks(location.FullName() + "/zones/" + argv[3])) {
if (!r) throw std::move(r).status();
std::cout << r->DebugString() << "\n";
}
Expand Down
7 changes: 4 additions & 3 deletions google/cloud/edgenetwork/quickstart/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <iostream>

int main(int argc, char* argv[]) try {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " project-id location-id\n";
if (argc != 4) {
std::cerr << "Usage: " << argv[0] << " project-id location-id zone-id\n";
return 1;
}

Expand All @@ -29,7 +29,8 @@ int main(int argc, char* argv[]) try {
auto client =
edgenetwork::EdgeNetworkClient(edgenetwork::MakeEdgeNetworkConnection());

for (auto r : client.ListZones(location.FullName())) {
for (auto r :
client.ListNetworks(location.FullName() + "/zones/" + argv[3])) {
if (!r) throw std::move(r).status();
std::cout << r->DebugString() << "\n";
}
Expand Down

0 comments on commit 8c496df

Please sign in to comment.