Skip to content

Commit 3d4a098

Browse files
authored
Merge pull request Azure#2989 from kagamsft/dev
[AppGW] Adding backend health API.
2 parents 1cdaf09 + 3eb2016 commit 3d4a098

17 files changed

+2135
-3423
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.13.0.4-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
70-
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.1-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
70+
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.2-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Azure.Management.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -407,9 +407,9 @@
407407
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
408408
</None>
409409
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineNetworkInterfaceTests\TestSingleNetworkInterfaceWithAcceleratedNetworking.json">
410-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
410+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
411411
</None>
412-
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineNetworkInterfaceTests\TestVMNicWithAcceleratedNetworkingValidations.json">
412+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineNetworkInterfaceTests\TestVMNicWithAcceleratedNetworkingValidations.json">
413413
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
414414
</None>
415415
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineProfileTests\TestVirtualMachineProfileWithoutAUC.json">

src/ResourceManager/Compute/Commands.Compute.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.Graph.RBAC" version="3.2.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Compute" version="13.0.4-prerelease" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Management.Network" version="7.1.1-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="7.1.2-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Storage" version="4.1.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.6052.28118-prerelease" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.7-preview" targetFramework="net45" />

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.13.0.4-prerelease\lib\net45\Microsoft.Azure.Management.Compute.dll</HintPath>
8181
<Private>True</Private>
8282
</Reference>
83-
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
84-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.1-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
83+
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
84+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.2-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
8585
<Private>True</Private>
8686
</Reference>
8787
<Reference Include="Microsoft.Azure.Management.Storage">

src/ResourceManager/Compute/Commands.Compute/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.KeyVault.Core" version="1.0.0" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Compute" version="13.0.4-prerelease" targetFramework="net45" />
12-
<package id="Microsoft.Azure.Management.Network" version="7.1.1-preview" targetFramework="net45" />
12+
<package id="Microsoft.Azure.Management.Network" version="7.1.2-preview" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Management.Storage" version="4.1.0-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/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
<Reference Include="Microsoft.Azure.Management.Authorization">
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6565
</Reference>
66-
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.1-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
68-
<Private>True</Private>
69-
</Reference>
7066
<Reference Include="Microsoft.Azure.Insights">
7167
<HintPath>..\..\..\packages\Microsoft.Azure.Insights.0.13.1-preview\lib\net45\Microsoft.Azure.Insights.dll</HintPath>
7268
<Private>True</Private>
7369
</Reference>
70+
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.2-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
72+
<Private>True</Private>
73+
</Reference>
7474
<Reference Include="Microsoft.Azure.Management.Redis">
7575
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Redis.3.1.1-preview\lib\net45\Microsoft.Azure.Management.Redis.dll</HintPath>
7676
<Private>True</Private>

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ function Test-ApplicationGatewayCRUD
109109
# Get Application Gateway
110110
$getgw =  Get-AzureRmApplicationGateway -Name $appgwName -ResourceGroupName $rgname
111111

112+
# Get Application Gateway backend health with expanded resource
113+
$backendHealth = Get-AzureRmApplicationGatewayBackendHealth -Name $appgwName -ResourceGroupName $rgname -ExpandResource "backendhealth/applicationgatewayresource"
114+
Assert-NotNull $backendHealth.BackendAddressPools[0].BackendAddressPool.Name
115+
116+
# Get Application Gateway backend health without expanded resource
117+
$backendHealth = Get-AzureRmApplicationGatewayBackendHealth -Name $appgwName -ResourceGroupName $rgname
118+
Assert-Null $backendHealth.BackendAddressPools[0].BackendAddressPool.Name
119+
112120
# add nics to application gateway backend address pool
113121
$nicPool = Get-AzureRmApplicationGatewayBackendAddressPool -ApplicationGateway $getgw -Name $nicPoolName
114122
$nic01.IpConfigurations[0].ApplicationGatewayBackendAddressPools.Add($nicPool);

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUD.json

