是否可以对 Azure 存储进行 API 调用以判断我的容器是否已被删除?
Is there an API call I can make to Azure Storage to tell if my container has been deleted?
我想清除存储帐户,然后使用 AzCopy "restore" 到它。
我使用
清除了昨晚的存储空间
$ctx = New-AzureStorageContext -StorageAccountName $storage -StorageAccountKey $key
Get-AzureStorageContainer a* -Context $ctx | Remove-AzureStorageContainer -Force
然后使用 AzCopy 但得到;
The remote server returned an error: (409) Conflict.
The specified container is being deleted. Try operation later.
我不想循环,尝试再次创建存储。如何等待删除操作完成?
是否有 Get-AzureStorageContainer 状态? "Deleting?"
Is there a Get-AzureStorageContainer status? "Deleting?"
不幸的是 none。你只需要继续努力。
基于此处的文档:https://msdn.microsoft.com/en-us/library/azure/dd179408.aspx
When a container is deleted, a container with the same name cannot be
created for at least 30 seconds; the container may not be available
for more than 30 seconds if the service is still processing the
request. While the container is being deleted, attempts to create a
container of the same name will fail with status code 409 (Conflict),
with the service returning additional error information indicating
that the container is being deleted. All other operations, including
operations on any blobs under the container, will fail with status
code 404 (Not Found) while the container is being deleted.
虽然他们说的是 30 秒,但根据容器中 blob 的数量,可能需要更长的时间。
其他替代方法是单独删除所有 blob,而不是删除容器。但是,因为每个删除都是一个单独的网络调用,该过程可能 运行 持续时间更长(并且容易出现网络故障),但它可以保证您在开始使用 AzCopy 时,容器将为空。
错误消息是否足以让您产生相同的行为。您可以自己编写 API。或者我遗漏了什么?
"The specified container is being deleted. Try operation later."
我想清除存储帐户,然后使用 AzCopy "restore" 到它。
我使用
清除了昨晚的存储空间
$ctx = New-AzureStorageContext -StorageAccountName $storage -StorageAccountKey $key
Get-AzureStorageContainer a* -Context $ctx | Remove-AzureStorageContainer -Force
然后使用 AzCopy 但得到;
The remote server returned an error: (409) Conflict.
The specified container is being deleted. Try operation later.
我不想循环,尝试再次创建存储。如何等待删除操作完成?
是否有 Get-AzureStorageContainer 状态? "Deleting?"
Is there a Get-AzureStorageContainer status? "Deleting?"
不幸的是 none。你只需要继续努力。
基于此处的文档:https://msdn.microsoft.com/en-us/library/azure/dd179408.aspx
When a container is deleted, a container with the same name cannot be created for at least 30 seconds; the container may not be available for more than 30 seconds if the service is still processing the request. While the container is being deleted, attempts to create a container of the same name will fail with status code 409 (Conflict), with the service returning additional error information indicating that the container is being deleted. All other operations, including operations on any blobs under the container, will fail with status code 404 (Not Found) while the container is being deleted.
虽然他们说的是 30 秒,但根据容器中 blob 的数量,可能需要更长的时间。
其他替代方法是单独删除所有 blob,而不是删除容器。但是,因为每个删除都是一个单独的网络调用,该过程可能 运行 持续时间更长(并且容易出现网络故障),但它可以保证您在开始使用 AzCopy 时,容器将为空。
错误消息是否足以让您产生相同的行为。您可以自己编写 API。或者我遗漏了什么?
"The specified container is being deleted. Try operation later."