\pre location.container is not empty. \pre location.path is empty.
| 2456 | /// \pre location.container is not empty. |
| 2457 | /// \pre location.path is empty. |
| 2458 | Status DeleteContainer(const Blobs::BlobContainerClient& container_client, |
| 2459 | const AzureLocation& location) { |
| 2460 | DCHECK(!location.container.empty()); |
| 2461 | DCHECK(location.path.empty()); |
| 2462 | try { |
| 2463 | auto response = container_client.Delete(); |
| 2464 | // Only the "*IfExists" functions ever set Deleted to false. |
| 2465 | // All the others either succeed or throw an exception. |
| 2466 | DCHECK(response.Value.Deleted); |
| 2467 | } catch (const Core::RequestFailedException& exception) { |
| 2468 | if (IsContainerNotFound(exception)) { |
| 2469 | return PathNotFound(location); |
| 2470 | } |
| 2471 | return ExceptionToStatus(exception, |
| 2472 | "Failed to delete a container: ", location.container, ": ", |
| 2473 | container_client.GetUrl()); |
| 2474 | } |
| 2475 | return Status::OK(); |
| 2476 | } |
| 2477 | |
| 2478 | /// Deletes contents of a directory and possibly the directory itself |
| 2479 | /// depending on the value of preserve_dir_marker_blob. |
no test coverage detected