Lines changed: 1730 additions & 3406 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Graph.RBAC" version="3.2.0-preview" targetFramework="net45" />
8-
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.Network" version="7.1.1-preview" targetFramework="net45" />
108
<package id="Microsoft.Azure.Insights" version="0.13.1-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="7.1.2-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Redis" version="3.1.1-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.Framework" version="1.0.6052.28118-prerelease" targetFramework="net45" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 AutoMapper;
16+
using Microsoft.Azure.Commands.Network.Models;
17+
using Microsoft.Azure.Management.Network;
18+
using System.Collections.Generic;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.Network
22+
{
23+
[Cmdlet(VerbsCommon.Get, "AzureRmApplicationGatewayBackendHealth"), OutputType(typeof(PSApplicationGatewayBackendHealth))]
24+
public class GetAzureApplicationGatewayBackendHealthCommand : ApplicationGatewayBaseCmdlet
25+
{
26+
[Alias("ResourceName")]
27+
[Parameter(
28+
Mandatory = true,
29+
ValueFromPipelineByPropertyName = true,
30+
HelpMessage = "The resource name.")]
31+
[ValidateNotNullOrEmpty]
32+
public virtual string Name { get; set; }
33+
34+
[Parameter(
35+
Mandatory = true,
36+
ValueFromPipelineByPropertyName = true,
37+
HelpMessage = "The resource group name.")]
38+
[ValidateNotNullOrEmpty]
39+
public virtual string ResourceGroupName { get; set; }
40+
41+
[Parameter(
42+
Mandatory = false,
43+
ValueFromPipelineByPropertyName = true,
44+
HelpMessage = "The resource reference to be expanded.",
45+
ParameterSetName = "Expand")]
46+
[ValidateNotNullOrEmpty]
47+
public string ExpandResource { get; set; }
48+
49+
public override void ExecuteCmdlet()
50+
{
51+
base.ExecuteCmdlet();
52+
53+
var backendHealth = this.ApplicationGatewayClient.BackendHealth(ResourceGroupName, Name, ExpandResource);
54+
var psBackendHealth = Mapper.Map<PSApplicationGatewayBackendHealth>(backendHealth);
55+
WriteObject(psBackendHealth);
56+
}
57+
}
58+
}
59+

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
<SpecificVersion>False</SpecificVersion>
7474
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
7575
</Reference>
76-
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
77-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.1-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
76+
<Reference Include="Microsoft.Azure.Management.Network, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
77+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.7.1.2-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
7878
<Private>True</Private>
7979
</Reference>
8080
<Reference Include="Microsoft.Data.Edm">
@@ -203,6 +203,7 @@
203203
<Compile Include="ApplicationGateway\GatewayIPConfiguration\NewAzureApplicationGatewayIPConfigurationCommand.cs" />
204204
<Compile Include="ApplicationGateway\GatewayIPConfiguration\RemoveAzureApplicationGatewayIPConfigurationCommand.cs" />
205205
<Compile Include="ApplicationGateway\GatewayIPConfiguration\SetAzureApplicationGatewayIPConfigurationCommand.cs" />
206+
<Compile Include="ApplicationGateway\GetAzureApplicationGatewayBackendHealthCommand.cs" />
206207
<Compile Include="ApplicationGateway\GetAzureApplicationGatewayCommand.cs" />
207208
<Compile Include="ApplicationGateway\HttpListener\AddAzureApplicationGatewayHttpListenerCommand.cs" />
208209
<Compile Include="ApplicationGateway\HttpListener\AzureApplicationGatewayHttpListenerBase.cs" />
@@ -280,6 +281,10 @@
280281
<Compile Include="ExpressRouteCircuit\RemoveAzureExpressRouteCircuitCommand.cs" />
281282
<Compile Include="ExpressRouteCircuit\SetAzureExpressRouteCircuitCommand.cs" />
282283
<Compile Include="ExpressRouteCircuit\ExpressRouteCircuitBaseCmdlet.cs" />
284+
<Compile Include="Models\PSApplicationGatewayBackendHealth.cs" />
285+
<Compile Include="Models\PSApplicationGatewayBackendHealthHttpSettings.cs" />
286+
<Compile Include="Models\PSApplicationGatewayBackendHealthPool.cs" />
287+
<Compile Include="Models\PSApplicationGatewayBackendHealthServer.cs" />
283288
<Compile Include="Models\PSIPAddressAvailabilityResult.cs" />
284289
<Compile Include="Models\PSApplicationGatewayAuthenticationCertificate.cs" />
285290
<Compile Include="Models\PSApplicationGatewayWebApplicationFirewallConfiguration.cs" />

src/ResourceManager/Network/Commands.Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ protected override void Configure()
317317
Mapper.CreateMap<CNM.PSApplicationGatewaySslCertificate, MNM.ApplicationGatewaySslCertificate>();
318318
Mapper.CreateMap<CNM.PSApplicationGatewayAuthenticationCertificate, MNM.ApplicationGatewayAuthenticationCertificate>();
319319
Mapper.CreateMap<CNM.PSBackendAddressPool, MNM.BackendAddressPool>();
320+
Mapper.CreateMap<CNM.PSApplicationGatewayBackendHealth, MNM.ApplicationGatewayBackendHealth>();
321+
Mapper.CreateMap<CNM.PSApplicationGatewayBackendHealthPool, MNM.ApplicationGatewayBackendHealthPool>();
322+
Mapper.CreateMap<CNM.PSApplicationGatewayBackendHealthHttpSettings, MNM.ApplicationGatewayBackendHealthHttpSettings>();
323+
Mapper.CreateMap<CNM.PSApplicationGatewayBackendHealthServer, MNM.ApplicationGatewayBackendHealthServer>();
320324
Mapper.CreateMap<CNM.PSApplicationGatewayWebApplicationFirewallConfiguration, MNM.ApplicationGatewayWebApplicationFirewallConfiguration>();
321325

322326
// MNM to CNM
@@ -337,6 +341,10 @@ protected override void Configure()
337341
Mapper.CreateMap<MNM.ApplicationGatewaySslCertificate, CNM.PSApplicationGatewaySslCertificate>();
338342
Mapper.CreateMap<MNM.ApplicationGatewayAuthenticationCertificate, CNM.PSApplicationGatewayAuthenticationCertificate>();
339343
Mapper.CreateMap<MNM.BackendAddressPool, CNM.PSBackendAddressPool>();
344+
Mapper.CreateMap<MNM.ApplicationGatewayBackendHealth, CNM.PSApplicationGatewayBackendHealth>();
345+
Mapper.CreateMap<MNM.ApplicationGatewayBackendHealthPool, CNM.PSApplicationGatewayBackendHealthPool>();
346+
Mapper.CreateMap<MNM.ApplicationGatewayBackendHealthHttpSettings, CNM.PSApplicationGatewayBackendHealthHttpSettings>();
347+
Mapper.CreateMap<MNM.ApplicationGatewayBackendHealthServer, CNM.PSApplicationGatewayBackendHealthServer>();
340348
Mapper.CreateMap<MNM.ApplicationGatewayWebApplicationFirewallConfiguration, CNM.PSApplicationGatewayWebApplicationFirewallConfiguration>();
341349
}
342350
}

0 commit comments

Comments
 (0)