-
Notifications
You must be signed in to change notification settings - Fork 4k
[Storage] Support container softdelete #15284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fa70f61
to
24e6c72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @blueww , please submit a cmdlet design for new added cmdlets.
For Enable-AzStorageContainerDeleteRetentionPolicy
and Disable-AzStorageContainerDeleteRetentionPolicy
,
I suggest we combine them as one cmdlet, for instance Update-AzStorageContainer [DeleteRetentionPolicy <switch>]
.
$stos = Get-AzStorageAccount -ResourceGroupName $rgname; | ||
|
||
# Enable Blob Delete Retention Policy | ||
$policy = Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName $rgname -StorageAccountName $stoname -PassThru -RetentionDays 30 | ||
Assert-AreEqual $true $policy.Enabled | ||
Assert-AreEqual 30 $policy.Days | ||
$property = Get-AzStorageBlobServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname | ||
Assert-AreEqual $true $property.ContainerDeleteRetentionPolicy.Enabled | ||
Assert-AreEqual 30 $property.ContainerDeleteRetentionPolicy.Days | ||
|
||
# Create and delete container, then get container | ||
$contaierName = "testcontaienr" | ||
New-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname -Name $contaierName | ||
Remove-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname -Name $contaierName -Force | ||
$cons = Get-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname | ||
Assert-AreEqual 0 $cons.Count | ||
$cons = Get-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeDeleted | ||
Assert-AreEqual 1 $cons.Count | ||
Assert-AreEqual $contaierName $cons[0].Name | ||
Assert-AreEqual $true $cons[0].Deleted | ||
|
||
|
||
# Disable Blob Delete Retention Policy | ||
$policy = Disable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName $rgname -StorageAccountName $stoname -PassThru | ||
Assert-AreEqual $false $policy.Enabled | ||
$property = Get-AzStorageBlobServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname | ||
Assert-AreEqual $false $property.ContainerDeleteRetentionPolicy.Enabled | ||
|
||
Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @blueww , please correct indents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
$containerNamesoftdelete = "softdeletecontainer" | ||
New-AzStorageContainer -Name $containerNamesoftdelete -Context $storageContext | ||
Remove-AzStorageContainer -Name $containerNamesoftdelete -Context $storageContext -Force | ||
## Get container without -IncludeDeleted, won't list out deleted containers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct indents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
For Enable-AzStorageContainerDeleteRetentionPolicy and Disable-AzStorageContainerDeleteRetentionPolicy, they are alredy in https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/726.
|
Make sense. |
9d23e5f
to
d427562
Compare
/azp run azure-powershell - windows-powershell |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
design pass review in: Azure/azure-powershell-cmdlet-review-pr#726
Add a static analysis exception for -RetentionDays. This is already discussed in design review and the name agreed.
Checklist
CONTRIBUTING.md
ChangeLog.md
file(s) has been updated:ChangeLog.md
file can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
## Upcoming Release
header -- no new version header should be added