| 3049 | } |
| 3050 | |
| 3051 | Result<std::string> S3FileSystem::MakeUri(std::string path) const { |
| 3052 | if (path.length() <= 1 || path[0] != '/') { |
| 3053 | return Status::Invalid("MakeUri requires an absolute, non-root path, got ", path); |
| 3054 | } |
| 3055 | ARROW_ASSIGN_OR_RAISE(auto uri, util::UriFromAbsolutePath(path)); |
| 3056 | if (!options().GetAccessKey().empty()) { |
| 3057 | uri = "s3://" + options().GetAccessKey() + ":" + options().GetSecretKey() + "@" + |
| 3058 | uri.substr("file:///"s.size()); |
| 3059 | } else { |
| 3060 | uri = "s3" + uri.substr("file"s.size()); |
| 3061 | } |
| 3062 | uri += "?"; |
| 3063 | uri += "region=" + util::UriEscape(options().region); |
| 3064 | uri += "&"; |
| 3065 | uri += "scheme=" + util::UriEscape(options().scheme); |
| 3066 | uri += "&"; |
| 3067 | uri += "endpoint_override=" + util::UriEscape(options().endpoint_override); |
| 3068 | uri += "&"; |
| 3069 | uri += "allow_bucket_creation="s + (options().allow_bucket_creation ? "1" : "0"); |
| 3070 | uri += "&"; |
| 3071 | uri += "allow_bucket_deletion="s + (options().allow_bucket_deletion ? "1" : "0"); |
| 3072 | return uri; |
| 3073 | } |
| 3074 | |
| 3075 | S3Options S3FileSystem::options() const { return impl_->options(); } |
| 3076 | |