Skip to content

Commit 7de5d31

Browse files
author
unknown
committed
[AppGW] Adding probe, multisite and URL routing support
1 parent 3956d11 commit 7de5d31

29 files changed

+1024
-10
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
@@ -66,8 +66,8 @@
6666
<Reference Include="Microsoft.Azure.Management.Authorization">
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
69-
<Reference Include="Microsoft.Azure.Management.Network">
70-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.0.2-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
69+
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.0.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.ResourceManager">

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="3.0.2-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="3.0.0-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.5799.28345-prerelease" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.4.0-preview" targetFramework="net45" />

src/ResourceManager/Network/Commands.Network/ApplicationGateway/BackendHttpSettings/AzureApplicationGatewayBackendHttpSettingsBase.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,48 @@ public class AzureApplicationGatewayBackendHttpSettingsBase : NetworkBaseCmdlet
4747
[ValidateNotNullOrEmpty]
4848
public string CookieBasedAffinity { get; set; }
4949

50+
[Parameter(
51+
HelpMessage = "Request Timeout")]
52+
[ValidateNotNullOrEmpty]
53+
public uint RequestTimeout { get; set; }
54+
55+
[Parameter(
56+
ParameterSetName = "SetByResourceId",
57+
HelpMessage = "ID of the application gateway Probe")]
58+
[ValidateNotNullOrEmpty]
59+
public string ProbeId { get; set; }
60+
61+
[Parameter(
62+
ParameterSetName = "SetByResource",
63+
HelpMessage = "Application gateway Probe")]
64+
[ValidateNotNullOrEmpty]
65+
public PSApplicationGatewayProbe Probe { get; set; }
66+
67+
public override void ExecuteCmdlet()
68+
{
69+
base.ExecuteCmdlet();
70+
71+
if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource))
72+
{
73+
if (Probe != null)
74+
{
75+
this.ProbeId = this.Probe.Id;
76+
}
77+
}
78+
}
5079
public PSApplicationGatewayBackendHttpSettings NewObject()
5180
{
5281
var backendHttpSettings = new PSApplicationGatewayBackendHttpSettings();
5382
backendHttpSettings.Name = this.Name;
5483
backendHttpSettings.Port = this.Port;
5584
backendHttpSettings.Protocol = this.Protocol;
5685
backendHttpSettings.CookieBasedAffinity = this.CookieBasedAffinity;
86+
backendHttpSettings.RequestTimeout = this.RequestTimeout;
87+
if (!string.IsNullOrEmpty(this.ProbeId))
88+
{
89+
backendHttpSettings.Probe = new PSResourceId();
90+
backendHttpSettings.Probe.Id = this.ProbeId;
91+
}
5792
backendHttpSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
5893
this.NetworkClient.NetworkManagementClient.SubscriptionId,
5994
Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendHttpSettingsName,

src/ResourceManager/Network/Commands.Network/ApplicationGateway/HttpListener/AzureApplicationGatewayHttpListenerBase.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ public class AzureApplicationGatewayHttpListenerBase : NetworkBaseCmdlet
6363
[ValidateNotNullOrEmpty]
6464
public PSApplicationGatewaySslCertificate SslCertificate { get; set; }
6565

66+
[Parameter(
67+
HelpMessage = "Host name")]
68+
[ValidateNotNullOrEmpty]
69+
public string HostName { get; set; }
70+
71+
[Parameter(
72+
HelpMessage = "RequireServerNameIndication")]
73+
[ValidateSet("true", "false", IgnoreCase = true)]
74+
[ValidateNotNullOrEmpty]
75+
public string RequireServerNameIndication { get; set; }
76+
6677
[Parameter(
6778
Mandatory = true,
6879
HelpMessage = "Protocol")]
@@ -96,6 +107,8 @@ public PSApplicationGatewayHttpListener NewObject()
96107
var httpListener = new PSApplicationGatewayHttpListener();
97108
httpListener.Name = this.Name;
98109
httpListener.Protocol = this.Protocol;
110+
httpListener.HostName = this.HostName;
111+
httpListener.RequireServerNameIndication = this.RequireServerNameIndication;
99112

100113
if (!string.IsNullOrEmpty(this.FrontendIPConfigurationId))
101114
{
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.Collections.Generic;
16+
using System.Management.Automation;
17+
using Microsoft.Azure.Commands.Network.Models;
18+
using MNM = Microsoft.Azure.Management.Network.Models;
19+
20+
namespace Microsoft.Azure.Commands.Network
21+
{
22+
public class AzureApplicationGatewayPathRuleConfigBase : NetworkBaseCmdlet
23+
{
24+
[Parameter(
25+
Mandatory = true,
26+
HelpMessage = "List of URL paths")]
27+
[ValidateNotNullOrEmpty]
28+
public List<string> Paths { get; set; }
29+
30+
[Parameter(
31+
ParameterSetName = "SetByResourceId",
32+
HelpMessage = "ID of the application gateway BackendAddressPool")]
33+
[ValidateNotNullOrEmpty]
34+
public string BackendAddressPoolId { get; set; }
35+
36+
[Parameter(
37+
ParameterSetName = "SetByResource",
38+
HelpMessage = "Application gateway BackendAddressPool")]
39+
[ValidateNotNullOrEmpty]
40+
public PSApplicationGatewayBackendAddressPool BackendAddressPool { get; set; }
41+
42+
[Parameter(
43+
ParameterSetName = "SetByResourceId",
44+
HelpMessage = "ID of the application gateway BackendHttpSettings")]
45+
[ValidateNotNullOrEmpty]
46+
public string BackendHttpSettingsId { get; set; }
47+
48+
[Parameter(
49+
ParameterSetName = "SetByResource",
50+
HelpMessage = "Application gateway BackendHttpSettings")]
51+
[ValidateNotNullOrEmpty]
52+
public PSApplicationGatewayBackendHttpSettings BackendHttpSettings { get; set; }
53+
54+
public override void ExecuteCmdlet()
55+
{
56+
base.ExecuteCmdlet();
57+
58+
if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResource))
59+
{
60+
if (BackendAddressPool != null)
61+
{
62+
this.BackendAddressPoolId = this.BackendAddressPool.Id;
63+
}
64+
if (BackendHttpSettings != null)
65+
{
66+
this.BackendHttpSettingsId = this.BackendHttpSettings.Id;
67+
}
68+
}
69+
}
70+
71+
public PSApplicationGatewayPathRule NewObject()
72+
{
73+
var pathRule = new PSApplicationGatewayPathRule();
74+
75+
pathRule.Paths = this.Paths;
76+
77+
if (!string.IsNullOrEmpty(this.BackendAddressPoolId))
78+
{
79+
pathRule.BackendAddressPool = new PSResourceId();
80+
pathRule.BackendAddressPool.Id = this.BackendAddressPoolId;
81+
}
82+
83+
if (!string.IsNullOrEmpty(this.BackendHttpSettingsId))
84+
{
85+
pathRule.BackendHttpSettings = new PSResourceId();
86+
pathRule.BackendHttpSettings.Id = this.BackendHttpSettingsId;
87+
}
88+
89+
return pathRule;
90+
}
91+
}
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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.Management.Automation;
16+
using Microsoft.Azure.Commands.Network.Models;
17+
using MNM = Microsoft.Azure.Management.Network.Models;
18+
19+
namespace Microsoft.Azure.Commands.Network
20+
{
21+
[Cmdlet(VerbsCommon.New, "AzureRmApplicationGatewayPathRuleConfig"), OutputType(typeof(PSApplicationGatewayPathRule))]
22+
public class NewAzureApplicationGatewayPathRuleConfigCommand : AzureApplicationGatewayPathRuleConfigBase
23+
{
24+
public override void ExecuteCmdlet()
25+
{
26+
base.ExecuteCmdlet();
27+
WriteObject(base.NewObject());
28+
}
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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.Linq;
17+
using System.Management.Automation;
18+
using Microsoft.Azure.Commands.Network.Models;
19+
using MNM = Microsoft.Azure.Management.Network.Models;
20+
21+
namespace Microsoft.Azure.Commands.Network
22+
{
23+
[Cmdlet(VerbsCommon.Add, "AzureRmApplicationGatewayProbeConfig"), OutputType(typeof(PSApplicationGateway))]
24+
public class AddAzureApplicationGatewayProbeConfigCommand : AzureApplicationGatewayProbeConfigBase
25+
{
26+
[Parameter(
27+
Mandatory = true,
28+
ValueFromPipeline = true,
29+
HelpMessage = "The applicationGateway")]
30+
public PSApplicationGateway ApplicationGateway { get; set; }
31+
32+
public override void ExecuteCmdlet()
33+
{
34+
base.ExecuteCmdlet();
35+
36+
var probe = this.ApplicationGateway.Probes.SingleOrDefault(resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase));
37+
38+
if (probe != null)
39+
{
40+
throw new ArgumentException("Probe with the specified name already exists");
41+
}
42+
43+
probe = base.NewObject();
44+
this.ApplicationGateway.Probes.Add(probe);
45+
46+
WriteObject(this.ApplicationGateway);
47+
}
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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.Collections.Generic;
16+
using System.Management.Automation;
17+
using Microsoft.Azure.Commands.Network.Models;
18+
using MNM = Microsoft.Azure.Management.Network.Models;
19+
20+
namespace Microsoft.Azure.Commands.Network
21+
{
22+
public class AzureApplicationGatewayProbeConfigBase : NetworkBaseCmdlet
23+
{
24+
[Parameter(
25+
Mandatory = true,
26+
HelpMessage = "Name of the probe")]
27+
[ValidateNotNullOrEmpty]
28+
public string Name { get; set; }
29+
30+
[Parameter(
31+
Mandatory = true,
32+
HelpMessage = "Protocol used to send probe")]
33+
[ValidateSet("Http", IgnoreCase = true)]
34+
[ValidateNotNullOrEmpty]
35+
public string Protocol { get; set; }
36+
37+
[Parameter(
38+
Mandatory = true,
39+
HelpMessage = "Host name to send probe to")]
40+
[ValidateNotNullOrEmpty]
41+
public string HostName { get; set; }
42+
43+
[Parameter(
44+
Mandatory = true,
45+
HelpMessage = "Relative path of probe. Valid path starts from '/'. Probe is sent to <Protocol>://<host>:<port><path>")]
46+
[ValidateNotNullOrEmpty]
47+
public string Path { get; set; }
48+
49+
[Parameter(
50+
Mandatory = true,
51+
HelpMessage = "Probe interval in seconds. This is the time interval between two consecutive probes")]
52+
[ValidateNotNullOrEmpty]
53+
public uint Interval { get; set; }
54+
55+
[Parameter(
56+
Mandatory = true,
57+
HelpMessage = "Probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period")]
58+
[ValidateNotNullOrEmpty]
59+
public uint Timeout { get; set; }
60+
61+
[Parameter(
62+
Mandatory = true,
63+
HelpMessage = "Frontend port")]
64+
[ValidateNotNullOrEmpty]
65+
public uint UnhealthyThreshold { get; set; }
66+
67+
[Parameter(
68+
Mandatory = true,
69+
HelpMessage = "Probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold")]
70+
[ValidateNotNullOrEmpty]
71+
public string ProvisioningState { get; set; }
72+
73+
public PSApplicationGatewayProbe NewObject()
74+
{
75+
var probe = new PSApplicationGatewayProbe();
76+
probe.Name = this.Name;
77+
probe.Protocol = this.Protocol;
78+
probe.Host = this.HostName;
79+
probe.Path = this.Path;
80+
probe.Interval = this.Interval;
81+
probe.Timeout = this.Timeout;
82+
probe.UnhealthyThreshold = this.UnhealthyThreshold;
83+
84+
probe.Id =
85+
ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
86+
this.NetworkClient.NetworkManagementClient.SubscriptionId,
87+
Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayProbeName,
88+
this.Name);
89+
90+
return probe;
91+
}
92+
}
93+
}

0 commit comments

Comments
 (0)