Skip to content

Commit 4eb3fbe

Browse files
committed
Optimize should not be part of any parameterset.
1 parent 2fcf753 commit 4eb3fbe

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/SetAzureSiteRecoveryProtectionEntity.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@ public override void ExecuteCmdlet()
168168
string profileId = string.Empty;
169169
var input = new EnableProtectionInput();
170170

171+
if (this.ProtectionEntity == null)
172+
{
173+
var pe = RecoveryServicesClient.GetAzureSiteRecoveryProtectionEntity(
174+
this.ProtectionContainerId,
175+
this.Id);
176+
this.ProtectionEntity = new ASRProtectionEntity(pe.ProtectionEntity);
177+
}
178+
171179
// Get the replciation provider from profile object otherwise assume its E2E.
172180
// Let the call go without profileId set.
173181
string replicationProvider = null;
@@ -179,6 +187,9 @@ public override void ExecuteCmdlet()
179187
}
180188
else
181189
{
190+
this.WriteDebugWithTimestamp(
191+
Properties.Resources.MandatoryParamFromNextRelease,
192+
"ProtectionProfile");
182193
string pcId = this.ProtectionContainerId ?? this.ProtectionEntity.ProtectionContainerId;
183194
var pc = RecoveryServicesClient.GetAzureSiteRecoveryProtectionContainer(
184195
pcId);
@@ -195,14 +206,9 @@ public override void ExecuteCmdlet()
195206
}
196207
}
197208

198-
if (this.ProtectionEntity == null)
209+
if (this.ParameterSetName == ASRParameterSets.ByIDs)
199210
{
200-
var pe = RecoveryServicesClient.GetAzureSiteRecoveryProtectionEntity(
201-
this.ProtectionContainerId,
202-
this.Id);
203-
this.ProtectionEntity = new ASRProtectionEntity(pe.ProtectionEntity);
204-
205-
this.ValidateUsageById(replicationProvider, Constants.ID);
211+
this.ValidateUsageById(replicationProvider, "Id");
206212
}
207213

208214
if (replicationProvider == Constants.HyperVReplicaAzure)

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/StartAzureSiteRecoveryPlannedFailoverJob.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,13 @@ public class StartAzureSiteRecoveryPlannedFailoverJob : RecoveryServicesCmdletBa
5858
/// Gets or sets Recovery Plan object.
5959
/// </summary>
6060
[Parameter(ParameterSetName = ASRParameterSets.ByRPObject, Mandatory = true, ValueFromPipeline = true)]
61-
[Parameter(ParameterSetName = ASRParameterSets.ByRPObjectE2AFailback, Mandatory = true, ValueFromPipeline = true)]
6261
[ValidateNotNullOrEmpty]
6362
public ASRRecoveryPlan RecoveryPlan { get; set; }
6463

6564
/// <summary>
6665
/// Gets or sets Protection Entity object.
6766
/// </summary>
6867
[Parameter(ParameterSetName = ASRParameterSets.ByPEObject, Mandatory = true, ValueFromPipeline = true)]
69-
[Parameter(ParameterSetName = ASRParameterSets.ByPEObjectE2AFailback, Mandatory = true, ValueFromPipeline = true)]
7068
[ValidateNotNullOrEmpty]
7169
public ASRProtectionEntity ProtectionEntity { get; set; }
7270

@@ -88,8 +86,7 @@ public class StartAzureSiteRecoveryPlannedFailoverJob : RecoveryServicesCmdletBa
8886
/// <summary>
8987
/// Gets or sets the Optimize value.
9088
/// </summary>
91-
[Parameter(ParameterSetName = ASRParameterSets.ByPEObjectE2AFailback)]
92-
[Parameter(ParameterSetName = ASRParameterSets.ByPEObjectE2AFailback)]
89+
[Parameter]
9390
[ValidateSet(
9491
Constants.ForDowntime,
9592
Constants.ForSynchronization)]
@@ -112,12 +109,10 @@ public override void ExecuteCmdlet()
112109
switch (this.ParameterSetName)
113110
{
114111
case ASRParameterSets.ByRPObject:
115-
case ASRParameterSets.ByRPObjectE2AFailback:
116112
this.RPId = this.RecoveryPlan.ID;
117113
this.StartRpPlannedFailover();
118114
break;
119115
case ASRParameterSets.ByPEObject:
120-
case ASRParameterSets.ByPEObjectE2AFailback:
121116
this.ProtectionEntityId = this.ProtectionEntity.ID;
122117
this.ProtectionContainerId = this.ProtectionEntity.ProtectionContainerId;
123118
this.StartPEPlannedFailover();

0 commit comments

Comments
 (0)