Tests to see if a bucket exists
| 2301 | |
| 2302 | // Tests to see if a bucket exists |
| 2303 | Result<bool> BucketExists(const std::string& bucket) { |
| 2304 | ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock()); |
| 2305 | |
| 2306 | S3Model::HeadBucketRequest req; |
| 2307 | req.SetBucket(ToAwsString(bucket)); |
| 2308 | |
| 2309 | auto outcome = client_lock.Move()->HeadBucket(req); |
| 2310 | if (!outcome.IsSuccess()) { |
| 2311 | if (!IsNotFound(outcome.GetError())) { |
| 2312 | return ErrorToStatus(std::forward_as_tuple( |
| 2313 | "When testing for existence of bucket '", bucket, "': "), |
| 2314 | "HeadBucket", outcome.GetError()); |
| 2315 | } |
| 2316 | return false; |
| 2317 | } |
| 2318 | return true; |
| 2319 | } |
| 2320 | |
| 2321 | // Create a bucket. Successful if bucket already exists. |
| 2322 | Status CreateBucket(const std::string& bucket) { |
nothing calls this directly
no test coverage detected