| 1270 | } |
| 1271 | |
| 1272 | Status GcsFileSystem::GetBucketLocation(const string& bucket, |
| 1273 | string* location) { |
| 1274 | auto compute_func = [this](const string& bucket, string* location) { |
| 1275 | std::vector<char> result_buffer; |
| 1276 | Status status = GetBucketMetadata(bucket, &result_buffer); |
| 1277 | Json::Value result; |
| 1278 | TF_RETURN_IF_ERROR(ParseJson(result_buffer, &result)); |
| 1279 | string bucket_location; |
| 1280 | TF_RETURN_IF_ERROR( |
| 1281 | GetStringValue(result, kBucketMetadataLocationKey, &bucket_location)); |
| 1282 | // Lowercase the GCS location to be case insensitive for allowed locations. |
| 1283 | *location = absl::AsciiStrToLower(bucket_location); |
| 1284 | return Status::OK(); |
| 1285 | }; |
| 1286 | |
| 1287 | TF_RETURN_IF_ERROR( |
| 1288 | bucket_location_cache_->LookupOrCompute(bucket, location, compute_func)); |
| 1289 | |
| 1290 | return Status::OK(); |
| 1291 | } |
| 1292 | |
| 1293 | Status GcsFileSystem::GetBucketMetadata(const string& bucket, |
| 1294 | std::vector<char>* result_buffer) { |
nothing calls this directly
no test coverage detected