diff --git a/google/cloud/storage/bucket_metadata.h b/google/cloud/storage/bucket_metadata.h index 8b35f77e573d..263cad94b3c4 100644 --- a/google/cloud/storage/bucket_metadata.h +++ b/google/cloud/storage/bucket_metadata.h @@ -709,6 +709,7 @@ class BucketMetadata { ///@} std::string const& etag() const { return etag_; } + /// @note This is only intended for mocking. BucketMetadata& set_etag(std::string v) { etag_ = std::move(v); @@ -746,14 +747,17 @@ class BucketMetadata { } ///@} + /// Return the bucket id. std::string const& id() const { return id_; } - /// @note This is only intended for mocking + + /// @note This is only intended for mocking. BucketMetadata& set_id(std::string v) { id_ = std::move(v); return *this; } std::string const& kind() const { return kind_; } + /// @note This is only intended for mocking BucketMetadata& set_kind(std::string v) { kind_ = std::move(v); @@ -827,7 +831,10 @@ class BucketMetadata { } ///@} + /// Return the bucket location. std::string const& location() const { return location_; } + + /// Set the bucket location. Only applicable when creating buckets. BucketMetadata& set_location(std::string v) { location_ = std::move(v); return *this; @@ -861,6 +868,7 @@ class BucketMetadata { /// The bucket metageneration. std::int64_t metageneration() const { return metageneration_; } + /// @note this is only intended for mocking. BucketMetadata& set_metageneration(std::int64_t v) { metageneration_ = v; @@ -974,6 +982,7 @@ class BucketMetadata { std::chrono::system_clock::time_point time_created() const { return time_created_; } + /// @note This is only intended for mocking. BucketMetadata& set_time_created(std::chrono::system_clock::time_point v) { time_created_ = v; diff --git a/google/cloud/storage/internal/bucket_metadata_parser.cc b/google/cloud/storage/internal/bucket_metadata_parser.cc index d094456530b4..c2b217c20208 100644 --- a/google/cloud/storage/internal/bucket_metadata_parser.cc +++ b/google/cloud/storage/internal/bucket_metadata_parser.cc @@ -197,10 +197,11 @@ std::map ParseLabels(nlohmann::json const& json) { Status ParseOwner(BucketMetadata& meta, nlohmann::json const& json) { if (!json.contains("owner")) return Status{}; - Owner o; - o.entity = json["owner"].value("entity", ""); - o.entity_id = json["owner"].value("entityId", ""); - meta.set_owner(std::move(o)); + auto const& o = json["owner"]; + Owner owner; + owner.entity = o.value("entity", ""); + owner.entity_id = o.value("entityId", ""); + meta.set_owner(std::move(owner)); return Status{}; }