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/protobuf/util/message_differencer.h>
22#include <google/spanner/admin/instance/v1/spanner_instance_admin.pb.h>
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
32
33
34
35
36
37
38
39
40
44
45
58 return google::protobuf::util::MessageDifferencer::Equivalent(a.request_,
67 request_.mutable_instance()->set_name(std::move(instance_name));
70 request_.mutable_instance()->set_name(in
.FullName());
74
75
76
77
79 google::spanner::admin::instance::v1::Instance in) {
80 *request_.mutable_instance() = std::move(in);
84 request_.mutable_instance()->set_name(std::move(name));
88 request_.mutable_instance()->set_name(std::move(name));
89 return std::move(*
this);
92 SetDisplayNameImpl(std::move(display_name));
96 SetDisplayNameImpl(std::move(display_name));
97 return std::move(*
this);
100 SetNodeCountImpl(node_count);
104 SetNodeCountImpl(node_count);
105 return std::move(*
this);
108 SetProcessingUnitsImpl(processing_units);
112 SetProcessingUnitsImpl(processing_units);
113 return std::move(*
this);
116 std::map<std::string, std::string>
const& labels) & {
117 AddLabelsImpl(labels);
121 std::map<std::string, std::string>
const& labels) && {
122 AddLabelsImpl(labels);
123 return std::move(*
this);
126 std::map<std::string, std::string>
const& labels) & {
127 request_.mutable_instance()->clear_labels();
128 AddLabelsImpl(labels);
132 std::map<std::string, std::string>
const& labels) && {
133 request_.mutable_instance()->clear_labels();
134 AddLabelsImpl(labels);
135 return std::move(*
this);
137 google::spanner::admin::instance::v1::UpdateInstanceRequest&
Build() & {
140 google::spanner::admin::instance::v1::UpdateInstanceRequest&&
Build() && {
141 return std::move(request_);
145 google::spanner::admin::instance::v1::UpdateInstanceRequest request_;
146 void SetDisplayNameImpl(std::string display_name) {
147 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
148 "display_name", request_.field_mask())) {
149 request_.mutable_field_mask()->add_paths(
"display_name");
151 request_.mutable_instance()->set_display_name(std::move(display_name));
153 void SetNodeCountImpl(
int node_count) {
154 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
155 "node_count", request_.field_mask())) {
156 request_.mutable_field_mask()->add_paths(
"node_count");
158 request_.mutable_instance()->set_node_count(node_count);
160 void SetProcessingUnitsImpl(
int processing_units) {
161 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
162 "processing_units", request_.field_mask())) {
163 request_.mutable_field_mask()->add_paths(
"processing_units");
165 request_.mutable_instance()->set_processing_units(processing_units);
167 void AddLabelsImpl(std::map<std::string, std::string>
const& labels) {
168 if (!
google::protobuf::util::FieldMaskUtil::IsPathInFieldMask(
169 "labels", request_.field_mask())) {
170 request_.mutable_field_mask()->add_paths(
"labels");
172 for (
auto const& pair : labels) {
173 request_.mutable_instance()->mutable_labels()->insert(
174 {pair.first, pair.second});
179GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
This class identifies a Cloud Spanner Instance.
Definition: instance.h:42
std::string FullName() const
Returns the fully qualified instance name as a string of the form: "projects/<project-id>/instances/<...
UpdateInstanceRequestBuilder is a builder class for google::spanner::admin::instance::v1::UpdateInsta...
Definition: update_instance_request_builder.h:41
friend bool operator==(UpdateInstanceRequestBuilder const &a, UpdateInstanceRequestBuilder const &b) noexcept
Definition: update_instance_request_builder.h:56
UpdateInstanceRequestBuilder(Instance const &in)
Definition: update_instance_request_builder.h:69
UpdateInstanceRequestBuilder & operator=(UpdateInstanceRequestBuilder &&)=default
UpdateInstanceRequestBuilder & SetDisplayName(std::string display_name) &
Definition: update_instance_request_builder.h:91
UpdateInstanceRequestBuilder && SetName(std::string name) &&
Definition: update_instance_request_builder.h:87
UpdateInstanceRequestBuilder(std::string instance_name)
Definition: update_instance_request_builder.h:66
UpdateInstanceRequestBuilder & SetNodeCount(int node_count) &
Definition: update_instance_request_builder.h:99
friend bool operator!=(UpdateInstanceRequestBuilder const &a, UpdateInstanceRequestBuilder const &b) noexcept
Definition: update_instance_request_builder.h:61
google::spanner::admin::instance::v1::UpdateInstanceRequest & Build() &
Definition: update_instance_request_builder.h:137
google::spanner::admin::instance::v1::UpdateInstanceRequest && Build() &&
Definition: update_instance_request_builder.h:140
UpdateInstanceRequestBuilder && SetNodeCount(int node_count) &&
Definition: update_instance_request_builder.h:103
UpdateInstanceRequestBuilder & AddLabels(std::map< std::string, std::string > const &labels) &
Definition: update_instance_request_builder.h:115
UpdateInstanceRequestBuilder & SetProcessingUnits(int processing_units) &
Definition: update_instance_request_builder.h:107
UpdateInstanceRequestBuilder(UpdateInstanceRequestBuilder &&)=default
UpdateInstanceRequestBuilder()=default
Constructs a UpdateInstanceRequestBuilder.
UpdateInstanceRequestBuilder && SetDisplayName(std::string display_name) &&
Definition: update_instance_request_builder.h:95
UpdateInstanceRequestBuilder && SetProcessingUnits(int processing_units) &&
Definition: update_instance_request_builder.h:111
UpdateInstanceRequestBuilder && SetLabels(std::map< std::string, std::string > const &labels) &&
Definition: update_instance_request_builder.h:131
UpdateInstanceRequestBuilder & SetName(std::string name) &
Definition: update_instance_request_builder.h:83
UpdateInstanceRequestBuilder && AddLabels(std::map< std::string, std::string > const &labels) &&
Definition: update_instance_request_builder.h:120
UpdateInstanceRequestBuilder & SetLabels(std::map< std::string, std::string > const &labels) &
Definition: update_instance_request_builder.h:125
UpdateInstanceRequestBuilder(google::spanner::admin::instance::v1::Instance in)
Constructs UpdateInstanceRequestBuilder with google::spanner::admin::instance::v1::Instance.
Definition: update_instance_request_builder.h:78
UpdateInstanceRequestBuilder(UpdateInstanceRequestBuilder const &)=default
UpdateInstanceRequestBuilder & operator=(UpdateInstanceRequestBuilder const &)=default
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23