Skip to content

Commit

Permalink
docs(storagecontrol): use GetStorageLayout() for quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Apr 22, 2024
1 parent cca654d commit 306e4d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions google/cloud/storagecontrol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ int main(int argc, char* argv[]) try {
std::cerr << "Usage: " << argv[0] << " bucket-id\n";
return 1;
}
std::string const bucket_name = std::string{"projects/_/buckets/"} + argv[1];
auto const name =
std::string{"projects/_/buckets/"} + argv[1] + "/storageLayout";

namespace storagecontrol = ::google::cloud::storagecontrol_v2;
auto client = storagecontrol::StorageControlClient(
storagecontrol::MakeStorageControlConnection());

for (auto r : client.ListFolders(bucket_name)) {
if (!r) throw std::move(r).status();
std::cout << r->DebugString() << "\n";
}
auto layout = client.GetStorageLayout(name);
if (!layout) throw std::move(layout).status();
std::cout << layout->DebugString() << "\n";

return 0;
} catch (google::cloud::Status const& status) {
Expand Down
10 changes: 5 additions & 5 deletions google/cloud/storagecontrol/quickstart/quickstart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ int main(int argc, char* argv[]) try {
std::cerr << "Usage: " << argv[0] << " bucket-id\n";
return 1;
}
std::string const bucket_name = std::string{"projects/_/buckets/"} + argv[1];
auto const name =
std::string{"projects/_/buckets/"} + argv[1] + "/storageLayout";

namespace storagecontrol = ::google::cloud::storagecontrol_v2;
auto client = storagecontrol::StorageControlClient(
storagecontrol::MakeStorageControlConnection());

for (auto r : client.ListFolders(bucket_name)) {
if (!r) throw std::move(r).status();
std::cout << r->DebugString() << "\n";
}
auto layout = client.GetStorageLayout(name);
if (!layout) throw std::move(layout).status();
std::cout << layout->DebugString() << "\n";

return 0;
} catch (google::cloud::Status const& status) {
Expand Down

0 comments on commit 306e4d6

Please sign in to comment.