Skip to content

Commit e675318

Browse files
Migrate PaloAltoNetworks from generation to main (#25017)
* Move PaloAltoNetworks to main * update changelog --------- Co-authored-by: Jinpei Li <[email protected]>
1 parent b8812de commit e675318

File tree

67 files changed

+2577
-3132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2577
-3132
lines changed

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ input-file:
3636
title: PaloAltoNetworks
3737
module-version: 0.2.0
3838
subject-prefix: $(service-name)
39-
disable-transform-identity-type: true
40-
flatten-userassignedidentity: false
4139

4240
directive:
4341
- from: swagger-document
@@ -86,14 +84,13 @@ directive:
8684
- where:
8785
verb: Set
8886
remove: true
89-
# # Some of the parameters are of type Object and need to be expanded into a command for the convenience of the user
90-
# # The following are commented out and their generated cmdlets may be renamed and custom logic
91-
# # Do not delete this code
92-
# - model-cmdlet:
93-
# - IPAddress
94-
# - FrontendSetting
95-
# - NetworkProfile
96-
# - TagInfo
87+
88+
- model-cmdlet:
89+
- model-name: IPAddress
90+
- model-name: FrontendSetting
91+
- model-name: NetworkProfile
92+
cmdlet-name: New-AzPaloAltoNetworksProfileObject
93+
- model-name: TagInfo
9794

9895
- where:
9996
subject: PostRule

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/build-module.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
1313
# is regenerated.
1414
# ----------------------------------------------------------------------------------
15-
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX)
15+
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks)
1616
$ErrorActionPreference = 'Stop'
1717

