coryan commented on a change in pull request #12475:
URL: https://github.com/apache/arrow/pull/12475#discussion_r812218202
##########
File path: cpp/src/arrow/filesystem/gcsfs.cc
##########
@@ -642,14 +658,73 @@ GcsOptions GcsOptions::FromImpersonatedServiceAccount(
google::cloud::MakeImpersonateServiceAccountCredentials(
base_credentials.credentials,
target_service_account)),
{},
- "https"};
+ "https",
+ /*default_bucket_location=*/{},
+ /*default_metadata=*/nullptr};
}
GcsOptions GcsOptions::FromServiceAccountCredentials(const std::string&
json_object) {
return GcsOptions{std::make_shared<GcsCredentials>(
google::cloud::MakeServiceAccountCredentials(json_object)),
{},
- "https"};
+ "https",
+ /*default_bucket_location=*/{},
+ /*default_metadata=*/nullptr};
+}
+
+Result<GcsOptions> GcsOptions::FromUri(const arrow::internal::Uri& uri,
+ std::string* out_path) {
+ const auto bucket = uri.host();
+ auto path = uri.path();
+ if (bucket.empty()) {
+ if (!path.empty()) {
+ return Status::Invalid("Missing bucket name in GCS URI");
+ }
+ } else {
+ if (path.empty()) {
+ path = bucket;
+ } else {
+ if (path[0] != '/') {
+ return Status::Invalid("GCS URI should be absolute, not relative");
+ }
+ path = bucket + path;
+ }
+ }
+ if (out_path != nullptr) {
+ *out_path = std::string(internal::RemoveTrailingSlash(path));
+ }
+
+ std::unordered_map<std::string, std::string> options_map;
+ ARROW_ASSIGN_OR_RAISE(const auto options_items, uri.query_items());
+ for (const auto& kv : options_items) {
+ options_map.emplace(kv.first, kv.second);
+ }
+
+ if (!uri.password().empty() || !uri.username().empty()) {
+ return Status::Invalid("GCS does not accept username or password.");
Review comment:
The JSON API, which is the API used under the hood by the client
libraries (C++ or any other language) does not have passwords.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]