Google Cloud Bigtable C++ Client  1.33.0
A C++ Client Library for Google Cloud Bigtable
metadata_update_policy.cc
Go to the documentation of this file.
1 // Copyright 2018 Google Inc.
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/metadata_update_policy.h"
16 #include "google/cloud/bigtable/version.h"
17 #include "google/cloud/internal/api_client_header.h"
18 
19 namespace google {
20 namespace cloud {
21 namespace bigtable {
23 // These we cannot change because they are part of the public API.
24 // NOLINTNEXTLINE(readability-identifier-naming)
25 MetadataParamTypes const MetadataParamTypes::PARENT("parent");
26 // NOLINTNEXTLINE(readability-identifier-naming)
27 MetadataParamTypes const MetadataParamTypes::NAME("name");
28 // NOLINTNEXTLINE(readability-identifier-naming)
29 MetadataParamTypes const MetadataParamTypes::RESOURCE("resource");
30 // NOLINTNEXTLINE(readability-identifier-naming)
31 MetadataParamTypes const MetadataParamTypes::TABLE_NAME("table_name");
32 // NOLINTNEXTLINE(readability-identifier-naming)
33 MetadataParamTypes const MetadataParamTypes::APP_PROFILE_NAME(
34  "app_profile.name");
35 // NOLINTNEXTLINE(readability-identifier-naming)
36 MetadataParamTypes const MetadataParamTypes::INSTANCE_NAME("instance.name");
37 // NOLINTNEXTLINE(readability-identifier-naming)
38 MetadataParamTypes const MetadataParamTypes::BACKUP_NAME("backup.name");
39 
41  std::string const& resource_name,
42  MetadataParamTypes const& metadata_param_type)
43  : value_(metadata_param_type.type() + '=' + resource_name),
44  api_client_header_(internal::ApiClientHeader()) {}
45 
46 void MetadataUpdatePolicy::Setup(grpc::ClientContext& context) const {
47  context.AddMetadata(std::string("x-goog-request-params"), value());
48  context.AddMetadata(std::string("x-goog-api-client"), api_client_header());
49 }
50 
52 } // namespace bigtable
53 } // namespace cloud
54 } // namespace google