Skip to content

Commit 486b4f9

Browse files
author
Chenglong Liu
committed
Add UpdateFrontDoorCdnProfile test
1 parent cf453a5 commit 486b4f9

8 files changed

+598
-3
lines changed

src/Cdn/Cdn.Autorest/Az.Cdn.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.Cdn.private.dll'
1313
FormatsToProcess = './Az.Cdn.format.ps1xml'
14-
FunctionsToExport = 'Clear-AzCdnAfdEndpointContent', 'Clear-AzCdnEndpointContent', 'Disable-AzCdnCustomDomainCustomHttps', 'Enable-AzCdnCustomDomainCustomHttps', 'Get-AzCdnAfdCustomDomain', 'Get-AzCdnAfdEndpoint', 'Get-AzCdnAfdEndpointResourceUsage', 'Get-AzCdnAfdOrigin', 'Get-AzCdnAfdOriginGroup', 'Get-AzCdnAfdOriginGroupResourceUsage', 'Get-AzCdnAfdProfileResourceUsage', 'Get-AzCdnCustomDomain', 'Get-AzCdnEdgeNode', 'Get-AzCdnEndpoint', 'Get-AzCdnEndpointResourceUsage', 'Get-AzCdnLogAnalyticLocation', 'Get-AzCdnLogAnalyticMetric', 'Get-AzCdnLogAnalyticRanking', 'Get-AzCdnLogAnalyticResource', 'Get-AzCdnLogAnalyticWafLogAnalyticMetric', 'Get-AzCdnLogAnalyticWafLogAnalyticRanking', 'Get-AzCdnManagedRuleSet', 'Get-AzCdnOrigin', 'Get-AzCdnOriginGroup', 'Get-AzCdnPolicy', 'Get-AzCdnProfile', 'Get-AzCdnProfileResourceUsage', 'Get-AzCdnProfileSupportedOptimizationType', 'Get-AzCdnResourceUsage', 'Get-AzCdnRoute', 'Get-AzCdnRule', 'Get-AzCdnRuleSet', 'Get-AzCdnRuleSetResourceUsage', 'Get-AzCdnSecret', 'Get-AzCdnSecurityPolicy', 'Get-AzFrontDoorCdnProfile', 'Import-AzCdnEndpointContent', 'Invoke-AzCdnSecretValidate', 'New-AzCdnAfdCustomDomain', 'New-AzCdnAfdEndpoint', 'New-AzCdnAfdOrigin', 'New-AzCdnAfdOriginGroup', 'New-AzCdnCustomDomain', 'New-AzCdnEndpoint', 'New-AzCdnOrigin', 'New-AzCdnOriginGroup', 'New-AzCdnPolicy', 'New-AzCdnProfileSsoUri', 'New-AzCdnRoute', 'New-AzCdnRule', 'New-AzCdnSecret', 'New-AzCdnSecurityPolicy', 'New-AzFrontDoorCdnProfile', 'Remove-AzCdnAfdCustomDomain', 'Remove-AzCdnAfdEndpoint', 'Remove-AzCdnAfdOrigin', 'Remove-AzCdnAfdOriginGroup', 'Remove-AzCdnCustomDomain', 'Remove-AzCdnEndpoint', 'Remove-AzCdnOrigin', 'Remove-AzCdnOriginGroup', 'Remove-AzCdnPolicy', 'Remove-AzCdnRoute', 'Remove-AzCdnRule', 'Remove-AzCdnRuleSet', 'Remove-AzCdnSecret', 'Remove-AzCdnSecurityPolicy', 'Remove-AzFrontDoorCdnProfile', 'Start-AzCdnEndpoint', 'Stop-AzCdnEndpoint', 'Test-AzCdnAfdEndpointCustomDomain', 'Test-AzCdnAfdProfileHostNameAvailability', 'Test-AzCdnEndpointCustomDomain', 'Test-AzCdnEndpointNameAvailability', 'Test-AzCdnNameAvailability', 'Test-AzCdnProbe', 'Update-AzCdnAfdCustomDomain', 'Update-AzCdnAfdCustomDomainValidationToken', 'Update-AzCdnAfdEndpoint', 'Update-AzCdnAfdOrigin', 'Update-AzCdnAfdOriginGroup', 'Update-AzCdnEndpoint', 'Update-AzCdnOrigin', 'Update-AzCdnOriginGroup', 'Update-AzCdnPolicy', 'Update-AzCdnRoute', 'Update-AzCdnRule', 'Update-AzCdnSecurityPolicy', '*'
14+
FunctionsToExport = 'Clear-AzCdnAfdEndpointContent', 'Clear-AzCdnEndpointContent', 'Disable-AzCdnCustomDomainCustomHttps', 'Enable-AzCdnCustomDomainCustomHttps', 'Get-AzCdnAfdCustomDomain', 'Get-AzCdnAfdEndpoint', 'Get-AzCdnAfdEndpointResourceUsage', 'Get-AzCdnAfdOrigin', 'Get-AzCdnAfdOriginGroup', 'Get-AzCdnAfdOriginGroupResourceUsage', 'Get-AzCdnAfdProfileResourceUsage', 'Get-AzCdnCustomDomain', 'Get-AzCdnEdgeNode', 'Get-AzCdnEndpoint', 'Get-AzCdnEndpointResourceUsage', 'Get-AzCdnLogAnalyticLocation', 'Get-AzCdnLogAnalyticMetric', 'Get-AzCdnLogAnalyticRanking', 'Get-AzCdnLogAnalyticResource', 'Get-AzCdnLogAnalyticWafLogAnalyticMetric', 'Get-AzCdnLogAnalyticWafLogAnalyticRanking', 'Get-AzCdnManagedRuleSet', 'Get-AzCdnOrigin', 'Get-AzCdnOriginGroup', 'Get-AzCdnPolicy', 'Get-AzCdnProfile', 'Get-AzCdnProfileResourceUsage', 'Get-AzCdnProfileSupportedOptimizationType', 'Get-AzCdnResourceUsage', 'Get-AzCdnRoute', 'Get-AzCdnRule', 'Get-AzCdnRuleSet', 'Get-AzCdnRuleSetResourceUsage', 'Get-AzCdnSecret', 'Get-AzCdnSecurityPolicy', 'Get-AzFrontDoorCdnProfile', 'Import-AzCdnEndpointContent', 'Invoke-AzCdnSecretValidate', 'New-AzCdnAfdCustomDomain', 'New-AzCdnAfdEndpoint', 'New-AzCdnAfdOrigin', 'New-AzCdnAfdOriginGroup', 'New-AzCdnCustomDomain', 'New-AzCdnEndpoint', 'New-AzCdnOrigin', 'New-AzCdnOriginGroup', 'New-AzCdnPolicy', 'New-AzCdnProfileSsoUri', 'New-AzCdnRoute', 'New-AzCdnRule', 'New-AzCdnSecret', 'New-AzCdnSecurityPolicy', 'New-AzFrontDoorCdnProfile', 'Remove-AzCdnAfdCustomDomain', 'Remove-AzCdnAfdEndpoint', 'Remove-AzCdnAfdOrigin', 'Remove-AzCdnAfdOriginGroup', 'Remove-AzCdnCustomDomain', 'Remove-AzCdnEndpoint', 'Remove-AzCdnOrigin', 'Remove-AzCdnOriginGroup', 'Remove-AzCdnPolicy', 'Remove-AzCdnRoute', 'Remove-AzCdnRule', 'Remove-AzCdnRuleSet', 'Remove-AzCdnSecret', 'Remove-AzCdnSecurityPolicy', 'Remove-AzFrontDoorCdnProfile', 'Start-AzCdnEndpoint', 'Stop-AzCdnEndpoint', 'Test-AzCdnAfdEndpointCustomDomain', 'Test-AzCdnAfdProfileHostNameAvailability', 'Test-AzCdnEndpointCustomDomain', 'Test-AzCdnEndpointNameAvailability', 'Test-AzCdnNameAvailability', 'Test-AzCdnProbe', 'Update-AzCdnAfdCustomDomain', 'Update-AzCdnAfdCustomDomainValidationToken', 'Update-AzCdnAfdEndpoint', 'Update-AzCdnAfdOrigin', 'Update-AzCdnAfdOriginGroup', 'Update-AzCdnEndpoint', 'Update-AzCdnOrigin', 'Update-AzCdnOriginGroup', 'Update-AzCdnPolicy', 'Update-AzCdnRoute', 'Update-AzCdnRule', 'Update-AzCdnSecurityPolicy', 'Update-AzFrontDoorCdnProfile', '*'
1515
AliasesToExport = '*'
1616
PrivateData = @{
1717
PSData = @{
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
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+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
14+
# is regenerated.
15+
# ----------------------------------------------------------------------------------
16+
17+
<#
18+
.Synopsis
19+
Updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name under the specified subscription and resource group.
20+
.Description
21+
Updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name under the specified subscription and resource group.
22+
.Example
23+
PS C:\> {{ Add code here }}
24+
25+
{{ Add output here }}
26+
.Example
27+
PS C:\> {{ Add code here }}
28+
29+
{{ Add output here }}
30+
31+
.Inputs
32+
Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.ICdnIdentity
33+
.Outputs
34+
Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IProfile
35+
.Notes
36+
COMPLEX PARAMETER PROPERTIES
37+
38+
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
39+
40+
INPUTOBJECT <ICdnIdentity>: Identity Parameter
41+
[CustomDomainName <String>]: Name of the domain under the profile which is unique globally.
42+
[EndpointName <String>]: Name of the endpoint under the profile which is unique globally.
43+
[Id <String>]: Resource identity path
44+
[OriginGroupName <String>]: Name of the origin group which is unique within the endpoint.
45+
[OriginName <String>]: Name of the origin which is unique within the profile.
46+
[PolicyName <String>]: The name of the CdnWebApplicationFirewallPolicy.
47+
[ProfileName <String>]: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group.
48+
[ResourceGroupName <String>]: Name of the Resource group within the Azure subscription.
49+
[RouteName <String>]: Name of the routing rule.
50+
[RuleName <String>]: Name of the delivery rule which is unique within the endpoint.
51+
[RuleSetName <String>]: Name of the rule set under the profile which is unique globally.
52+
[SecretName <String>]: Name of the Secret under the profile.
53+
[SecurityPolicyName <String>]: Name of the security policy under the profile.
54+
[SubscriptionId <String>]: Azure Subscription ID.
55+
.Link
56+
https://docs.microsoft.com/powershell/module/az.cdn/update-azfrontdoorcdnprofile
57+
#>
58+
function Update-AzFrontDoorCdnProfile {
59+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IProfile])]
60+
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
61+
param(
62+
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
63+
[Alias('ProfileName')]
64+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
65+
[System.String]
66+
# Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group.
67+
${Name},
68+
69+
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
70+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
71+
[System.String]
72+
# Name of the Resource group within the Azure subscription.
73+
${ResourceGroupName},
74+
75+
[Parameter(ParameterSetName='UpdateExpanded')]
76+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
77+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
78+
[System.String]
79+
# Azure Subscription ID.
80+
${SubscriptionId},
81+
82+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)]
83+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
84+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.ICdnIdentity]
85+
# Identity Parameter
86+
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
87+
${InputObject},
88+
89+
[Parameter()]
90+
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ManagedServiceIdentityType])]
91+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
92+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ManagedServiceIdentityType]
93+
# Type of managed service identity.
94+
${IdentityType},
95+
96+
[Parameter()]
97+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
98+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IManagedServiceIdentityUserAssignedIdentities]))]
99+
[System.Collections.Hashtable]
100+
# The list of user assigned identities associated with the resource.
101+
# The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
102+
${IdentityUserAssignedIdentity},
103+
104+
[Parameter()]
105+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
106+
[System.Int32]
107+
# Send and receive timeout on forwarding request to the origin.
108+
# When timeout is reached, the request fails and returns.
109+
${OriginResponseTimeoutSecond},
110+
111+
[Parameter()]
112+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
113+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IProfileUpdateParametersTags]))]
114+
[System.Collections.Hashtable]
115+
# Profile tags
116+
${Tag},
117+
118+
[Parameter()]
119+
[Alias('AzureRMContext', 'AzureCredential')]
120+
[ValidateNotNull()]
121+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Azure')]
122+
[System.Management.Automation.PSObject]
123+
# The credentials, account, tenant, and subscription used for communication with Azure.
124+
${DefaultProfile},
125+
126+
[Parameter()]
127+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
128+
[System.Management.Automation.SwitchParameter]
129+
# Run the command as a job
130+
${AsJob},
131+
132+
[Parameter(DontShow)]
133+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
134+
[System.Management.Automation.SwitchParameter]
135+
# Wait for .NET debugger to attach
136+
${Break},
137+
138+
[Parameter(DontShow)]
139+
[ValidateNotNull()]
140+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
141+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.SendAsyncStep[]]
142+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
143+
${HttpPipelineAppend},
144+
145+
[Parameter(DontShow)]
146+
[ValidateNotNull()]
147+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
148+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.SendAsyncStep[]]
149+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
150+
${HttpPipelinePrepend},
151+
152+
[Parameter()]
153+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
154+
[System.Management.Automation.SwitchParameter]
155+
# Run the command asynchronously
156+
${NoWait},
157+
158+
[Parameter(DontShow)]
159+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
160+
[System.Uri]
161+
# The URI for the proxy server to use
162+
${Proxy},
163+
164+
[Parameter(DontShow)]
165+
[ValidateNotNull()]
166+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
167+
[System.Management.Automation.PSCredential]
168+
# Credentials for a proxy server to use for the remote call
169+
${ProxyCredential},
170+
171+
[Parameter(DontShow)]
172+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
173+
[System.Management.Automation.SwitchParameter]
174+
# Use the default credentials for the proxy
175+
${ProxyUseDefaultCredentials}
176+
)
177+
178+
process {
179+
if ($PSCmdlet.ParameterSetName -eq 'UpdateExpanded') {
180+
$frontDoorCdnProfile = Get-AzFrontDoorCdnProfile -ResourceGroupName ${ResourceGroupName} -Name ${Name}
181+
} elseif ($PSCmdlet.ParameterSetName -eq 'UpdateViaIdentityExpanded') {
182+
$frontDoorCdnProfile = Get-AzFrontDoorCdnProfile -InputObject $InputObject
183+
}else {
184+
throw "Not supported ParameterSetName."
185+
}
186+
187+
if($null -eq $frontDoorCdnProfile)
188+
{
189+
throw "Provided FrontDoorCdnProfile does not exist."
190+
}else{
191+
if(ISFrontDoorCdnProfile($frontDoorCdnProfile.SkuName)){
192+
Az.Cdn.internal\Update-AzCdnProfile @PSBoundParameters
193+
}else{
194+
throw "Provided FrontDoorCdnProfile does not exist."
195+
}
196+
}
197+
}
198+
}
199+

src/Cdn/Cdn.Autorest/docs/Az.Cdn.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,6 @@ Updates an existing delivery rule within a rule set.
292292
### [Update-AzCdnSecurityPolicy](Update-AzCdnSecurityPolicy.md)
293293
Updates an existing security policy within a profile.
294294

295+
### [Update-AzFrontDoorCdnProfile](Update-AzFrontDoorCdnProfile.md)
296+
Updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name under the specified subscription and resource group.
297+

0 commit comments

Comments
 (0)