Skip to content

Commit 42c99be

Browse files
committed
added classification names to the mapping object, corrected couple of enums.
1 parent 50a7d70 commit 42c99be

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,23 @@ public class GetAzureSiteRecoveryNetworkMapping : RecoveryServicesCmdletBase
3333
/// <summary>
3434
/// Gets or sets Primary Server object.
3535
/// </summary>
36-
[Parameter(Mandatory = true)]
36+
[Parameter(ParameterSetName = ASRParameterSets.EnterpriseToEnterprise, Mandatory = true)]
37+
[Parameter(ParameterSetName = ASRParameterSets.EnterpriseToAzure, Mandatory = true)]
3738
[ValidateNotNullOrEmpty]
3839
public ASRServer PrimaryServer { get; set; }
3940

4041
/// <summary>
4142
/// Gets or sets Recovery Server object.
4243
/// </summary>
43-
[Parameter(Mandatory = true)]
44+
[Parameter(ParameterSetName = ASRParameterSets.EnterpriseToEnterprise, Mandatory = true)]
4445
[ValidateNotNullOrEmpty]
4546
public ASRServer RecoveryServer { get; set; }
4647

48+
/// <summary>
49+
/// Gets or sets switch parameter. On passing, command sets target as Azure.
50+
/// </summary>
51+
[Parameter(ParameterSetName = ASRParameterSets.EnterpriseToAzure, Mandatory = true)]
52+
public SwitchParameter Azure { get; set; }
4753
#endregion Parameters
4854

4955
/// <summary>
@@ -53,9 +59,22 @@ public override void ExecuteCmdlet()
5359
{
5460
try
5561
{
62+
string primaryServerId = this.PrimaryServer.ID;
63+
string recoveryServerId = string.Empty;
64+
65+
switch (this.ParameterSetName)
66+
{
67+
case ASRParameterSets.EnterpriseToEnterprise:
68+
recoveryServerId = this.RecoveryServer.ID;
69+
break;
70+
case ASRParameterSets.EnterpriseToAzure:
71+
recoveryServerId = Constants.AzureFabricId;
72+
break;
73+
}
74+
5675
NetworkMappingListResponse networkMappingListResponse =
5776
RecoveryServicesClient
58-
.GetAzureSiteRecoveryNetworkMappings(this.PrimaryServer.ID, this.RecoveryServer.ID);
77+
.GetAzureSiteRecoveryNetworkMappings(primaryServerId, recoveryServerId);
5978

6079
this.WriteNetworkMappings(networkMappingListResponse.NetworkMappings);
6180
}

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ public class Constants
167167
/// Represents Disable protection.
168168
/// </summary>
169169
public const string DisableProtection = "Disable";
170+
171+
/// <summary>
172+
/// Azure fabric Id. In E2A context Recovery Server Id is always this.
173+
/// </summary>
174+
public const string AzureFabricId = "21a9403c-6ec1-44f2-b744-b4e50b792387";
170175
}
171176

172177
/// <summary>

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSStorageObjects.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ public ASRStorageMapping(StorageMapping storageMapping)
109109
{
110110
this.PrimaryServerId = storageMapping.PrimaryServerId;
111111
this.PrimaryStorageId = storageMapping.PrimaryStorageId;
112+
this.PrimaryStorageName = storageMapping.PrimaryStorageName;
112113
this.RecoveryServerId = storageMapping.RecoveryServerId;
113114
this.RecoveryStorageId = storageMapping.RecoveryStorageId;
115+
this.RecoveryStorageName = storageMapping.RecoveryStorageName;
114116
}
115117

116118
#region Properties
@@ -124,6 +126,11 @@ public ASRStorageMapping(StorageMapping storageMapping)
124126
/// </summary>
125127
public string PrimaryStorageId { get; set; }
126128

129+
/// <summary>
130+
/// Gets or sets Primary storage name.
131+
/// </summary>
132+
public string PrimaryStorageName { get; set; }
133+
127134
/// <summary>
128135
/// Gets or sets Recovery server Id.
129136
/// </summary>
@@ -133,6 +140,11 @@ public ASRStorageMapping(StorageMapping storageMapping)
133140
/// Gets or sets Recovery storage Id.
134141
/// </summary>
135142
public string RecoveryStorageId { get; set; }
143+
144+
/// <summary>
145+
/// Gets or sets Recovery storage name.
146+
/// </summary>
147+
public string RecoveryStorageName { get; set; }
136148
#endregion
137149
}
138150
}

0 commit comments

Comments
 (0)