Skip to content

Commit 1638594

Browse files
committed
Network and Storage operations (E2E)
1 parent b9a541d commit 1638594

15 files changed

+1157
-1
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</Reference>
6666
<Reference Include="Microsoft.WindowsAzure.Management.SiteRecovery, Version=0.9.0.0, Culture=neutral, PublicKeyToken=c66ce9294aae1300, processorArchitecture=MSIL">
6767
<SpecificVersion>False</SpecificVersion>
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.0.1.1-preview\lib\net40\Microsoft.WindowsAzure.Management.SiteRecovery.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.0.2.2-preview\lib\net40\Microsoft.WindowsAzure.Management.SiteRecovery.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>
@@ -97,6 +97,8 @@
9797
<Reference Include="System.Xml" />
9898
</ItemGroup>
9999
<ItemGroup>
100+
<Compile Include="lib\PSStorageObjects.cs" />
101+
<Compile Include="lib\PSNetworkObjects.cs" />
100102
<Compile Include="lib\PSContracts.cs" />
101103
<Compile Include="lib\PSObjects.cs" />
102104
<Compile Include="lib\PSParameterSets.cs" />
@@ -106,6 +108,10 @@
106108
<DesignTime>True</DesignTime>
107109
<DependentUpon>Resources.resx</DependentUpon>
108110
</Compile>
111+
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesStorageClient.cs" />
112+
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesStorageMappingClient.cs" />
113+
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesNetworkMappingClient.cs" />
114+
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesNetworkClient.cs" />
109115
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesVMGroupClient.cs" />
110116
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesPEClient.cs" />
111117
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesClient.cs">
@@ -118,6 +124,14 @@
118124
<Compile Include="PSRecoveryServicesClient\PSRecoveryServicesVMClient.cs" />
119125
<Compile Include="RecoveryServicesCmdletBase.cs" />
120126
<Compile Include="Properties\AssemblyInfo.cs" />
127+
<Compile Include="Service\GetAzureSiteRecoveryStorage.cs" />
128+
<Compile Include="Service\GetAzureSiteRecoveryStorageMapping.cs" />
129+
<Compile Include="Service\NewAzureSiteRecoveryStorageMapping.cs" />
130+
<Compile Include="Service\RemoveAzureSiteRecoveryStorageMapping.cs" />
131+
<Compile Include="Service\RemoveAzureSiteRecoveryNetworkMapping.cs" />
132+
<Compile Include="Service\NewAzureSiteRecoveryNetworkMapping.cs" />
133+
<Compile Include="Service\GetAzureSiteRecoveryNetworkMapping.cs" />
134+
<Compile Include="Service\GetAzureSiteRecoveryNetwork.cs" />
121135
<Compile Include="Service\CreateAzureSiteRecoveryRecoveryPlan.cs" />
122136
<Compile Include="Service\GetAzureSiteRecoveryRecoveryPlanFile.cs" />
123137
<Compile Include="Service\RemoveAzureSiteRecoveryRecoveryPlan.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using Microsoft.WindowsAzure;
17+
using Microsoft.WindowsAzure.Management.SiteRecovery;
18+
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
19+
20+
namespace Microsoft.Azure.Commands.RecoveryServices
21+
{
22+
/// <summary>
23+
/// Recovery services convenience client.
24+
/// </summary>
25+
public partial class PSRecoveryServicesClient
26+
{
27+
/// <summary>
28+
/// Gets Azure Site Recovery Networks.
29+
/// </summary>
30+
/// <param name="serverId">Server ID</param>
31+
/// <returns>Network list response</returns>
32+
public NetworkListResponse GetAzureSiteRecoveryNetworks(string serverId)
33+
{
34+
return this.GetSiteRecoveryClient().Networks.List(serverId, this.GetRequestHeaders());
35+
}
36+
37+
/// <summary>
38+
/// Gets Azure Site Recovery Network.
39+
/// </summary>
40+
/// <param name="serverId">Server ID</param>
41+
/// <param name="networkId">Network ID</param>
42+
/// <returns>Network response</returns>
43+
public NetworkResponse GetAzureSiteRecoveryNetwork(string serverId, string networkId)
44+
{
45+
return this.GetSiteRecoveryClient().Networks.Get(networkId, serverId, this.GetRequestHeaders());
46+
}
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using Microsoft.WindowsAzure;
17+
using Microsoft.WindowsAzure.Management.SiteRecovery;
18+
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
19+
20+
namespace Microsoft.Azure.Commands.RecoveryServices
21+
{
22+
/// <summary>
23+
/// Recovery services convenience client.
24+
/// </summary>
25+
public partial class PSRecoveryServicesClient
26+
{
27+
/// <summary>
28+
/// Gets Azure Site Recovery Network mappings.
29+
/// </summary>
30+
/// <param name="primaryServerId">Primary server ID</param>
31+
/// <param name="recoveryServerId">Recovery server ID</param>
32+
/// <returns>Network mapping list response</returns>
33+
public NetworkMappingListResponse GetAzureSiteRecoveryNetworkMappings(
34+
string primaryServerId,
35+
string recoveryServerId)
36+
{
37+
return this.GetSiteRecoveryClient()
38+
.NetworkMappings
39+
.List(primaryServerId, recoveryServerId, this.GetRequestHeaders());
40+
}
41+
42+
/// <summary>
43+
/// Gets Azure Site Recovery Network mapping.
44+
/// </summary>
45+
/// <param name="networkId">Network ID</param>
46+
/// <param name="serverId">Server ID</param>
47+
/// <returns>Server response</returns>
48+
public NetworkMappingResponse GetAzureSiteRecoveryNetworkMapping(string networkId, string serverId)
49+
{
50+
return this.GetSiteRecoveryClient()
51+
.NetworkMappings
52+
.Get(networkId, serverId, this.GetRequestHeaders());
53+
}
54+
55+
/// <summary>
56+
/// Create Azure Site Recovery Network Mapping.
57+
/// </summary>
58+
/// <param name="primaryServerId">Primary server Id</param>
59+
/// <param name="primaryNetworkId">Primary network Id</param>
60+
/// <param name="recoveryServerId">Recovery server Id</param>
61+
/// <param name="recoveryNetworkId">Recovery network Id</param>
62+
/// <returns>Job response</returns>
63+
public JobResponse NewAzureSiteRecoveryNetworkMapping(
64+
string primaryServerId,
65+
string primaryNetworkId,
66+
string recoveryServerId,
67+
string recoveryNetworkId)
68+
{
69+
CreateNetworkMappingInput parameters = new CreateNetworkMappingInput();
70+
parameters.PrimaryServerId = primaryServerId;
71+
parameters.PrimaryNetworkId = primaryNetworkId;
72+
parameters.RecoveryServerId = recoveryServerId;
73+
parameters.RecoveryNetworkId = recoveryNetworkId;
74+
75+
return this.GetSiteRecoveryClient()
76+
.NetworkMappings
77+
.Create(parameters, this.GetRequestHeaders());
78+
}
79+
80+
/// <summary>
81+
/// Delete Azure Site Recovery Network Mapping.
82+
/// </summary>
83+
/// <param name="primaryServerId">Primary server Id</param>
84+
/// <param name="primaryNetworkId">Primary network Id</param>
85+
/// <param name="recoveryServerId">Recovery server Id</param>
86+
/// <returns>Job response</returns>
87+
public JobResponse RemoveAzureSiteRecoveryNetworkMapping(
88+
string primaryServerId,
89+
string primaryNetworkId,
90+
string recoveryServerId)
91+
{
92+
DeleteNetworkMappingInput parameters = new DeleteNetworkMappingInput();
93+
parameters.PrimaryServerId = primaryServerId;
94+
parameters.PrimaryNetworkId = primaryNetworkId;
95+
parameters.RecoveryServerId = recoveryServerId;
96+
97+
return this.GetSiteRecoveryClient()
98+
.NetworkMappings
99+
.Delete(parameters, this.GetRequestHeaders());
100+
}
101+
}
102+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using Microsoft.WindowsAzure;
17+
using Microsoft.WindowsAzure.Management.SiteRecovery;
18+
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
19+
20+
namespace Microsoft.Azure.Commands.RecoveryServices
21+
{
22+
/// <summary>
23+
/// Recovery services convenience client.
24+
/// </summary>
25+
public partial class PSRecoveryServicesClient
26+
{
27+
/// <summary>
28+
/// Gets Azure Site Recovery Storages.
29+
/// </summary>
30+
/// <param name="serverId">Server ID</param>
31+
/// <returns>Storage list response</returns>
32+
public StorageListResponse GetAzureSiteRecoveryStorages(string serverId)
33+
{
34+
return this.GetSiteRecoveryClient().Storages.List(serverId, this.GetRequestHeaders());
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using Microsoft.WindowsAzure;
17+
using Microsoft.WindowsAzure.Management.SiteRecovery;
18+
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
19+
20+
namespace Microsoft.Azure.Commands.RecoveryServices
21+
{
22+
/// <summary>
23+
/// Recovery services convenience client.
24+
/// </summary>
25+
public partial class PSRecoveryServicesClient
26+
{
27+
/// <summary>
28+
/// Gets Azure Site Recovery Storage mappings.
29+
/// </summary>
30+
/// <param name="primaryServerId">Primary server ID</param>
31+
/// <param name="recoveryServerId">Recovery server ID</param>
32+
/// <returns>Storage mapping list response</returns>
33+
public StorageMappingListResponse GetAzureSiteRecoveryStorageMappings(
34+
string primaryServerId,
35+
string recoveryServerId)
36+
{
37+
return this.GetSiteRecoveryClient()
38+
.StorageMappings
39+
.List(primaryServerId, recoveryServerId, this.GetRequestHeaders());
40+
}
41+
42+
/// <summary>
43+
/// Create Azure Site Recovery Storage Mapping.
44+
/// </summary>
45+
/// <param name="primaryServerId">Primary server Id</param>
46+
/// <param name="primaryStorageId">Primary storage Id</param>
47+
/// <param name="recoveryServerId">Recovery server Id</param>
48+
/// <param name="recoveryStorageId">Recovery storage Id</param>
49+
/// <returns>Job response</returns>
50+
public JobResponse NewAzureSiteRecoveryStorageMapping(
51+
string primaryServerId,
52+
string primaryStorageId,
53+
string recoveryServerId,
54+
string recoveryStorageId)
55+
{
56+
StorageMappingInput parameters = new StorageMappingInput();
57+
parameters.PrimaryServerId = primaryServerId;
58+
parameters.PrimaryStorageId = primaryStorageId;
59+
parameters.RecoveryServerId = recoveryServerId;
60+
parameters.RecoveryStorageId = recoveryStorageId;
61+
62+
return this.GetSiteRecoveryClient()
63+
.StorageMappings
64+
.Create(parameters, this.GetRequestHeaders());
65+
}
66+
67+
/// <summary>
68+
/// Delete Azure Site Recovery Storage Mapping.
69+
/// </summary>
70+
/// <param name="primaryServerId">Primary server Id</param>
71+
/// <param name="primaryStorageId">Primary storage Id</param>
72+
/// <param name="recoveryServerId">Recovery server Id</param>
73+
/// <param name="recoveryStorageId">Recovery storage Id</param>
74+
/// <returns>Job response</returns>
75+
public JobResponse RemoveAzureSiteRecoveryStorageMapping(
76+
string primaryServerId,
77+
string primaryStorageId,
78+
string recoveryServerId,
79+
string recoveryStorageId)
80+
{
81+
StorageMappingInput parameters = new StorageMappingInput();
82+
parameters.PrimaryServerId = primaryServerId;
83+
parameters.PrimaryStorageId = primaryStorageId;
84+
parameters.RecoveryServerId = recoveryServerId;
85+
parameters.RecoveryStorageId = recoveryStorageId;
86+
87+
return this.GetSiteRecoveryClient()
88+
.StorageMappings
89+
.Delete(parameters, this.GetRequestHeaders());
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)