Skip to content

Commit 1520407

Browse files
committed
Networking Hybrid team minor but important PS changes:-
1. Added mandatory param to new dedicatedcircuit command let 2. Added Set / Remove default site command lets 3. Added new properties to return type of getconnection command let
1 parent 1843dc9 commit 1520407

19 files changed

+237
-38
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<SpecificVersion>False</SpecificVersion>
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.15-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
71+
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7474
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/Network/Commands.Network.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="2.0.15-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.5774.40163-prerelease" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5774.40163-prerelease" targetFramework="net45" />

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
7878
</Reference>
7979
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80-
<SpecificVersion>False</SpecificVersion>
81-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
80+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.15-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
81+
<Private>True</Private>
8282
</Reference>
8383
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8484
<SpecificVersion>False</SpecificVersion>
@@ -296,6 +296,8 @@
296296
<Compile Include="VirtualNetworkGateway\NewAzureVirtualNetworkGatewayIpConfigCommand.cs" />
297297
<Compile Include="VirtualNetworkGateway\RemoveAzureVirtualNetworkGatewayCommand.cs" />
298298
<Compile Include="VirtualNetworkGateway\ResetAzureVirtualNetworkGatewayCommand.cs" />
299+
<Compile Include="VirtualNetworkGateway\SetAzureVirtualNetworkGatewayDefaultSiteCommand.cs" />
300+
<Compile Include="VirtualNetworkGateway\RemoveAzureVirtualNetworkGatewayDefaultSiteCommand.cs" />
299301
<Compile Include="LocalNetworkGateway\LocalNetworkGatewayBaseCmdlet.cs" />
300302
<Compile Include="LocalNetworkGateway\RemoveAzureLocalNetworkGatewayCommand.cs" />
301303
<Compile Include="LocalNetworkGateway\GetAzureLocalNetworkGatewayCommand.cs" />

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/NewAzureExpressRouteCircuitCommand.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,20 @@ public class NewAzureExpressRouteCircuitCommand : ExpressRouteCircuitBaseCmdlet
8484
public int BandwidthInMbps { get; set; }
8585

8686
[Parameter(
87-
Mandatory = false,
87+
Mandatory = false,
8888
ValueFromPipelineByPropertyName = true)]
8989
[ValidateNotNullOrEmpty]
9090
public List<PSPeering> Peering { get; set; }
9191

