Skip to content
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

[Network] Add new property in VPNSite resource #13014

Merged
merged 6 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion src/Network/Network/Az.Network.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
'Get-AzNetworkVirtualApplianceSku',
'New-AzVirtualApplianceSkuProperty', 'New-AzCustomIpPrefix',
'Update-AzCustomIpPrefix', 'Get-AzCustomIpPrefix',
'Remove-AzCustomIpPrefix', 'New-AzExpressRoutePortLOA'
'Remove-AzCustomIpPrefix', 'New-AzExpressRoutePortLOA',
'New-AzO365PolicyProperty'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
11 changes: 11 additions & 0 deletions src/Network/Network/Cortex/VpnSite/NewAzureRmVpnSiteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ public class NewAzureRmVpnSiteCommand : VpnSiteBaseCmdlet
[ValidateNotNullOrEmpty]
public PSVpnSiteLink[] VpnSiteLink { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "The office 365 traffic breakout policy for this VpnSite.")]
[ValidateNotNullOrEmpty]
public PSO365PolicyProperties O365Policy { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "A hashtable which represents resource tags.")]
Expand Down Expand Up @@ -274,6 +280,11 @@ public override void Execute()
vpnSiteToCreate.VpnSiteLinks.AddRange(this.VpnSiteLink);
}

if (this.O365Policy != null )
{
vpnSiteToCreate.O365Policy = this.O365Policy;
}

ConfirmAction(
Properties.Resources.CreatingResourceMessage,
this.Name,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ----------------------------------------------------------------------------------
//
// 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 System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Text;

namespace Microsoft.Azure.Commands.Network
{
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "O365PolicyProperty"), OutputType(typeof(PSO365PolicyProperties))]
public class NewAzureRmO365PolicyPropertyCommand : NetworkBaseCmdlet
{
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = false,
HelpMessage = "Breakout the allow category traffic.")]
public SwitchParameter Allow { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = false,
HelpMessage = "Breakout the optimize category traffic.")]
public SwitchParameter Optimize { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = false,
HelpMessage = "Breakout the default category traffic.")]
public SwitchParameter Default { get; set; }

public override void Execute()
{
base.Execute();
var o365Policy = new PSO365PolicyProperties();
o365Policy.BreakOutCategories = new PSO365BreakOutCategoryPolicies();
o365Policy.BreakOutCategories.Allow = this.Allow;
o365Policy.BreakOutCategories.Optimize = this.Optimize;
o365Policy.BreakOutCategories.DefaultProperty = this.Default;
WriteObject(o365Policy);
}
}
}
11 changes: 11 additions & 0 deletions src/Network/Network/Cortex/VpnSite/UpdateAzureRmVpnSiteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ public class UpdateAzureRmVpnSiteCommand : VpnSiteBaseCmdlet
HelpMessage = "The list of VpnSiteLinks that this VpnSite have.")]
public PSVpnSiteLink[] VpnSiteLink { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "The office 365 traffic breakout policy for this VpnSite.")]
[ValidateNotNullOrEmpty]
public PSO365PolicyProperties O365Policy { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "A hashtable which represents resource tags.")]
Expand Down Expand Up @@ -372,6 +378,11 @@ public override void Execute()
vpnSiteToUpdate.VpnSiteLinks.AddRange(this.VpnSiteLink);
}

if (this.O365Policy != null)
{
vpnSiteToUpdate.O365Policy = this.O365Policy;
}

ConfirmAction(
Properties.Resources.SettingResourceMessage,
this.Name,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Commands.Network.Models
{
public class PSO365BreakOutCategoryPolicies
{
public bool? Allow { get; set; }
public bool? Optimize { get; set; }
public bool? DefaultProperty { get; set; }
}
}
11 changes: 11 additions & 0 deletions src/Network/Network/Models/Cortex/PSO365PolicyProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Commands.Network.Models
{
public class PSO365PolicyProperties
{
public PSO365BreakOutCategoryPolicies BreakOutCategories { get; set; }
}
}
3 changes: 3 additions & 0 deletions src/Network/Network/Models/Cortex/PSVpnSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ public class PSVpnSite : PSTopLevelResource
public string ProvisioningState { get; set; }

public List<PSVpnSiteLink> VpnSiteLinks { get; set; }

public PSO365PolicyProperties O365Policy { get; set; }

}
}
106 changes: 106 additions & 0 deletions src/Network/Network/help/New-AzO365PolicyProperty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml
Module Name: Az.Network
online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-azo365policyproperty
schema: 2.0.0
---

# New-AzO365PolicyProperty

## SYNOPSIS
Create an office 365 traffic breakout policy object.

## SYNTAX

```
New-AzO365PolicyProperty [-Allow] [-Optimize] [-Default] [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

## DESCRIPTION
Create an office 365 breakout policy to be used with New-AzVpnSite and Update-AzVpnSite cmdlets.
## EXAMPLES

### Example 1
```powershell
PS C:\> $policy = New-AzO365PolicyProperty -Allow -Optimize
```

Create an office 365 traffic breakout policy with breakout allowed for allow and optimize category of traffic.

## PARAMETERS

### -Allow
Breakout the allow category traffic.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Default
Breakout the default category traffic.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.

```yaml
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Optimize
Breakout the optimize category traffic.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None

## OUTPUTS

### Microsoft.Azure.Commands.Network.Models.PSO365PolicyProperties

## NOTES

## RELATED LINKS
15 changes: 15 additions & 0 deletions src/Network/Network/help/New-AzVpnSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -O365Policy
The office 365 traffic breakout policy for this VpnSite.

```yaml
Type: Microsoft.Azure.Commands.Network.Models.PSO365PolicyProperties
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ResourceGroupName
The resource name.

Expand Down
15 changes: 15 additions & 0 deletions src/Network/Network/help/Update-AzVpnSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -O365Policy
The office 365 traffic breakout policy for this VpnSite.

```yaml
Type: Microsoft.Azure.Commands.Network.Models.PSO365PolicyProperties
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ResourceGroupName
The resource group name.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,4 @@
"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.GetAzureRmVpnSiteCommand","Get-AzVpnSite","1","8700","Parameter set 'ListByResourceGroupName', '__AllParameterSets' of cmdlet 'Get-AzVpnSite' have the same mandatory parameters, and both of them are not default parameter set which may cause confusion.","Merge these parameter sets into one parameter set."
"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Bastion.GetAzBastionCommand","Get-AzBastion","1","8700","Parameter set 'ListByResourceGroupName', '__AllParameterSets' of cmdlet 'Get-AzBastion' have the same mandatory parameters, and both of them are not default parameter set which may cause confusion.","Merge these parameter sets into one parameter set."
"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureRmExpressRoutePortLOA","New-AzExpressRoutePortLOA","1","8100","New-AzExpressRoutePortLOA Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureRmO365PolicyPropertyCommand","New-AzO365PolicyProperty","1","8100","New-AzO365PolicyProperty Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"