-
Notifications
You must be signed in to change notification settings - Fork 4.1k
PS cmdlets for application gateway L4 properties #18557
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
VeryEarly
merged 9 commits into
Azure:network-2022-01-01
from
gdhillon24:gdhillon_AppGwTLSProxy
Jun 22, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4d4baf4
Modify NewAzureApplicationGatewayCommand to include L4 properties
gdhillon24 d264163
Health probes cmdlets changes for TCP/TLS proxy,Scenario tests,Sessio…
gdhillon24 3e1aaa6
Resolved ChangeLog.md Conflict
gdhillon24 f7a53f5
Merge branch 'network-2022-01-01' into gdhillon_AppGwTLSProxy
gdhillon24 b765585
Application Gateway Probe config Help files
gdhillon24 669c3fd
Static Analysis Issues
gdhillon24 92df3a7
Added default parameter set for new cmdlets
gdhillon24 3e26074
Added Priority field for application gateway routing rule
gdhillon24 3be9c75
Session records and help files for Default parameter set changes and …
gdhillon24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
574 changes: 574 additions & 0 deletions
574
src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.ps1
Large diffs are not rendered by default.
Oops, something went wrong.
6,794 changes: 6,794 additions & 0 deletions
6,794
...rk.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayWithTCPResources.json
Large diffs are not rendered by default.
Oops, something went wrong.
7,968 changes: 7,968 additions & 0 deletions
7,968
...rk.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayWithTLSResources.json
Large diffs are not rendered by default.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
...rk/ApplicationGateway/BackendSettings/AddAzureApplicationGatewayBackendSettingsCommand.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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.Azure.Commands.Network.Models; | ||
| using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; | ||
| using System; | ||
| using System.Linq; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| [Cmdlet("Add", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApplicationGatewayBackendSetting"), OutputType(typeof(PSApplicationGateway))] | ||
| public class AddAzureApplicationGatewayBackendSettingsCommand : AzureApplicationGatewayBackendSettingsBase | ||
| { | ||
| [Parameter( | ||
| Mandatory = true, | ||
| ValueFromPipeline = true, | ||
| HelpMessage = "The applicationGateway")] | ||
| public PSApplicationGateway ApplicationGateway { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| base.ExecuteCmdlet(); | ||
|
|
||
| var backendSettings = this.ApplicationGateway.BackendSettingsCollection.SingleOrDefault | ||
| (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); | ||
|
|
||
| if (backendSettings != null) | ||
| { | ||
| throw new ArgumentException("Backend settings with the specified name already exists"); | ||
| } | ||
|
|
||
| backendSettings = base.NewObject(); | ||
| this.ApplicationGateway.BackendSettingsCollection.Add(backendSettings); | ||
|
|
||
| WriteObject(this.ApplicationGateway); | ||
| } | ||
| } | ||
| } |
139 changes: 139 additions & 0 deletions
139
.../Network/ApplicationGateway/BackendSettings/AzureApplicationGatewayBackendSettingsBase.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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; | ||
| using System.Collections.Generic; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.Network.Models; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| public class AzureApplicationGatewayBackendSettingsBase : NetworkBaseCmdlet | ||
| { | ||
| [Parameter( | ||
| Mandatory = true, | ||
| HelpMessage = "The name of the backend settings")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Name { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = true, | ||
| HelpMessage = "Port")] | ||
| [ValidateNotNullOrEmpty] | ||
| public int Port { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = true, | ||
| HelpMessage = "Protocol")] | ||
| [ValidateSet("TCP", "TLS", IgnoreCase = true)] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Protocol { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "Timeout. Default value 30 seconds.")] | ||
| [ValidateNotNullOrEmpty] | ||
| public int Timeout { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "ID of the application gateway Probe")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string ProbeId { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "Application gateway Probe")] | ||
| [ValidateNotNullOrEmpty] | ||
| public PSApplicationGatewayProbe Probe { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "Application gateway Trusted Root Certificates")] | ||
| [ValidateNotNullOrEmpty] | ||
| public PSApplicationGatewayTrustedRootCertificate[] TrustedRootCertificate { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "Flag if host header should be picked from the host name of the backend server.")] | ||
| public SwitchParameter PickHostNameFromBackendAddress { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "Sets host header to be sent to the backend servers.")] | ||
| public string HostName { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| base.ExecuteCmdlet(); | ||
|
|
||
| if (Probe != null) | ||
| { | ||
| this.ProbeId = this.Probe.Id; | ||
| } | ||
| } | ||
| public PSApplicationGatewayBackendSettings NewObject() | ||
| { | ||
| var backendSettings = new PSApplicationGatewayBackendSettings(); | ||
| backendSettings.Name = this.Name; | ||
| backendSettings.Port = this.Port; | ||
| backendSettings.Protocol = this.Protocol; | ||
|
|
||
| if (0 == this.Timeout) | ||
| { | ||
| backendSettings.Timeout = 30; | ||
| } | ||
| else | ||
| { | ||
| backendSettings.Timeout = this.Timeout; | ||
| } | ||
|
|
||
| if (!string.IsNullOrEmpty(this.ProbeId)) | ||
| { | ||
| backendSettings.Probe = new PSResourceId(); | ||
| backendSettings.Probe.Id = this.ProbeId; | ||
| } | ||
|
|
||
| if (this.TrustedRootCertificate != null && this.TrustedRootCertificate.Length > 0) | ||
| { | ||
| backendSettings.TrustedRootCertificates = new List<PSResourceId>(); | ||
| foreach (var trustedRootCert in this.TrustedRootCertificate) | ||
| { | ||
| backendSettings.TrustedRootCertificates.Add( | ||
| new PSResourceId() | ||
| { | ||
| Id = trustedRootCert.Id | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| if(this.PickHostNameFromBackendAddress.IsPresent) | ||
| { | ||
| backendSettings.PickHostNameFromBackendAddress = true; | ||
| } | ||
|
|
||
| if(this.HostName != null) | ||
| { | ||
| backendSettings.HostName = this.HostName; | ||
| } | ||
|
|
||
| backendSettings.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( | ||
| this.NetworkClient.NetworkManagementClient.SubscriptionId, | ||
| Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewaybackendSettingsName, | ||
| this.Name); | ||
|
|
||
| return backendSettings; | ||
| } | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...rk/ApplicationGateway/BackendSettings/GetAzureApplicationGatewayBackendSettingsCommand.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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.Azure.Commands.Network.Models; | ||
| using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApplicationGatewayBackendSetting"),OutputType(typeof(PSApplicationGatewayBackendSettings))] | ||
| public class GetAzureApplicationGatewayBackendSettings : NetworkBaseCmdlet | ||
| { | ||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "The name of the backend settings")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Name { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = true, | ||
| ValueFromPipeline = true, | ||
| HelpMessage = "The applicationGateway")] | ||
| public PSApplicationGateway ApplicationGateway { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| base.ExecuteCmdlet(); | ||
|
|
||
| if (!string.IsNullOrEmpty(this.Name)) | ||
| { | ||
| var backendSettings = | ||
| this.ApplicationGateway.BackendSettingsCollection.First( | ||
| resource => | ||
| string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); | ||
|
|
||
| WriteObject(backendSettings); | ||
| } | ||
| else | ||
| { | ||
| var backendSettings = this.ApplicationGateway.BackendSettingsCollection; | ||
| WriteObject(backendSettings, true); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
...rk/ApplicationGateway/BackendSettings/NewAzureApplicationGatewayBackendSettingsCommand.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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.Azure.Commands.Network.Models; | ||
| using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApplicationGatewayBackendSetting"), OutputType(typeof(PSApplicationGatewayBackendSettings))] | ||
| public class NewAzureApplicationGatewayBackendSettingsCommand : AzureApplicationGatewayBackendSettingsBase | ||
| { | ||
| public override void ExecuteCmdlet() | ||
| { | ||
| base.ExecuteCmdlet(); | ||
| WriteObject(base.NewObject()); | ||
| } | ||
| } | ||
| } | ||
52 changes: 52 additions & 0 deletions
52
...ApplicationGateway/BackendSettings/RemoveAzureApplicationGatewayBackendSettingsCommand.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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.Azure.Commands.Network.Models; | ||
| using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; | ||
| using System.Linq; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| [Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApplicationGatewayBackendSetting"), OutputType(typeof(PSApplicationGateway))] | ||
| public class RemoveAzureApplicationGatewayBackendSettingsCommand : NetworkBaseCmdlet | ||
| { | ||
| [Parameter( | ||
| Mandatory = true, | ||
| HelpMessage = "The name of the backend settings")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Name { get; set; } | ||
|
|
||
| [Parameter( | ||
| Mandatory = true, | ||
| ValueFromPipeline = true, | ||
| HelpMessage = "The applicationGateway")] | ||
| public PSApplicationGateway ApplicationGateway { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| base.ExecuteCmdlet(); | ||
|
|
||
| var backendSettings = this.ApplicationGateway.BackendSettingsCollection.SingleOrDefault | ||
| (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); | ||
|
|
||
| if (backendSettings != null) | ||
| { | ||
| this.ApplicationGateway.BackendSettingsCollection.Remove(backendSettings); | ||
| } | ||
|
|
||
| WriteObject(this.ApplicationGateway); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cmdlet will return ID like:
/subscriptions/{0}/resourceGroups/ResourceGroupNotSet/providers/Microsoft.Network/applicationGateways/ApplicationGatewayNameNotSet/{3}/{4}
can you please clarify in help message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New-AzApplicationGatewayBackendSetting it returns a PSApplicationGatewayBackendSettings Object
