Skip to content

Commit bf5b36a

Browse files
committed
Add PassThru parameters for stop and remove cmdlets.
1 parent 4af0d76 commit bf5b36a

File tree

10 files changed

+89
-24
lines changed

10 files changed

+89
-24
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Deployments/RemoveAzureDeploymentCmdlet.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2323
/// Deletes a deployment.
2424
/// </summary>
2525
[Cmdlet(VerbsCommon.Remove, "AzureRmDeployment", SupportsShouldProcess = true,
26-
DefaultParameterSetName = RemoveAzureDeploymentCmdlet.DeploymentNameParameterSet), OutputType(typeof(void))]
26+
DefaultParameterSetName = RemoveAzureDeploymentCmdlet.DeploymentNameParameterSet), OutputType(typeof(bool))]
2727
public class RemoveAzureDeploymentCmdlet : ResourceManagerCmdletBase
2828
{
2929
/// <summary>
@@ -59,6 +59,9 @@ public class RemoveAzureDeploymentCmdlet : ResourceManagerCmdletBase
5959
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
6060
public SwitchParameter AsJob { get; set; }
6161

62+
[Parameter(Mandatory = false)]
63+
public SwitchParameter PassThru { get; set; }
64+
6265
public override void ExecuteCmdlet()
6366
{
6467
ConfirmAction(
@@ -71,6 +74,11 @@ public override void ExecuteCmdlet()
7174
: !string.IsNullOrEmpty(this.Id) ? ResourceIdUtility.GetResourceName(this.Id) : this.InputObject.DeploymentName;
7275

7376
ResourceManagerSdkClient.DeleteDeploymentAtSubscriptionScope(deploymentName);
77+
78+
if (this.PassThru.IsPresent)
79+
{
80+
WriteObject(true);
81+
}
7482
});
7583
}
7684
}

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Deployments/StopAzureDeploymentCmdlet.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2323
/// Cancel a running deployment.
2424
/// </summary>
2525
[Cmdlet(VerbsLifecycle.Stop, "AzureRmDeployment", SupportsShouldProcess = true,
26-
DefaultParameterSetName = StopAzureDeploymentCmdlet.DeploymentNameParameterSet), OutputType(typeof(void))]
26+
DefaultParameterSetName = StopAzureDeploymentCmdlet.DeploymentNameParameterSet), OutputType(typeof(bool))]
2727
public class StopAzureDeploymentCmdlet : ResourceManagerCmdletBase
2828
{
2929
/// <summary>
@@ -56,6 +56,9 @@ public class StopAzureDeploymentCmdlet : ResourceManagerCmdletBase
5656
ValueFromPipeline = true, HelpMessage = "The deployment object.")]
5757
public PSDeployment InputObject { get; set; }
5858

59+
[Parameter(Mandatory = false)]
60+
public SwitchParameter PassThru { get; set; }
61+
5962
public override void ExecuteCmdlet()
6063
{
6164
var deploymentName = !string.IsNullOrEmpty(this.Name)
@@ -67,7 +70,10 @@ public override void ExecuteCmdlet()
6770
this.Name,
6871
() => ResourceManagerSdkClient.CancelDeploymentAtSubscriptionScope(deploymentName));
6972

