Skip to content

add Get ERserviceProvider cmdlet #1053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -148,6 +148,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NetworkResourcesController.cs" />
<Compile Include="ScenarioTests\ApplicationGatewayTests.cs" />
<Compile Include="ScenarioTests\ExpressRouteServiceProviderTests.cs" />
<Compile Include="ScenarioTests\NetworkInterfaceTests.cs" />
<Compile Include="ScenarioTests\LoadBalancerTests.cs" />
<Compile Include="ScenarioTests\ExpressRouteCircuitTests.cs" />
Expand All @@ -171,6 +172,9 @@
<None Include="ScenarioTests\Common.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\ExpressRouteServiceProviderTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\NetworkInterfaceTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -213,6 +217,9 @@
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitPeeringCRUD.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteServiceProviderTests\TestExpressRouteServiceProviderList.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestCreateEmptyLoadBalancer.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Commands.Network.Test.ScenarioTests
{
public class ExpressRouteServiceProviderTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
{
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExpressRouteServiceProviderList()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteServiceProviderList");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests ExpressRouteServiceProviderList.
#>
function Test-ExpressRouteServiceProviderList
{
$providers = Get-AzureRmExpressRouteServiceProvider

Assert-AreNotEqual 0 @($providers).Count
Assert-AreNotEqual 0 @($providers[0].PeeringLocations).Count
Assert-AreNotEqual 0 @($providers[0].BandwidthsOffered).Count
Assert-NotNull $providers[0].Name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/9532a63e-f2eb-4649-bb23-5ed01077ce80/providers/Microsoft.Network/expressRouteServiceProviders?api-version=2015-05-01-preview",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTUzMmE2M2UtZjJlYi00NjQ5LWJiMjMtNWVkMDEwNzdjZTgwL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9leHByZXNzUm91dGVTZXJ2aWNlUHJvdmlkZXJzP2FwaS12ZXJzaW9uPTIwMTUtMDUtMDEtcHJldmlldw==",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"User-Agent": [
"Microsoft.Azure.Management.Network.NetworkResourceProviderClient/2.0.0.0"
]
},
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"Equinix\",\r\n \"id\": \"/subscriptions//resourceGroups//providers/Microsoft.Network/expressRouteServiceProviders/\",\r\n \"type\": \"Microsoft.Network/expressRouteServiceProviders\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"peeringLocations\": [\r\n \"Amsterdam\",\r\n \"Atlanta\",\r\n \"Chicago\",\r\n \"Dallas\",\r\n \"Hong Kong\",\r\n \"London\",\r\n \"Los Angeles\",\r\n \"Melbourne\",\r\n \"New York\",\r\n \"Sao Paulo\",\r\n \"Seattle\",\r\n \"Silicon Valley\",\r\n \"Singapore\",\r\n \"Sydney\",\r\n \"Tokyo\",\r\n \"Washington DC\"\r\n ],\r\n \"bandwidthsOffered\": [\r\n {\r\n \"offerName\": \"200Mbps\",\r\n \"valueInMbps\": 200\r\n },\r\n {\r\n \"offerName\": \"500Mbps\",\r\n \"valueInMbps\": 500\r\n },\r\n {\r\n \"offerName\": \"1Gbps\",\r\n \"valueInMbps\": 1000\r\n },\r\n {\r\n \"offerName\": \"10Gbps\",\r\n \"valueInMbps\": 10000\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
"ResponseHeaders": {
"Content-Length": [
"1152"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"db4d59f2-edf8-407a-b58b-483e934d89e7"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"Cache-Control": [
"no-cache"
],
"Server": [
"Microsoft-HTTPAPI/2.0",
"Microsoft-HTTPAPI/2.0"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"14970"
],
"x-ms-correlation-request-id": [
"b9a38c7f-045d-4b51-af24-2a69cf405513"
],
"x-ms-routing-request-id": [
"WESTUS:20151003T000540Z:b9a38c7f-045d-4b51-af24-2a69cf405513"
],
"Date": [
"Sat, 03 Oct 2015 00:05:39 GMT"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "9532a63e-f2eb-4649-bb23-5ed01077ce80"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5715.36130-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -234,7 +234,8 @@
<Compile Include="LoadBalancer\InboundNatPool\GetAzureLoadBalancerInboundNatPoolConfigCommand.cs" />
<Compile Include="LoadBalancer\InboundNatPool\NewAzureLoadBalancerInboundNatPoolConfigCommand.cs" />
<Compile Include="LoadBalancer\InboundNatPool\RemoveAzureLoadBalancerInboundNatPoolConfigCommand.cs" />
<Compile Include="LoadBalancer\InboundNatPool\SetAzureLoadBalancerInboundNatPoolConfigCommand.cs" /> <Compile Include="ExpressRouteCircuit\GetAzureExpressRouteCircuitCommand.cs" />
<Compile Include="LoadBalancer\InboundNatPool\SetAzureLoadBalancerInboundNatPoolConfigCommand.cs" />
<Compile Include="ExpressRouteCircuit\GetAzureExpressRouteCircuitCommand.cs" />
<Compile Include="ExpressRouteCircuit\NewAzureExpressRouteCircuitCommand.cs" />
<Compile Include="ExpressRouteCircuit\Peering\AddAzureExpressRouteCircuitPeeringConfigCommand.cs" />
<Compile Include="ExpressRouteCircuit\Peering\AzureExpressRouteCircuitPeeringConfigBase.cs" />
Expand Down Expand Up @@ -269,6 +270,7 @@
<Compile Include="Models\PSPeeringStats.cs" />
<Compile Include="Models\PSExpressRouteCircuitAuthorization.cs" />
<Compile Include="Models\PSExpressRouteCircuit.cs" />
<Compile Include="ProviderWideCmdlets\GetAzureExpressRouteServiceProviderCommand.cs" />
<Compile Include="PublicIpAddress\GetAzurePublicIpAddressCommand.cs" />
<Compile Include="PublicIpAddress\NewAzurePublicIpAddressCommand.cs" />
<Compile Include="PublicIpAddress\PublicIpAddressBaseCmdlet.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ protected override void Configure()

// ExpressRouteServiceProvider
// CNM to MNM
Mapper.CreateMap<CNM.PSExpressRouteServiceProvider, MNM.ExpressRouteResourceProvider>();
Mapper.CreateMap<CNM.PSExpressRouteServiceProvider, MNM.ExpressRouteServiceProvider>();
Mapper.CreateMap<CNM.PSExpressRouteServiceProviderBandwidthsOffered, MNM.ExpressRouteServiceProviderBandwidthsOffered>();

// MNM to CNM
Mapper.CreateMap<MNM.ExpressRouteResourceProvider, CNM.PSExpressRouteServiceProvider>();
Mapper.CreateMap<MNM.ExpressRouteServiceProvider, CNM.PSExpressRouteServiceProvider>();
Mapper.CreateMap<MNM.ExpressRouteServiceProviderBandwidthsOffered, CNM.PSExpressRouteServiceProviderBandwidthsOffered>();

// Gateways
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1053,5 +1053,43 @@
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Commands.Network.Models.PSExpressRouteServiceProvider</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Commands.Network.Models.PSExpressRouteServiceProvider</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>Name</Label>
<PropertyName>Name</PropertyName>
</ListItem>
<ListItem>
<Label>Id</Label>
<PropertyName>Id</PropertyName>
</ListItem>
<ListItem>
<Label>ProvisioningState</Label>
<PropertyName>ProvisioningState</PropertyName>
</ListItem>
<ListItem>
<Label>Type</Label>
<PropertyName>Type</PropertyName>
</ListItem>
<ListItem>
<Label>PeeringLocations</Label>
<PropertyName>PeeringLocationsText</PropertyName>
</ListItem>
<ListItem>
<Label>BandwidthsOffered</Label>
<PropertyName>BandwidthsOfferedText</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
</ViewDefinitions>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ public class PSExpressRouteServiceProvider
{
public string Name { get; set; }

public string Id { get; set; }

public string Type { get; set; }

public List<string> PeeringLocations { get; set; }

public PSExpressRouteServiceProviderBandwidthsOffered BandwidthsOffered { get; set; }
public List<PSExpressRouteServiceProviderBandwidthsOffered> BandwidthsOffered { get; set; }

public string ProvisioningState { get; set; }

[JsonIgnore]
public string BandwidthsOfferedText
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Commands.Network.Models;
using MNM = Microsoft.Azure.Management.Network.Models;

namespace Microsoft.Azure.Commands.Network
{
using AutoMapper;

[Cmdlet(VerbsCommon.Get, "AzureRmExpressRouteServiceProvider"), OutputType(typeof(PSExpressRouteServiceProvider))]
public class GetAzureExpressRouteServiceProviderCommand : NetworkBaseCmdlet
{
protected override void ProcessRecord()
{
base.ProcessRecord();

var serviceProviderList = this.NetworkClient.NetworkResourceProviderClient.ExpressRouteServiceProviders.List();

var psProviders = new List<PSExpressRouteServiceProvider>();

foreach (var provider in serviceProviderList.ExpressRouteServiceProviders)
{
var psProvider = Mapper.Map<PSExpressRouteServiceProvider>(provider);
psProviders.Add(psProvider);
}

WriteObject(psProviders, true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
Expand Down