15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_UPDATE_INSTANCE_REQUEST_BUILDER_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_UPDATE_INSTANCE_REQUEST_BUILDER_H
18 #include "google/cloud/spanner/instance.h"
19 #include "google/cloud/spanner/version.h"
20 #include <google/protobuf/util/field_mask_util.h>
21 #include <google/spanner/admin/instance/v1/spanner_instance_admin.pb.h>
56 request_.mutable_instance()->set_name(std::move(instance_name));
59 request_.mutable_instance()->set_name(in
.FullName());
68 google::spanner::admin::instance::v1::Instance in) {
69 *request_.mutable_instance() = std::move(in);
73 request_.mutable_instance()->set_name(std::move(name));
77 request_.mutable_instance()->set_name(std::move(name));
78 return std::move(*
this);
81 SetDisplayNameImpl(std::move(display_name));
85 SetDisplayNameImpl(std::move(display_name));
86 return std::move(*
this);
89 SetNodeCountImpl(node_count);
93 SetNodeCountImpl(node_count);
94 return std::move(*
this);
97 SetProcessingUnitsImpl(processing_units);
101 SetProcessingUnitsImpl(processing_units);
102 return std::move(*
this);
105 std::map<std::string, std::string>
const& labels) & {
106 AddLabelsImpl(labels);
110 std::map<std::string, std::string>
const& labels) && {
111 AddLabelsImpl(labels);
112 return std::move(*
this);
115 std::map<std::string, std::string>
const& labels) & {
116 request_.mutable_instance()->clear_labels();
117 AddLabelsImpl(labels);
121 std::map<std::string, std::string>
const& labels) && {
122 request_.mutable_instance()->clear_labels();
123 AddLabelsImpl(labels);
124 return std::move(*
this);
126 google::spanner::admin::instance::v1::UpdateInstanceRequest&
Build() & {
129 google::spanner::admin::instance::v1::UpdateInstanceRequest&&
Build() && {
130 return std::move(request_);
134 google::spanner::admin::instance::v1::UpdateInstanceRequest request_;
135 void SetDisplayNameImpl(std::string display_name) {
136 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
137 "display_name", request_.field_mask())) {
138 request_.mutable_field_mask()->add_paths(
"display_name");
140 request_.mutable_instance()->set_display_name(std::move(display_name));
142 void SetNodeCountImpl(
int node_count) {
143 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
144 "node_count", request_.field_mask())) {
145 request_.mutable_field_mask()->add_paths(
"node_count");
147 request_.mutable_instance()->set_node_count(node_count);
149 void SetProcessingUnitsImpl(
int processing_units) {
150 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
151 "processing_units", request_.field_mask())) {
152 request_.mutable_field_mask()->add_paths(
"processing_units");
154 request_.mutable_instance()->set_processing_units(processing_units);
156 void AddLabelsImpl(std::map<std::string, std::string>
const& labels) {
157 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
158 "labels", request_.field_mask())) {
159 request_.mutable_field_mask()->add_paths(
"labels");
161 for (
auto const& pair : labels) {
162 request_.mutable_instance()->mutable_labels()->insert(
163 {pair.first, pair.second});