Tests to see if a bucket exists
| 2242 | |
| 2243 | // Tests to see if a bucket exists |
| 2244 | Result<bool> BucketExists(const std::string& bucket) { |
| 2245 | ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock()); |
| 2246 | |
| 2247 | S3Model::HeadBucketRequest req; |
| 2248 | req.SetBucket(ToAwsString(bucket)); |
| 2249 | |
| 2250 | auto outcome = client_lock.Move()->HeadBucket(req); |
| 2251 | if (!outcome.IsSuccess()) { |
| 2252 | if (!IsNotFound(outcome.GetError())) { |
| 2253 | return ErrorToStatus(std::forward_as_tuple( |
| 2254 | "When testing for existence of bucket '", bucket, "': "), |
| 2255 | "HeadBucket", outcome.GetError()); |
| 2256 | } |
| 2257 | return false; |
| 2258 | } |
| 2259 | return true; |
| 2260 | } |
| 2261 | |
| 2262 | // Create a bucket. Successful if bucket already exists. |
| 2263 | Status CreateBucket(const std::string& bucket) { |
nothing calls this directly
no test coverage detected