Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
Loading...
Searching...
No Matches
cluster_config.h
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
22namespace google {
23namespace cloud {
24namespace bigtable {
25GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26
27/// Specify the initial configuration for a new cluster.
28class ClusterConfig {
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
74GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
75} // namespace bigtable
76} // namespace cloud
77} // namespace google
78
79#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_CLUSTER_CONFIG_H
Specify the initial configuration for a new cluster.
Definition: cluster_config.h:28
static constexpr StorageType HDD
Definition: cluster_config.h:37
static constexpr StorageType SSD
Definition: cluster_config.h:35
ClusterConfig(std::string location, std::int32_t serve_nodes, StorageType storage)
Definition: cluster_config.h:43
std::string const & GetName()
Definition: cluster_config.h:60
static constexpr StorageType STORAGE_TYPE_UNSPECIFIED
Definition: cluster_config.h:32
ClusterConfig & SetEncryptionConfig(google::bigtable::admin::v2::Cluster::EncryptionConfig encryption) &
Definition: cluster_config.h:50
ClusterConfig && SetEncryptionConfig(google::bigtable::admin::v2::Cluster::EncryptionConfig encryption) &&
Definition: cluster_config.h:55
ClusterConfig(google::bigtable::admin::v2::Cluster cluster)
Definition: cluster_config.h:40
google::bigtable::admin::v2::Cluster && as_proto() &&
Definition: cluster_config.h:66
google::bigtable::admin::v2::Cluster const & as_proto() const &
Definition: cluster_config.h:62
Contains all the Cloud Bigtable C++ client APIs.
Definition: admin_client.h:28