Skip to content

Commit 7f9799e

Browse files
committed
[Storage] Fix static analysis failed in remove-azurermStoragecontainer
1 parent 69bb4c7 commit 7f9799e

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

src/ResourceManager/Storage/Commands.Management.Storage/Blob/RemoveAzureStorageContainer.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace Microsoft.Azure.Commands.Management.Storage
2424
{
25-
[Cmdlet(VerbsCommon.Remove, StorageContainerNounStr, DefaultParameterSetName = AccountNameParameterSet, SupportsShouldProcess = true)]
25+
[Cmdlet(VerbsCommon.Remove, StorageContainerNounStr, DefaultParameterSetName = AccountNameParameterSet, SupportsShouldProcess = true), OutputType(typeof(bool))]
2626
public class RemoveAzureStorageContainerCommand : StorageBlobBaseCmdlet
2727
{
2828
/// <summary>
@@ -93,6 +93,9 @@ public class RemoveAzureStorageContainerCommand : StorageBlobBaseCmdlet
9393
[Parameter(HelpMessage = "Force to remove the container and all content in it")]
9494
public SwitchParameter Force { get; set; }
9595

96+
[Parameter(Mandatory = false)]
97+
public SwitchParameter PassThru { get; set; }
98+
9699
public override void ExecuteCmdlet()
97100
{
98101
base.ExecuteCmdlet();
@@ -118,6 +121,11 @@ public override void ExecuteCmdlet()
118121
this.ResourceGroupName,
119122
this.StorageAccountName,
120123
this.Name);
124+
125+
if (PassThru.IsPresent)
126+
{
127+
WriteObject(true);
128+
}
121129
}
122130
}
123131
}

src/ResourceManager/Storage/Commands.Management.Storage/help/Remove-AzureRmStorageContainer.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ Removes a Storage blob container
1414

1515
### AccountName (Default)
1616
```
17-
Remove-AzureRmStorageContainer [-ResourceGroupName] <String> [-StorageAccountName] <String> [-Name] <String>
18-
[-Force] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
17+
Remove-AzureRmStorageContainer [-ResourceGroupName] <String> [-StorageAccountName] <String> -Name <String>
18+
[-Force] [-PassThru] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
1919
```
2020

2121
### AccountObject
2222
```
23-
Remove-AzureRmStorageContainer [-Name] <String> -StorageAccount <PSStorageAccount> [-Force]
23+
Remove-AzureRmStorageContainer -Name <String> -StorageAccount <PSStorageAccount> [-Force] [-PassThru]
2424
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### ContainerObject
2828
```
29-
Remove-AzureRmStorageContainer -InputObject <PSContainer> [-Force] [-DefaultProfile <IAzureContextContainer>]
30-
[-WhatIf] [-Confirm] [<CommonParameters>]
29+
Remove-AzureRmStorageContainer -InputObject <PSContainer> [-Force] [-PassThru]
30+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

3333
## DESCRIPTION
@@ -37,15 +37,15 @@ The **Remove-AzureRmStorageContainer** cmdlet removes a Storage blob container
3737

3838
### Example 1: Remove a Storage blob container with Storage account name and container name
3939
```
40-
PS C:\>Remove-AzureRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer"
40+
PS C:\>Remove-AzureRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer"
4141
```
4242

4343
This command removes a Storage blob container with Storage account name and container name.
4444

4545
### Example 2: Remove a Storage blob container with Storage account object and container name
4646
```
4747
PS C:\>$accountObject = Get-AzureRmStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"
48-
PS C:\>Remove-AzureRmStorageContainer -StorageAccount $accountObject -ContainerName "myContainer"
48+
PS C:\>Remove-AzureRmStorageContainer -StorageAccount $accountObject -ContainerName "myContainer"
4949
```
5050

5151
This command removes a Storage blob container with Storage account object and container name.
@@ -80,7 +80,7 @@ Force to remove the container and all content in it
8080
```yaml
8181
Type: SwitchParameter
8282
Parameter Sets: (All)
83-
Aliases:
83+
Aliases:
8484

8585
Required: False
8686
Position: Named
@@ -113,19 +113,34 @@ Parameter Sets: AccountName, AccountObject
113113
Aliases: N, ContainerName
114114

115115
Required: True
116-
Position: 2
116+
Position: Named
117117
Default value: None
118118
Accept pipeline input: True (ByPropertyName, ByValue)
119119
Accept wildcard characters: False
120120
```
121121
122+
### -PassThru
123+
{{Fill PassThru Description}}
124+
125+
```yaml
126+
Type: SwitchParameter
127+
Parameter Sets: (All)
128+
Aliases:
129+
130+
Required: False
131+
Position: Named
132+
Default value: None
133+
Accept pipeline input: False
134+
Accept wildcard characters: False
135+
```
136+
122137
### -ResourceGroupName
123138
Resource Group Name.
124139
125140
```yaml
126141
Type: String
127142
Parameter Sets: AccountName
128-
Aliases:
143+
Aliases:
129144

130145
Required: True
131146
Position: 0
@@ -140,7 +155,7 @@ Storage account object
140155
```yaml
141156
Type: PSStorageAccount
142157
Parameter Sets: AccountObject
143-
Aliases:
158+
Aliases:
144159

145160
Required: True
146161
Position: Named
@@ -208,4 +223,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
208223
## NOTES
209224
210225
## RELATED LINKS
211-

0 commit comments

Comments
 (0)