Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
database_admin_option_defaults.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 // 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 // Generated by the Codegen C++ plugin.
16 // If you make any local changes, they will be lost.
17 // source: google/spanner/admin/database/v1/spanner_database_admin.proto
18 
19 #include "google/cloud/spanner/admin/internal/database_admin_option_defaults.h"
20 #include "google/cloud/spanner/admin/database_admin_connection.h"
21 #include "google/cloud/spanner/admin/database_admin_options.h"
22 #include "google/cloud/common_options.h"
23 #include "google/cloud/connection_options.h"
24 #include "google/cloud/grpc_options.h"
25 #include "google/cloud/internal/getenv.h"
26 #include "google/cloud/internal/user_agent_prefix.h"
27 #include "google/cloud/options.h"
28 #include <memory>
29 
30 namespace google {
31 namespace cloud {
32 namespace spanner_admin_internal {
33 inline namespace GOOGLE_CLOUD_CPP_GENERATED_NS {
34 
35 namespace {
36 auto constexpr kBackoffScaling = 2.0;
37 } // namespace
38 
40  if (!options.has<EndpointOption>()) {
41  auto env = internal::GetEnv("GOOGLE_CLOUD_CPP_SPANNER_DEFAULT_ENDPOINT");
43  env && !env->empty() ? *env : "spanner.googleapis.com");
44  }
45  if (auto emulator = internal::GetEnv("SPANNER_EMULATOR_HOST")) {
47  grpc::InsecureChannelCredentials());
48  }
49  if (!options.has<GrpcCredentialOption>()) {
50  options.set<GrpcCredentialOption>(grpc::GoogleDefaultCredentials());
51  }
52  if (!options.has<TracingComponentsOption>()) {
53  options.set<TracingComponentsOption>(internal::DefaultTracingComponents());
54  }
56  options.set<GrpcTracingOptionsOption>(internal::DefaultTracingOptions());
57  }
58  auto& products = options.lookup<UserAgentProductsOption>();
59  products.insert(products.begin(), google::cloud::internal::UserAgentPrefix());
60 
63  spanner_admin::DatabaseAdminLimitedTimeRetryPolicy(
64  std::chrono::minutes(30))
65  .clone());
66  }
69  ExponentialBackoffPolicy(std::chrono::seconds(1),
70  std::chrono::minutes(5), kBackoffScaling)
71  .clone());
72  }
79  ->clone(),
81  ->clone())
82  .clone());
83  }
84  if (!options.has<
88  }
89 
90  return options;
91 }
92 
93 } // namespace GOOGLE_CLOUD_CPP_GENERATED_NS
94 } // namespace spanner_admin_internal
95 } // namespace cloud
96 } // namespace google