70-
WriteObject(true);
73+
if (this.PassThru.IsPresent)
74+
{
75+
WriteObject(true);
76+
}
7177
}
7278
}
7379
}

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Deployments/TestAzureDeploymentCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2727
[Cmdlet(VerbsDiagnostic.Test, "AzureRmDeployment", DefaultParameterSetName = ParameterlessTemplateFileParameterSetName), OutputType(typeof(PSResourceManagerError))]
2828
public class TestAzureDeploymentCmdlet : ResourceWithParameterCmdletBase, IDynamicParameters
2929
{
30-
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The location to store deployment data.")]
30+
[Parameter(Mandatory = true, HelpMessage = "The location to store deployment data.")]
3131
[LocationCompleter("Microsoft.Resources/resourceGroups")]
3232
[ValidateNotNullOrEmpty]
3333
public string Location { get; set; }

src/ResourceManager/Resources/Commands.Resources/help/Get-AzureRmDeployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Aliases: DeploymentName
107107
Required: False
108108
Position: 0
109109
Default value: None
110-
Accept pipeline input: True (ByPropertyName)
110+
Accept pipeline input: False
111111
Accept wildcard characters: False
112112
```
113113

src/ResourceManager/Resources/Commands.Resources/help/Get-AzureRmDeploymentOperation.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ Get deployment operation
1212

1313
## SYNTAX
1414

15+
### GetByDeploymentName (Default)
1516
```
1617
Get-AzureRmDeploymentOperation -DeploymentName <String> [-OperationId <String>] [-ApiVersion <String>] [-Pre]
1718
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
1819
```
1920

21+
### GetByDeploymentObject
22+
```
23+
Get-AzureRmDeploymentOperation -DeploymentObject <PSDeployment> [-ApiVersion <String>] [-Pre]
24+
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
25+
```
26+
2027
## DESCRIPTION
2128
The **Get-AzureRmDeploymentOperation** cmdlet lists all the operations that were part of a deployment to help you identify and give more information about the exact operations that failed for a particular deployment.
2229
It can also show the response and the request content for each deployment operation.
@@ -80,13 +87,28 @@ The deployment name.
8087
8188
```yaml
8289
Type: String
83-
Parameter Sets: (All)
90+
Parameter Sets: GetByDeploymentName
91+
Aliases:
92+
93+
Required: True
94+
Position: Named
95+
Default value: None
96+
Accept pipeline input: False
97+
Accept wildcard characters: False
98+
```
99+
100+
### -DeploymentObject
101+
The deployment object.
102+
103+
```yaml
104+
Type: PSDeployment
105+
Parameter Sets: GetByDeploymentObject
84106
Aliases:
85107

86108
Required: True
87109
Position: Named
88110
Default value: None
89-
Accept pipeline input: True (ByPropertyName)
111+
Accept pipeline input: True (ByValue)
90112
Accept wildcard characters: False
91113
```
92114
@@ -95,13 +117,13 @@ The deployment operation Id.
95117
96118
```yaml
97119
Type: String
98-
Parameter Sets: (All)
120+
Parameter Sets: GetByDeploymentName
99121
Aliases:
100122

101123
Required: False
102124
Position: Named
103125
Default value: None
104-
Accept pipeline input: True (ByPropertyName)
126+
Accept pipeline input: False
105127
Accept wildcard characters: False
106128
```
107129
@@ -130,7 +152,7 @@ System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, Publ
130152

131153
## OUTPUTS
132154

133-
### System.Management.Automation.PSObject
155+
### Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSDeploymentOperation
134156

135157
## NOTES
136158

src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmDeployment.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,11 @@ The deployment debug log level.
155155
Type: String
156156
Parameter Sets: (All)
157157
Aliases:
158-
Accepted values: RequestContent, ResponseContent, All, None
159158

160159
Required: False
161160
Position: Named
162161
Default value: None
163-
Accept pipeline input: True (ByPropertyName)
162+
Accept pipeline input: False
164163
Accept wildcard characters: False
165164
```
166165
@@ -175,7 +174,7 @@ Aliases:
175174
Required: True
176175
Position: Named
177176
Default value: None
178-
Accept pipeline input: True (ByPropertyName)
177+
Accept pipeline input: False
179178
Accept wildcard characters: False
180179
```
181180
@@ -192,7 +191,7 @@ Aliases: DeploymentName
192191
Required: False
193192
Position: Named
194193
Default value: None
195-
Accept pipeline input: True (ByPropertyName)
194+
Accept pipeline input: False
196195
Accept wildcard characters: False
197196
```
198197

src/ResourceManager/Resources/Commands.Resources/help/Remove-AzureRmDeployment.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ Removes a deployment and any associated operations
1414

1515
### RemoveByDeploymentName (Default)
1616
```
17-
Remove-AzureRmDeployment [-Name] <String> [-AsJob] [-ApiVersion <String>] [-Pre]
17+
Remove-AzureRmDeployment [-Name] <String> [-AsJob] [-PassThru] [-ApiVersion <String>] [-Pre]
1818
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
1919
```
2020

2121
### RemoveByDeploymentId
2222
```
23-
Remove-AzureRmDeployment -Id <String> [-AsJob] [-ApiVersion <String>] [-Pre]
23+
Remove-AzureRmDeployment -Id <String> [-AsJob] [-PassThru] [-ApiVersion <String>] [-Pre]
2424
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### RemoveByInputObject
2828
```
29-
Remove-AzureRmDeployment -InputObject <PSDeployment> [-AsJob] [-ApiVersion <String>] [-Pre]
29+
Remove-AzureRmDeployment -InputObject <PSDeployment> [-AsJob] [-PassThru] [-ApiVersion <String>] [-Pre]
3030
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

@@ -143,6 +143,21 @@ Accept pipeline input: False
143143
Accept wildcard characters: False
144144
```
145145
146+
### -PassThru
147+
{{Fill PassThru Description}}
148+
149+
```yaml
150+
Type: SwitchParameter
151+
Parameter Sets: (All)
152+
Aliases:
153+
154+
Required: False
155+
Position: Named
156+
Default value: None
157+
Accept pipeline input: False
158+
Accept wildcard characters: False
159+
```
160+
146161
### -Pre
147162
When set, indicates that the cmdlet should use pre-release API versions when automatically determining which version to use.
148163

src/ResourceManager/Resources/Commands.Resources/help/Save-AzureRmDeploymentTemplate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Aliases:
133133
Required: False
134134
Position: Named
135135
Default value: None
136-
Accept pipeline input: True (ByPropertyName)
136+
Accept pipeline input: False
137137
Accept wildcard characters: False
138138
```
139139
@@ -192,7 +192,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
192192
193193
## OUTPUTS
194194
195-
### System.Management.Automation.PSTemplatePath
195+
### Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels
196196
197197
## NOTES
198198

src/ResourceManager/Resources/Commands.Resources/help/Stop-AzureRmDeployment.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ Cancal a running deployment
1414

1515
### StopByDeploymentName (Default)
1616
```
17-
Stop-AzureRmDeployment [-Name] <String> [-ApiVersion <String>] [-Pre]
17+
Stop-AzureRmDeployment [-Name] <String> [-PassThru] [-ApiVersion <String>] [-Pre]
1818
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
1919
```
2020

2121
### StopByDeploymentId
2222
```
23-
Stop-AzureRmDeployment -Id <String> [-ApiVersion <String>] [-Pre] [-DefaultProfile <IAzureContextContainer>]
24-
[-WhatIf] [-Confirm] [<CommonParameters>]
23+
Stop-AzureRmDeployment -Id <String> [-PassThru] [-ApiVersion <String>] [-Pre]
24+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### StopByInputObject
2828
```
29-
Stop-AzureRmDeployment -InputObject <PSDeployment> [-ApiVersion <String>] [-Pre]
29+
Stop-AzureRmDeployment -InputObject <PSDeployment> [-PassThru] [-ApiVersion <String>] [-Pre]
3030
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

@@ -133,6 +133,21 @@ Accept pipeline input: False
133133
Accept wildcard characters: False
134134
```
135135
136+
### -PassThru
137+
{{Fill PassThru Description}}
138+
139+
```yaml
140+
Type: SwitchParameter
141+
Parameter Sets: (All)
142+
Aliases:
143+
144+
Required: False
145+
Position: Named
146+
Default value: None
147+
Accept pipeline input: False
148+
Accept wildcard characters: False
149+
```
150+
136151
### -Pre
137152
When set, indicates that the cmdlet should use pre-release API versions when automatically determining which version to use.
138153

src/ResourceManager/Resources/Commands.Resources/help/Test-AzureRmDeployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Aliases:
116116
Required: True
117117
Position: Named
118118
Default value: None
119-
Accept pipeline input: True (ByPropertyName)
119+
Accept pipeline input: False
120120
Accept wildcard characters: False
121121
```
122122

0 commit comments

Comments
 (0)