| 1490 | /// \pre location.container is not empty. |
| 1491 | template <class ContainerClient> |
| 1492 | Result<FileInfo> GetContainerPropsAsFileInfo(const AzureLocation& location, |
| 1493 | const ContainerClient& container_client) { |
| 1494 | DCHECK(!location.container.empty()); |
| 1495 | FileInfo info{location.path.empty() ? location.all : location.container}; |
| 1496 | try { |
| 1497 | auto properties = container_client.GetProperties(); |
| 1498 | info.set_type(FileType::Directory); |
| 1499 | info.set_mtime(std::chrono::system_clock::time_point{properties.Value.LastModified}); |
| 1500 | return info; |
| 1501 | } catch (const Core::RequestFailedException& exception) { |
| 1502 | if (IsContainerNotFound(exception)) { |
| 1503 | info.set_type(FileType::NotFound); |
| 1504 | return info; |
| 1505 | } |
| 1506 | return ExceptionToStatus(exception, "GetProperties for '", container_client.GetUrl(), |
| 1507 | "' failed."); |
| 1508 | } |
| 1509 | } |
| 1510 | |
| 1511 | template <class ContainerClient> |
| 1512 | Status CreateContainerIfNotExists(const std::string& container_name, |
no test coverage detected