|
29 | 29 | #include "google/cloud/bigtable/version.h" |
30 | 30 | #include "google/cloud/future.h" |
31 | 31 | #include "google/cloud/iam_policy.h" |
| 32 | +#include "google/cloud/project.h" |
32 | 33 | #include "google/cloud/status_or.h" |
33 | 34 | #include <future> |
34 | 35 | #include <memory> |
@@ -128,7 +129,8 @@ class InstanceAdmin { |
128 | 129 | */ |
129 | 130 | explicit InstanceAdmin(std::shared_ptr<InstanceAdminClient> client) |
130 | 131 | : client_(std::move(client)), |
131 | | - project_name_("projects/" + project_id()), |
| 132 | + project_id_(client_->project()), |
| 133 | + project_name_(Project(project_id_).FullName()), |
132 | 134 | rpc_retry_policy_prototype_( |
133 | 135 | DefaultRPCRetryPolicy(internal::kBigtableInstanceAdminLimits)), |
134 | 136 | rpc_backoff_policy_prototype_( |
@@ -170,24 +172,24 @@ class InstanceAdmin { |
170 | 172 | /// The full name (`projects/<project_id>`) of the project. |
171 | 173 | std::string const& project_name() const { return project_name_; } |
172 | 174 | /// The project id, i.e., `project_name()` without the `projects/` prefix. |
173 | | - std::string const& project_id() const { return client_->project(); } |
| 175 | + std::string const& project_id() const { return project_id_; } |
174 | 176 |
|
175 | 177 | /// Return the fully qualified name of the given instance_id. |
176 | 178 | std::string InstanceName(std::string const& instance_id) const { |
177 | | - return google::cloud::bigtable::InstanceName(project_id(), instance_id); |
| 179 | + return google::cloud::bigtable::InstanceName(project_id_, instance_id); |
178 | 180 | } |
179 | 181 |
|
180 | 182 | /// Return the fully qualified name of the given cluster_id in give |
181 | 183 | /// instance_id. |
182 | 184 | std::string ClusterName(std::string const& instance_id, |
183 | 185 | std::string const& cluster_id) const { |
184 | | - return google::cloud::bigtable::ClusterName(project_id(), instance_id, |
| 186 | + return google::cloud::bigtable::ClusterName(project_id_, instance_id, |
185 | 187 | cluster_id); |
186 | 188 | } |
187 | 189 |
|
188 | 190 | std::string AppProfileName(std::string const& instance_id, |
189 | 191 | std::string const& profile_id) const { |
190 | | - return google::cloud::bigtable::AppProfileName(project_id(), instance_id, |
| 192 | + return google::cloud::bigtable::AppProfileName(project_id_, instance_id, |
191 | 193 | profile_id); |
192 | 194 | } |
193 | 195 |
|
@@ -772,6 +774,7 @@ class InstanceAdmin { |
772 | 774 | AppProfileUpdateConfig config); |
773 | 775 |
|
774 | 776 | std::shared_ptr<InstanceAdminClient> client_; |
| 777 | + std::string project_id_; |
775 | 778 | std::string project_name_; |
776 | 779 | std::shared_ptr<RPCRetryPolicy const> rpc_retry_policy_prototype_; |
777 | 780 | std::shared_ptr<RPCBackoffPolicy const> rpc_backoff_policy_prototype_; |
|
0 commit comments