Google Cloud Bigtable C++ Client  1.33.0
A C++ Client Library for Google Cloud Bigtable
resource_names.cc
Go to the documentation of this file.
1 // Copyright 2021 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 // http://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 #include "google/cloud/bigtable/resource_names.h"
16 #include "google/cloud/internal/absl_str_cat_quiet.h"
17 
18 namespace google {
19 namespace cloud {
20 namespace bigtable {
22 
23 std::string InstanceName(std::string const& project_id,
24  std::string const& instance_id) {
25  return absl::StrCat("projects/", project_id, "/instances/" + instance_id);
26 }
27 
28 std::string TableName(std::string const& project_id,
29  std::string const& instance_id,
30  std::string const& table_id) {
31  return absl::StrCat(InstanceName(project_id, instance_id), "/tables/",
32  table_id);
33 }
34 
35 std::string ClusterName(std::string const& project_id,
36  std::string const& instance_id,
37  std::string const& cluster_id) {
38  return absl::StrCat(InstanceName(project_id, instance_id), "/clusters/",
39  cluster_id);
40 }
41 
42 std::string AppProfileName(std::string const& project_id,
43  std::string const& instance_id,
44  std::string const& app_profile_id) {
45  return absl::StrCat(InstanceName(project_id, instance_id), "/appProfiles/",
46  app_profile_id);
47 }
48 
49 std::string BackupName(std::string const& project_id,
50  std::string const& instance_id,
51  std::string const& cluster_id,
52  std::string const& backup_id) {
53  return absl::StrCat(ClusterName(project_id, instance_id, cluster_id),
54  "/backups/", backup_id);
55 }
56 
58 } // namespace bigtable
59 } // namespace cloud
60 } // namespace google