Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Sep 21, 2022
1 parent 3bbfd67 commit 0ef6d38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 10 additions & 1 deletion google/cloud/storage/bucket_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions google/cloud/storage/internal/bucket_metadata_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ std::map<std::string, std::string> 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{};
}

Expand Down

0 comments on commit 0ef6d38

Please sign in to comment.