Skip to content

Commit 8ac0ef5

Browse files
author
Hovsep
committed
Merge pull request #950 from chidmdxx/ResourceLockUpdate
Update parameter set for actions on Resource Lock
2 parents f2e7e44 + b9a5526 commit 8ac0ef5

File tree

2 files changed

+2
-110
lines changed

2 files changed

+2
-110
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa
8888
[ValidateNotNullOrEmpty]
8989
public string ResourceType { get; set; }
9090

91-
/// <summary>
92-
/// Gets or sets the subscription id parameter.
93-
/// </summary>
94-
[Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
95-
[Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
96-
[Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
97-
[Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")]
98-
[ValidateNotNullOrEmpty]
99-
public Guid? SubscriptionId { get; set; }
100-
10191
/// <summary>
10292
/// Gets or sets the resource group name parameter.
10393
/// </summary>
@@ -119,22 +109,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa
119109
[ValidateNotNullOrEmpty]
120110
public string LockId { get; set; }
121111

122-
/// <summary>
123-
/// Initializes the default subscription id if needed.
124-
/// </summary>
125-
protected override void OnProcessRecord()
126-
{
127-
if (string.IsNullOrWhiteSpace(this.LockId) &&
128-
string.IsNullOrWhiteSpace(this.Scope) &&
129-
this.SubscriptionId == null &&
130-
!this.TenantLevel)
131-
{
132-
this.SubscriptionId = DefaultContext.Subscription.Id;
133-
}
134-
135-
base.OnProcessRecord();
136-
}
137-
138112
/// <summary>
139113
/// Gets the resource Id from the supplied PowerShell parameters.
140114
/// </summary>
@@ -155,14 +129,14 @@ protected string GetResourceId(string lockName)
155129

156130
throw new InvalidOperationException(string.Format("The Id '{0}' does not belong to a lock.", this.LockId));
157131
}
158-
132+
159133
return !string.IsNullOrWhiteSpace(this.Scope)
160134
? ResourceIdUtility.GetResourceId(
161135
resourceId: this.Scope,
162136
extensionResourceType: Constants.MicrosoftAuthorizationLocksType,
163137
extensionResourceName: lockName)
164138
: ResourceIdUtility.GetResourceId(
165-
subscriptionId: this.SubscriptionId,
139+
subscriptionId: this.DefaultContext.Subscription.Id,
166140
resourceGroupName: this.ResourceGroupName,
167141
resourceType: this.ResourceType,
168142
resourceName: this.ResourceName,

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,13 +1396,6 @@
13961396
</maml:description>
13971397
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
13981398
</command:parameter>
1399-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
1400-
<maml:name>SubscriptionId</maml:name>
1401-
<maml:description>
1402-
<maml:para />
1403-
</maml:description>
1404-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
1405-
</command:parameter>
14061399
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
14071400
<maml:name>ResourceGroupName</maml:name>
14081401
<maml:description>
@@ -1601,13 +1594,6 @@
16011594
</maml:description>
16021595
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
16031596
</command:parameter>
1604-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
1605-
<maml:name>SubscriptionId</maml:name>
1606-
<maml:description>
1607-
<maml:para />
1608-
</maml:description>
1609-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
1610-
</command:parameter>
16111597
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
16121598
<maml:name>ApiVersion</maml:name>
16131599
<maml:description>
@@ -1660,13 +1646,6 @@
16601646
</maml:description>
16611647
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
16621648
</command:parameter>
1663-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
1664-
<maml:name>SubscriptionId</maml:name>
1665-
<maml:description>
1666-
<maml:para />
1667-
</maml:description>
1668-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
1669-
</command:parameter>
16701649
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
16711650
<maml:name>ResourceGroupName</maml:name>
16721651
<maml:description>
@@ -3299,13 +3278,6 @@
32993278
</maml:description>
33003279
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
33013280
</command:parameter>
3302-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
3303-
<maml:name>SubscriptionId</maml:name>
3304-
<maml:description>
3305-
<maml:para>The subscription to use.</maml:para>
3306-
</maml:description>
3307-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
3308-
</command:parameter>
33093281
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
33103282
<maml:name>ResourceGroupName</maml:name>
33113283
<maml:description>
@@ -3494,13 +3466,6 @@
34943466
</maml:description>
34953467
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
34963468
</command:parameter>
3497-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
3498-
<maml:name>SubscriptionId</maml:name>
3499-
<maml:description>
3500-
<maml:para>The subscription to use.</maml:para>
3501-
</maml:description>
3502-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
3503-
</command:parameter>
35043469
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
35053470
<maml:name>ApiVersion</maml:name>
35063471
<maml:description>
@@ -3581,13 +3546,6 @@
35813546
</maml:description>
35823547
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
35833548
</command:parameter>
3584-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
3585-
<maml:name>SubscriptionId</maml:name>
3586-
<maml:description>
3587-
<maml:para>The subscription to use.</maml:para>
3588-
</maml:description>
3589-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
3590-
</command:parameter>
35913549
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
35923550
<maml:name>ResourceGroupName</maml:name>
35933551
<maml:description>
@@ -4631,13 +4589,6 @@
46314589
</maml:description>
46324590
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
46334591
</command:parameter>
4634-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
4635-
<maml:name>SubscriptionId</maml:name>
4636-
<maml:description>
4637-
<maml:para>The subscription to use.</maml:para>
4638-
</maml:description>
4639-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
4640-
</command:parameter>
46414592
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
46424593
<maml:name>ResourceGroupName</maml:name>
46434594
<maml:description>
@@ -6111,13 +6062,6 @@
61116062
</maml:description>
61126063
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
61136064
</command:parameter>
6114-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
6115-
<maml:name>SubscriptionId</maml:name>
6116-
<maml:description>
6117-
<maml:para>The subscription to use.</maml:para>
6118-
</maml:description>
6119-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
6120-
</command:parameter>
61216065
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
61226066
<maml:name>ResourceGroupName</maml:name>
61236067
<maml:description>
@@ -6306,13 +6250,6 @@
63066250
</maml:description>
63076251
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
63086252
</command:parameter>
6309-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
6310-
<maml:name>SubscriptionId</maml:name>
6311-
<maml:description>
6312-
<maml:para>The subscription to use.</maml:para>
6313-
</maml:description>
6314-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
6315-
</command:parameter>
63166253
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
63176254
<maml:name>ApiVersion</maml:name>
63186255
<maml:description>
@@ -6393,13 +6330,6 @@
63936330
</maml:description>
63946331
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
63956332
</command:parameter>
6396-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
6397-
<maml:name>SubscriptionId</maml:name>
6398-
<maml:description>
6399-
<maml:para>The subscription to use.</maml:para>
6400-
</maml:description>
6401-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
6402-
</command:parameter>
64036333
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
64046334
<maml:name>ResourceGroupName</maml:name>
64056335
<maml:description>
@@ -6627,18 +6557,6 @@
66276557
</dev:type>
66286558
<dev:defaultValue></dev:defaultValue>
66296559
</command:parameter>
6630-
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="named">
6631-
<maml:name>SubscriptionId</maml:name>
6632-
<maml:description>
6633-
<maml:para>The subscription to use.</maml:para>
6634-
</maml:description>
6635-
<command:parameterValue required="true" variableLength="true">Nullable`1[Guid]</command:parameterValue>
6636-
<dev:type>
6637-
<maml:name>Nullable`1[Guid]</maml:name>
6638-
<maml:uri/>
6639-
</dev:type>
6640-
<dev:defaultValue></dev:defaultValue>
6641-
</command:parameter>
66426560
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
66436561
<maml:name>ResourceGroupName</maml:name>
66446562
<maml:description>

0 commit comments

Comments
 (0)