Skip to content

Commit 0dc73be

Browse files
committed
Merge pull request #1 from DeepakRajendranMsft/AddNewVnetGatewayIpConfigBase
Add AddNewVnetGatewayIpConfigBase
2 parents 10da9f3 + a04115e commit 0dc73be

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void TestVirtualNetworkExpressRouteGatewayCRUD()
2727
}
2828

2929

30-
[Fact(Skip = "Rerecord tests")]
30+
[Fact]
3131
[Trait(Category.AcceptanceType, Category.CheckIn)]
3232
public void TestVirtualNetworkGatewayCRUD()
3333
{

src/ResourceManager/Network/Commands.Network/Commands.Network.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
<Compile Include="RouteTable\Route\RemoveAzureRouteConfigCommand.cs" />
323323
<Compile Include="RouteTable\Route\SetAzureRouteConfigCommand.cs" />
324324
<Compile Include="RouteTable\SetAzureRouteTableCommand.cs" />
325+
<Compile Include="VirtualNetworkGateway\AzureVirtualNetworkGatewayIpConfigBase.cs" />
325326
<Compile Include="VirtualNetworkGateway\ChildResourceHelp.cs" />
326327
<Compile Include="VirtualNetworkGateway\VirtualNetworkGatewayBaseCmdlet.cs" />
327328
<Compile Include="VirtualNetworkGateway\GetAzureVirtualNetworkGatewayCommand.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 Microsoft.Azure.Commands.Network.Models;
16+
using System.Management.Automation;
17+
18+
namespace Microsoft.Azure.Commands.Network
19+
{
20+
public class AzureVirtualNetworkGatewayIpConfigBase : NetworkBaseCmdlet
21+
{
22+
[Parameter(
23+
Mandatory = false,
24+
HelpMessage = "The name of the FrontendIpConfiguration")]
25+
[ValidateNotNullOrEmpty]
26+
public virtual string Name { get; set; }
27+
28+
[Parameter(
29+
Mandatory = false,
30+
HelpMessage = "The private ip address of the frontendIpConfiguration " +
31+
"if static allocation is specified.")]
32+
public string PrivateIpAddress { get; set; }
33+
34+
[Parameter(
35+
ParameterSetName = "SetByResourceId",
36+
HelpMessage = "SubnetId")]
37+
[ValidateNotNullOrEmpty]
38+
public string SubnetId { get; set; }
39+
40+
[Parameter(
41+
ParameterSetName = "SetByResource",
42+
HelpMessage = "Subnet")]
43+
public PSSubnet Subnet { get; set; }
44+
45+
[Parameter(
46+
ParameterSetName = "SetByResourceId",
47+
HelpMessage = "PublicIpAddressId")]
48+
public string PublicIpAddressId { get; set; }
49+
50+
[Parameter(
51+
ParameterSetName = "SetByResource",
52+
HelpMessage = "PublicIpAddress")]
53+
public PSPublicIpAddress PublicIpAddress { get; set; }
54+
55+
public override void ExecuteCmdlet()
56+
{
57+
base.ExecuteCmdlet();
58+
59+
if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource))
60+
{
61+
if (this.Subnet != null)
62+
{
63+
this.SubnetId = this.Subnet.Id;
64+
}
65+
66+
if (this.PublicIpAddress != null)
67+
{
68+
this.PublicIpAddressId = this.PublicIpAddress.Id;
69+
}
70+
}
71+
}
72+
}
73+
}

src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayIpConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace Microsoft.Azure.Commands.Network
1919
{
2020
[Cmdlet(VerbsCommon.New, "AzureRmVirtualNetworkGatewayIpConfig"), OutputType(typeof(PSVirtualNetworkGatewayIpConfiguration))]
21-
public class NewAzureVirtualNetworkGatewayIpConfigCommand : AzureLoadBalancerFrontendIpConfigBase
21+
public class NewAzureVirtualNetworkGatewayIpConfigCommand : AzureVirtualNetworkGatewayIpConfigBase
2222
{
2323
[Parameter(
2424
Mandatory = true,

0 commit comments

Comments
 (0)