Google Cloud Bigtable C++ Client  1.42.0
A C++ Client Library for Google Cloud Bigtable
cluster_config.h
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLUSTER_CONFIG_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLUSTER_CONFIG_H
17 
18 #include "google/cloud/bigtable/version.h"
19 #include <google/bigtable/admin/v2/bigtable_instance_admin.pb.h>
20 #include <string>
21 
22 namespace google {
23 namespace cloud {
24 namespace bigtable {
26 
27 /// Specify the initial configuration for a new cluster.
29  public:
30  using StorageType = ::google::bigtable::admin::v2::StorageType;
31  // NOLINTNEXTLINE(readability-identifier-naming)
32  constexpr static StorageType STORAGE_TYPE_UNSPECIFIED =
33  google::bigtable::admin::v2::STORAGE_TYPE_UNSPECIFIED;
34  // NOLINTNEXTLINE(readability-identifier-naming)
35  constexpr static StorageType SSD = google::bigtable::admin::v2::SSD;
36  // NOLINTNEXTLINE(readability-identifier-naming)
37  constexpr static StorageType HDD = google::bigtable::admin::v2::HDD;
38 
39  // NOLINTNEXTLINE(google-explicit-constructor)
40  ClusterConfig(google::bigtable::admin::v2::Cluster cluster)
41  : proto_(std::move(cluster)) {}
42 
43  ClusterConfig(std::string location, std::int32_t serve_nodes,
44  StorageType storage) {
45  proto_.set_location(std::move(location));
46  proto_.set_serve_nodes(serve_nodes);
47  proto_.set_default_storage_type(storage);
48  }
49 
51  google::bigtable::admin::v2::Cluster::EncryptionConfig encryption) & {
52  *proto_.mutable_encryption_config() = std::move(encryption);
53  return *this;
54  }
56  google::bigtable::admin::v2::Cluster::EncryptionConfig encryption) && {
57  return std::move(SetEncryptionConfig(std::move(encryption)));
58  }
59 
60  std::string const& GetName() { return proto_.name(); }
61 
62  google::bigtable::admin::v2::Cluster const& as_proto() const& {
63  return proto_;
64  }
65 
66  google::bigtable::admin::v2::Cluster&& as_proto() && {
67  return std::move(proto_);
68  }
69 
70  private:
71  google::bigtable::admin::v2::Cluster proto_;
72 };
73 
75 } // namespace bigtable
76 } // namespace cloud
77 } // namespace google
78 
79 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLUSTER_CONFIG_H