92+
[Parameter(
93+
Mandatory = true,
94+
ValueFromPipelineByPropertyName = true)]
95+
[ValidateSet(
96+
MNM.ExpressRouteCircuitBillingType.MeteredData,
97+
MNM.ExpressRouteCircuitBillingType.UnlimitedData,
98+
IgnoreCase = true)]
99+
public string BillingType { get; set; }
100+
92101
[Parameter(
93102
Mandatory = false,
94103
ValueFromPipelineByPropertyName = true,
@@ -129,7 +138,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
129138
circuit.Name = this.Name;
130139
circuit.ResourceGroupName = this.ResourceGroupName;
131140
circuit.Location = this.Location;
132-
141+
133142
// Construct sku
134143
if (!string.IsNullOrEmpty(this.SkuTier))
135144
{
@@ -150,6 +159,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
150159

151160
circuit.Peerings = new List<PSPeering>();
152161
circuit.Peerings = this.Peering;
162+
circuit.BillingType = this.BillingType;
153163

154164
// Map to the sdk object
155165
var circuitModel = Mapper.Map<MNM.ExpressRouteCircuit>(circuit);

src/ResourceManager/Network/Commands.Network/Models/PSExpressRouteCircuit.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class PSExpressRouteCircuit : PSTopLevelResource
3434

3535
public PSExpressRouteCircuitSku Sku { get; set; }
3636

37+
public string BillingType { get; set; }
38+
3739
public string ProvisioningState { get; set; }
3840

3941
[JsonIgnore]
@@ -47,7 +49,7 @@ public string ServiceProviderPropertiesText
4749
{
4850
get { return JsonConvert.SerializeObject(ServiceProviderProperties, Formatting.Indented); }
4951
}
50-
52+
5153
[JsonIgnore]
5254
public string PeeringsText
5355
{

src/ResourceManager/Network/Commands.Network/Models/PSVirtualNetworkGateway.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,21 @@ public class PSVirtualNetworkGateway : PSTopLevelResource
2727
public string VpnType { get; set; }
2828

2929
public bool EnableBgp { get; set; }
30-
30+
31+
public PSResourceId GatewayDefaultSite { get; set; }
32+
3133
public string ProvisioningState { get; set; }
3234

3335
[JsonIgnore]
3436
public string IpConfigurationsText
3537
{
3638
get { return JsonConvert.SerializeObject(IpConfigurations, Formatting.Indented); }
3739
}
40+
41+
[JsonIgnore]
42+
public string GatewayDefaultSiteText
43+
{
44+
get { return JsonConvert.SerializeObject(GatewayDefaultSite, Formatting.Indented); }
45+
}
3846
}
3947
}

src/ResourceManager/Network/Commands.Network/Models/PSVirtualNetworkGatewayConnection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public class PSVirtualNetworkGatewayConnection : PSTopLevelResource
3232

3333
public string SharedKey { get; set; }
3434

35+
public string ConnectionStatus { get; set; }
36+
37+
public ulong EgressBytesTransferred { get; set; }
38+
39+
public ulong IngressBytesTransferred { get; set; }
40+
3541
[JsonIgnore]
3642
public string VirtualNetworkGateway1Text
3743
{

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
8181
HelpMessage = "EnableBgp Flag")]
8282
public bool EnableBgp { get; set; }
8383

84+
[Parameter(
85+
Mandatory = false,
86+
ValueFromPipelineByPropertyName = true,
87+
ParameterSetName = "SetByResourceId",
88+
HelpMessage = "GatewayDefaultSiteId")]
89+
public string GatewayDefaultSiteId { get; set; }
90+
91+
[Parameter(
92+
Mandatory = false,
93+
ValueFromPipelineByPropertyName = true,
94+
ParameterSetName = "SetByResource",
95+
HelpMessage = "GatewayDefaultSite")]
96+
public PSLocalNetworkGateway GatewayDefaultSite { get; set; }
97+
8498
[Parameter(
8599
Mandatory = false,
86100
ValueFromPipelineByPropertyName = true,
@@ -132,6 +146,17 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
132146
vnetGateway.VpnType = this.VpnType;
133147
vnetGateway.EnableBgp = this.EnableBgp;
134148

149+
if (this.GatewayDefaultSite != null)
150+
{
151+
this.GatewayDefaultSiteId = this.GatewayDefaultSite.Id;
152+
}
153+
154+
if (!string.IsNullOrEmpty(this.GatewayDefaultSiteId))
155+
{
156+
vnetGateway.GatewayDefaultSite = new PSResourceId();
157+
vnetGateway.GatewayDefaultSite.Id = this.GatewayDefaultSiteId;
158+
}
159+
135160
// Map to the sdk object
136161
var vnetGatewayModel = Mapper.Map<MNM.VirtualNetworkGateway>(vnetGateway);
137162
vnetGatewayModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayType;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 System.Management.Automation;
17+
using AutoMapper;
18+
using Microsoft.Azure.Management.Network;
19+
using Microsoft.Azure.Commands.Network.Models;
20+
using Microsoft.Azure.Commands.Resources.Models;
21+
using MNM = Microsoft.Azure.Management.Network.Models;
22+
using System.Collections;
23+
using Microsoft.Azure.Commands.Tags.Model;
24+
using System.Collections.Generic;
25+
26+
namespace Microsoft.Azure.Commands.Network
27+
{
28+
[Cmdlet(VerbsCommon.Remove, "AzureVirtualNetworkGatewayDefaultSite"), OutputType(typeof(PSVirtualNetworkGateway))]
29+
public class RemoveAzureVirtualNetworkGatewayDefaultSiteCommand : VirtualNetworkGatewayBaseCmdlet
30+
{
31+
[Parameter(
32+
Mandatory = true,
33+
ValueFromPipeline = true,
34+
HelpMessage = "The VirtualNetworkGateway")]
35+
public PSVirtualNetworkGateway VirtualNetworkGateway { get; set; }
36+
37+
protected override void ProcessRecord()
38+
{
39+
base.ProcessRecord();
40+
41+
if (!this.IsVirtualNetworkGatewayPresent(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name))
42+
{
43+
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
44+
}
45+
46+
//this.VirtualNetworkGateway.GatewayDefaultSite = new PSResourceId();
47+
//this.VirtualNetworkGateway.GatewayDefaultSite.Id = string.Empty;
48+
this.VirtualNetworkGateway.GatewayDefaultSite = null;
49+
50+
// Map to the sdk object
51+
var virtualnetGatewayModel = Mapper.Map<MNM.VirtualNetworkGateway>(this.VirtualNetworkGateway);
52+
virtualnetGatewayModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayType;
53+
virtualnetGatewayModel.Tags = TagsConversionHelper.CreateTagDictionary(this.VirtualNetworkGateway.Tag, validate: true);
54+
55+
this.VirtualNetworkGatewayClient.CreateOrUpdate(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name, virtualnetGatewayModel);
56+
57+
var getvirtualnetGateway = this.GetVirtualNetworkGateway(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name);
58+
59+
WriteObject(getvirtualnetGateway);
60+
}
61+
}
62+
}
63+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 System.Management.Automation;
17+
using AutoMapper;
18+
using Microsoft.Azure.Management.Network;
19+
using Microsoft.Azure.Commands.Network.Models;
20+
using Microsoft.Azure.Commands.Resources.Models;
21+
using MNM = Microsoft.Azure.Management.Network.Models;
22+
using System.Collections;
23+
using Microsoft.Azure.Commands.Tags.Model;
24+
using System.Collections.Generic;
25+
26+
namespace Microsoft.Azure.Commands.Network
27+
{
28+
[Cmdlet(VerbsCommon.Set, "AzureVirtualNetworkGatewayDefaultSite"), OutputType(typeof(PSVirtualNetworkGateway))]
29+
public class SetAzureVirtualNetworkGatewayDefaultSiteCommand : VirtualNetworkGatewayBaseCmdlet
30+
{
31+
[Parameter(
32+
Mandatory = true,
33+
ValueFromPipeline = true,
34+
HelpMessage = "The VirtualNetworkGateway")]
35+
public PSVirtualNetworkGateway VirtualNetworkGateway { get; set; }
36+
37+
[Parameter(
38+
Mandatory = true,
39+
ValueFromPipelineByPropertyName = true,
40+
ParameterSetName = "SetByResource",
41+
HelpMessage = "GatewayDefault local network Site.")]
42+
[ValidateNotNull]
43+
public PSLocalNetworkGateway GatewayDefaultSite { get; set; }
44+
45+
protected override void ProcessRecord()
46+
{
47+
base.ProcessRecord();
48+
49+
if (!this.IsVirtualNetworkGatewayPresent(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name))
50+
{
51+
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
52+
}
53+
54+
this.VirtualNetworkGateway.GatewayDefaultSite = new PSResourceId();
55+
this.VirtualNetworkGateway.GatewayDefaultSite.Id = this.GatewayDefaultSite.Id;
56+
57+
// Map to the sdk object
58+
var virtualnetGatewayModel = Mapper.Map<MNM.VirtualNetworkGateway>(this.VirtualNetworkGateway);
59+
virtualnetGatewayModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayType;
60+
virtualnetGatewayModel.Tags = TagsConversionHelper.CreateTagDictionary(this.VirtualNetworkGateway.Tag, validate: true);
61+
62+
this.VirtualNetworkGatewayClient.CreateOrUpdate(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name, virtualnetGatewayModel);
63+
64+
var getvirtualnetGateway = this.GetVirtualNetworkGateway(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name);
65+
66+
WriteObject(getvirtualnetGateway);
67+
}
68+
}
69+
}
70+

src/ResourceManager/Network/Commands.Network/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
12-
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
12+
<package id="Microsoft.Azure.Management.Network" version="2.0.15-preview" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
1414
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1515
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@
9090
<SpecificVersion>False</SpecificVersion>
9191
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
9292
</Reference>
93-
<Reference Include="Microsoft.WindowsAzure.Management.ExpressRoute">
94-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.3-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll</HintPath>
93+
<Reference Include="Microsoft.WindowsAzure.Management.ExpressRoute, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
94+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.4-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll</HintPath>
95+
<Private>True</Private>
9596
</Reference>
9697
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
9798
<SpecificVersion>False</SpecificVersion>

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/NewAzureDedicatedCircuit.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ public class NewAzureDedicatedCircuitCommand : ExpressRouteBaseCmdlet
3838
public string ServiceProviderName { get; set; }
3939

4040
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Circuit Sku")]
41+
[ValidateSet("Standard", "Premium", IgnoreCase = true)]
4142
public CircuitSku Sku { get; set; }
4243

44+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Circuit Billing Type")]
45+
[ValidateSet("MeteredData", "UnlimitedData", IgnoreCase = true)]
46+
public BillingType billingType { get; set; }
47+
48+
4349
[Parameter(HelpMessage = "Do not confirm Azure Dedicated Circuit creation")]
4450
public SwitchParameter Force { get; set; }
4551

@@ -53,7 +59,7 @@ public override void ExecuteCmdlet()
5359
() =>
5460
{
5561
var circuit = ExpressRouteClient.NewAzureDedicatedCircuit(CircuitName, Bandwidth, Location,
56-
ServiceProviderName, Sku);
62+
ServiceProviderName, Sku, billingType);
5763
WriteVerboseWithTimestamp(Resources.NewAzureDedicatedCircuitSucceeded);
5864
WriteObject(circuit);
5965
});

0 commit comments

Comments
 (0)