1818
if($PSEdition -ne 'Core') {
@@ -130,7 +130,7 @@ $examplesFolder = Join-Path $PSScriptRoot 'examples'
130130
$null = New-Item -ItemType Directory -Force -Path $examplesFolder
131131

132132
Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...'
133-
$modelCmdlets = @()
133+
$modelCmdlets = @(@{modelName="IPAddress"; cmdletName=""}, @{modelName="FrontendSetting"; cmdletName=""}, @{modelName="NetworkProfile"; cmdletName="New-AzPaloAltoNetworksProfileObject"}, @{modelName="TagInfo"; cmdletName=""})
134134
$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets'
135135
if (Test-Path $modelCmdletFolder) {
136136
$null = Remove-Item -Force -Recurse -Path $modelCmdletFolder
@@ -177,4 +177,14 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
177177
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
178178
}
179179

180+
if (-not $DisableAfterBuildTasks){
181+
$afterBuildTasksPath = Join-Path $PSScriptRoot ''
182+
$afterBuildTasksArgs = ConvertFrom-Json 'true' -AsHashtable
183+
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
184+
Write-Host -ForegroundColor Green 'Running after build tasks...'
185+
. $afterBuildTasksPath @afterBuildTasksArgs
186+
}
187+
}
188+
189+
180190
Write-Host -ForegroundColor Green '-------------Done-------------'

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/custom/New-AzPaloAltoNetworksProfileObject.ps1 renamed to src/PaloAltoNetworks/PaloAltoNetworks.Autorest/custom/autogen-model-cmdlets/New-AzPaloAltoNetworksProfileObject.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ function New-AzPaloAltoNetworksProfileObject {
4444
[Parameter(Mandatory, HelpMessage="List of IPs associated with the Firewall.")]
4545
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Models.IIPAddress[]]
4646
$PublicIP,
47+
[Parameter(HelpMessage="Non-RFC 1918 address.")]
48+
[string[]]
49+
$TrustedRange,
4750
[Parameter(HelpMessage="Address Space.")]
4851
[string]
4952
$VHubAddressSpace,
@@ -112,6 +115,9 @@ function New-AzPaloAltoNetworksProfileObject {
112115
if ($PSBoundParameters.ContainsKey('PublicIP')) {
113116
$Object.PublicIP = $PublicIP
114117
}
118+
if ($PSBoundParameters.ContainsKey('TrustedRange')) {
119+
$Object.TrustedRange = $TrustedRange
120+
}
115121
if ($PSBoundParameters.ContainsKey('VHubAddressSpace')) {
116122
$Object.VHubAddressSpace = $VHubAddressSpace
117123
}

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/examples/New-AzPaloAltoNetworksFirewall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
```powershell
33
$publicIP = New-AzPaloAltoNetworksIPAddressObject -ResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/publicIPAddresses/azps-network-publicipaddresses"
44
5-
$networkProfile = New-AzPaloAltoNetworksProfileObject -EnableEgressNat DISABLED -PublicIP $publicIP -NetworkType VNET -VnetConfigurationIPOfTrustSubnetForUdrAddress 10.1.1.0/24 -VnetConfigurationTrustSubnetResourceId /"subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet1" -VnetConfigurationUnTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet2" -VnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network"
5+
$networkProfile = New-AzPaloAltoNetworksProfileObject -EnableEgressNat DISABLED -PublicIP $publicIP -NetworkType VNET -VnetConfigurationIPOfTrustSubnetForUdrAddress 10.1.1.0/24 -VnetConfigurationTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet1" -VnetConfigurationUnTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet2" -VnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network"
66
77
New-AzPaloAltoNetworksFirewall -Name azps-firewall -ResourceGroupName azps_test_group_pan -Location eastus -MarketplaceDetailOfferId "pan_swfw_cloud_ngfw" -MarketplaceDetailPublisherId "paloaltonetworks" -NetworkProfile $networkProfile -PlanDataBillingCycle "MONTHLY" -PlanDataPlanId "cloud-ngfw-payg-test" -AssociatedRulestackResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/azps-panlr" -DnsSettingDnsServer $publicIP -DnsSettingEnableDnsProxy DISABLED -DnsSettingEnabledDnsType CUSTOM -AssociatedRulestackLocation eastus
88
```

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/examples/New-AzPaloAltoNetworksLocalRulestack.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,17 @@ Name Location ProvisioningState ResourceGroupName
99
azps-panlr eastus Succeeded azps_test_group_pan
1010
```
1111

12+
Create a LocalRulestackResource.
13+
14+
### Example 2: Create a LocalRulestackResource.
15+
```powershell
16+
New-AzPaloAltoNetworksLocalRulestack -Name azps-panlr2 -ResourceGroupName azps_test_group_pan -Location eastus -Description "testing powershell" -DefaultMode 'NONE' -UserAssignedIdentity "/subscriptions/{subId}/resourcegroups/azps_test_group_pan/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uami"
17+
```
18+
19+
```output
20+
Name Location ProvisioningState ResourceGroupName
21+
---- -------- ----------------- -----------------
22+
azps-panlr eastus Succeeded azps_test_group_pan
23+
```
24+
1225
Create a LocalRulestackResource.

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/exports/New-AzPaloAltoNetworksFirewall.ps1

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Create a FirewallResource
2222
.Example
2323
$publicIP = New-AzPaloAltoNetworksIPAddressObject -ResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/publicIPAddresses/azps-network-publicipaddresses"
2424
25-
$networkProfile = New-AzPaloAltoNetworksProfileObject -EnableEgressNat DISABLED -PublicIP $publicIP -NetworkType VNET -VnetConfigurationIPOfTrustSubnetForUdrAddress 10.1.1.0/24 -VnetConfigurationTrustSubnetResourceId /"subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet1" -VnetConfigurationUnTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet2" -VnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network"
25+
$networkProfile = New-AzPaloAltoNetworksProfileObject -EnableEgressNat DISABLED -PublicIP $publicIP -NetworkType VNET -VnetConfigurationIPOfTrustSubnetForUdrAddress 10.1.1.0/24 -VnetConfigurationTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet1" -VnetConfigurationUnTrustSubnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network/subnets/subnet2" -VnetResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/Microsoft.Network/virtualNetworks/azps-network"
2626
2727
New-AzPaloAltoNetworksFirewall -Name azps-firewall -ResourceGroupName azps_test_group_pan -Location eastus -MarketplaceDetailOfferId "pan_swfw_cloud_ngfw" -MarketplaceDetailPublisherId "paloaltonetworks" -NetworkProfile $networkProfile -PlanDataBillingCycle "MONTHLY" -PlanDataPlanId "cloud-ngfw-payg-test" -AssociatedRulestackResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/azps_test_group_pan/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/azps-panlr" -DnsSettingDnsServer $publicIP -DnsSettingEnableDnsProxy DISABLED -DnsSettingEnabledDnsType CUSTOM -AssociatedRulestackLocation eastus
2828
@@ -176,27 +176,19 @@ param(
176176
# Enabled DNS proxy type, disabled by default
177177
${DnsSettingEnabledDnsType},
178178

179+
[Parameter()]
180+
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
181+
[System.Management.Automation.SwitchParameter]
182+
# Decides if enable a system assigned identity for the resource.
183+
${EnableSystemAssignedIdentity},
184+
179185
[Parameter()]
180186
[AllowEmptyCollection()]
181187
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
182188
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Models.IFrontendSetting[]]
183189
# Frontend settings for Firewall
184190
${FrontEndSetting},
185191

186-
[Parameter()]
187-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned")]
188-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
189-
[System.String]
190-
# The type of managed identity assigned to this resource.
191-
${IdentityType},
192-
193-
[Parameter()]
194-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
195-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Models.IAzureResourceManagerManagedIdentityPropertiesUserAssignedIdentities]))]
196-
[System.Collections.Hashtable]
197-
# The identities assigned to this resource by the user.
198-
${IdentityUserAssignedIdentity},
199-
200192
[Parameter()]
201193
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.PSArgumentCompleterAttribute("TRUE", "FALSE")]
202194
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
@@ -239,6 +231,14 @@ param(
239231
# Resource tags.
240232
${Tag},
241233

234+
[Parameter()]
235+
[AllowEmptyCollection()]
236+
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
237+
[System.String[]]
238+
# The array of user assigned identities associated with the resource.
239+
# The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'
240+
${UserAssignedIdentity},
241+
242242
[Parameter()]
243243
[Alias('AzureRMContext', 'AzureCredential')]
244244
[ValidateNotNull()]

src/PaloAltoNetworks/PaloAltoNetworks.Autorest/exports/New-AzPaloAltoNetworksLocalRulestack.ps1

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Create a LocalRulestackResource
2121
Create a LocalRulestackResource
2222
.Example
2323
New-AzPaloAltoNetworksLocalRulestack -Name azps-panlr -ResourceGroupName azps_test_group_pan -Location eastus -Description "testing powershell" -DefaultMode 'NONE'
24+
.Example
25+
New-AzPaloAltoNetworksLocalRulestack -Name azps-panlr2 -ResourceGroupName azps_test_group_pan -Location eastus -Description "testing powershell" -DefaultMode 'NONE' -UserAssignedIdentity "/subscriptions/{subId}/resourcegroups/azps_test_group_pan/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uami"
2426
2527
.Outputs
2628
Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Models.ILocalRulestackResource
@@ -78,19 +80,11 @@ param(
7880
# rulestack description
7981
${Description},
8082

81-
[Parameter()]
82-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned")]
83-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
84-
[System.String]
85-
# The type of managed identity assigned to this resource.
86-
${IdentityType},
87-
8883
[Parameter()]
8984
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
90-
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Models.IAzureResourceManagerManagedIdentityPropertiesUserAssignedIdentities]))]
91-
[System.Collections.Hashtable]
92-
# The identities assigned to this resource by the user.
93-
${IdentityUserAssignedIdentity},
85+
[System.Management.Automation.SwitchParameter]
86+
# Decides if enable a system assigned identity for the resource.
87+
${EnableSystemAssignedIdentity},
9488

9589
[Parameter()]
9690
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
@@ -172,6 +166,14 @@ param(
172166
# Resource tags.
173167
${Tag},
174168

169+
[Parameter()]
170+
[AllowEmptyCollection()]
171+
[Microsoft.Azure.PowerShell.Cmdlets.PaloAltoNetworks.Category('Body')]
172+
[System.String[]]
173+
# The array of user assigned identities associated with the resource.
174+
# The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'
175+
${UserAssignedIdentity},
176+
175177
[Parameter()]
176178
[Alias('AzureRMContext', 'AzureCredential')]
177179
[ValidateNotNull()]

0 commit comments

Comments
 (0)