Skip to content

Commit dc2a904

Browse files
author
Chenglong Liu
committed
Add Cdn profile command and test
1 parent 411a00f commit dc2a904

16 files changed

+1613
-20
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-AzCdnEndpointContent', 'Clear-AzFrontDoorCdnEndpointContent', 'Disable-AzCdnCustomDomainCustomHttps', 'Enable-AzCdnCustomDomainCustomHttps', '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-AzFrontDoorCdnCustomDomain', 'Get-AzFrontDoorCdnEndpoint', 'Get-AzFrontDoorCdnEndpointResourceUsage', 'Get-AzFrontDoorCdnOrigin', 'Get-AzFrontDoorCdnOriginGroup', 'Get-AzFrontDoorCdnOriginGroupResourceUsage', 'Get-AzFrontDoorCdnProfile', 'Get-AzFrontDoorCdnProfileResourceUsage', 'Import-AzCdnEndpointContent', 'Invoke-AzCdnSecretValidate', 'New-AzCdnCustomDomain', 'New-AzCdnEndpoint', 'New-AzCdnOrigin', 'New-AzCdnOriginGroup', 'New-AzCdnPolicy', 'New-AzCdnProfileSsoUri', 'New-AzCdnRoute', 'New-AzCdnRule', 'New-AzCdnSecret', 'New-AzCdnSecurityPolicy', 'New-AzFrontDoorCdnCustomDomain', 'New-AzFrontDoorCdnEndpoint', 'New-AzFrontDoorCdnOrigin', 'New-AzFrontDoorCdnOriginGroup', 'New-AzFrontDoorCdnProfile', 'Remove-AzCdnCustomDomain', 'Remove-AzCdnEndpoint', 'Remove-AzCdnOrigin', 'Remove-AzCdnOriginGroup', 'Remove-AzCdnPolicy', 'Remove-AzCdnRoute', 'Remove-AzCdnRule', 'Remove-AzCdnRuleSet', 'Remove-AzCdnSecret', 'Remove-AzCdnSecurityPolicy', 'Remove-AzFrontDoorCdnCustomDomain', 'Remove-AzFrontDoorCdnEndpoint', 'Remove-AzFrontDoorCdnOrigin', 'Remove-AzFrontDoorCdnOriginGroup', 'Remove-AzFrontDoorCdnProfile', 'Start-AzCdnEndpoint', 'Stop-AzCdnEndpoint', 'Test-AzCdnEndpointCustomDomain', 'Test-AzCdnEndpointNameAvailability', 'Test-AzCdnNameAvailability', 'Test-AzCdnProbe', 'Test-AzFrontDoorCdnEndpointCustomDomain', 'Test-AzFrontDoorCdnProfileHostNameAvailability', 'Update-AzCdnEndpoint', 'Update-AzCdnOrigin', 'Update-AzCdnOriginGroup', 'Update-AzCdnPolicy', 'Update-AzCdnRoute', 'Update-AzCdnRule', 'Update-AzCdnSecurityPolicy', 'Update-AzFrontDoorCdnCustomDomain', 'Update-AzFrontDoorCdnCustomDomainValidationToken', 'Update-AzFrontDoorCdnEndpoint', 'Update-AzFrontDoorCdnOrigin', 'Update-AzFrontDoorCdnOriginGroup', 'Update-AzFrontDoorCdnProfile', '*'
14+
FunctionsToExport = 'Clear-AzCdnEndpointContent', 'Clear-AzFrontDoorCdnEndpointContent', 'Disable-AzCdnCustomDomainCustomHttps', 'Enable-AzCdnCustomDomainCustomHttps', '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-AzFrontDoorCdnCustomDomain', 'Get-AzFrontDoorCdnEndpoint', 'Get-AzFrontDoorCdnEndpointResourceUsage', 'Get-AzFrontDoorCdnOrigin', 'Get-AzFrontDoorCdnOriginGroup', 'Get-AzFrontDoorCdnOriginGroupResourceUsage', 'Get-AzFrontDoorCdnProfile', 'Get-AzFrontDoorCdnProfileResourceUsage', 'Import-AzCdnEndpointContent', 'Invoke-AzCdnSecretValidate', 'New-AzCdnCustomDomain', 'New-AzCdnEndpoint', 'New-AzCdnOrigin', 'New-AzCdnOriginGroup', 'New-AzCdnPolicy', 'New-AzCdnProfile', 'New-AzCdnProfileSsoUri', 'New-AzCdnRoute', 'New-AzCdnRule', 'New-AzCdnSecret', 'New-AzCdnSecurityPolicy', 'New-AzFrontDoorCdnCustomDomain', 'New-AzFrontDoorCdnEndpoint', 'New-AzFrontDoorCdnOrigin', 'New-AzFrontDoorCdnOriginGroup', 'New-AzFrontDoorCdnProfile', 'Remove-AzCdnCustomDomain', 'Remove-AzCdnEndpoint', 'Remove-AzCdnOrigin', 'Remove-AzCdnOriginGroup', 'Remove-AzCdnPolicy', 'Remove-AzCdnProfile', 'Remove-AzCdnRoute', 'Remove-AzCdnRule', 'Remove-AzCdnRuleSet', 'Remove-AzCdnSecret', 'Remove-AzCdnSecurityPolicy', 'Remove-AzFrontDoorCdnCustomDomain', 'Remove-AzFrontDoorCdnEndpoint', 'Remove-AzFrontDoorCdnOrigin', 'Remove-AzFrontDoorCdnOriginGroup', 'Remove-AzFrontDoorCdnProfile', 'Start-AzCdnEndpoint', 'Stop-AzCdnEndpoint', 'Test-AzCdnEndpointCustomDomain', 'Test-AzCdnEndpointNameAvailability', 'Test-AzCdnNameAvailability', 'Test-AzCdnProbe', 'Test-AzFrontDoorCdnEndpointCustomDomain', 'Test-AzFrontDoorCdnProfileHostNameAvailability', 'Update-AzCdnEndpoint', 'Update-AzCdnOrigin', 'Update-AzCdnOriginGroup', 'Update-AzCdnPolicy', 'Update-AzCdnProfile', 'Update-AzCdnRoute', 'Update-AzCdnRule', 'Update-AzCdnSecurityPolicy', 'Update-AzFrontDoorCdnCustomDomain', 'Update-AzFrontDoorCdnCustomDomainValidationToken', 'Update-AzFrontDoorCdnEndpoint', 'Update-AzFrontDoorCdnOrigin', 'Update-AzFrontDoorCdnOriginGroup', 'Update-AzFrontDoorCdnProfile', '*'
1515
AliasesToExport = '*'
1616
PrivateData = @{
1717
PSData = @{
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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+
Creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a profile name under the specified subscription and resource group.
20+
.Description
21+
Creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a 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+
.Outputs
32+
Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IProfile
33+
.Link
34+
https://docs.microsoft.com/powershell/module/az.cdn/new-azcdnprofile
35+
#>
36+
function New-AzCdnProfile {
37+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IProfile])]
38+
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
39+
param(
40+
[Parameter(Mandatory)]
41+
[Alias('ProfileName')]
42+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
43+
[System.String]
44+
# Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group.
45+
${Name},
46+
47+
[Parameter(Mandatory)]
48+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
49+
[System.String]
50+
# Name of the Resource group within the Azure subscription.
51+
${ResourceGroupName},
52+
53+
[Parameter()]
54+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Path')]
55+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
56+
[System.String]
57+
# Azure Subscription ID.
58+
${SubscriptionId},
59+
60+
[Parameter(Mandatory)]
61+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
62+
[System.String]
63+
# Resource location.
64+
${Location},
65+
66+
[Parameter()]
67+
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ManagedServiceIdentityType])]
68+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
69+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ManagedServiceIdentityType]
70+
# Type of managed service identity.
71+
${IdentityType},
72+
73+
[Parameter()]
74+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
75+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.IManagedServiceIdentityUserAssignedIdentities]))]
76+
[System.Collections.Hashtable]
77+
# The list of user assigned identities associated with the resource.
78+
# The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}
79+
${IdentityUserAssignedIdentity},
80+
81+
[Parameter()]
82+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
83+
[System.Int32]
84+
# Send and receive timeout on forwarding request to the origin.
85+
# When timeout is reached, the request fails and returns.
86+
${OriginResponseTimeoutSecond},
87+
88+
[Parameter()]
89+
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.SkuName])]
90+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
91+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.SkuName]
92+
# Name of the pricing tier.
93+
${SkuName},
94+
95+
[Parameter()]
96+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')]
97+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.ITrackedResourceTags]))]
98+
[System.Collections.Hashtable]
99+
# Resource tags.
100+
${Tag},
101+
102+
[Parameter()]
103+
[Alias('AzureRMContext', 'AzureCredential')]
104+
[ValidateNotNull()]
105+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Azure')]
106+
[System.Management.Automation.PSObject]
107+
# The credentials, account, tenant, and subscription used for communication with Azure.
108+
${DefaultProfile},
109+
110+
[Parameter()]
111+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
112+
[System.Management.Automation.SwitchParameter]
113+
# Run the command as a job
114+
${AsJob},
115+
116+
[Parameter(DontShow)]
117+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
118+
[System.Management.Automation.SwitchParameter]
119+
# Wait for .NET debugger to attach
120+
${Break},
121+
122+
[Parameter(DontShow)]
123+
[ValidateNotNull()]
124+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
125+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.SendAsyncStep[]]
126+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
127+
${HttpPipelineAppend},
128+
129+
[Parameter(DontShow)]
130+
[ValidateNotNull()]
131+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
132+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Runtime.SendAsyncStep[]]
133+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
134+
${HttpPipelinePrepend},
135+
136+
[Parameter()]
137+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
138+
[System.Management.Automation.SwitchParameter]
139+
# Run the command asynchronously
140+
${NoWait},
141+
142+
[Parameter(DontShow)]
143+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
144+
[System.Uri]
145+
# The URI for the proxy server to use
146+
${Proxy},
147+
148+
[Parameter(DontShow)]
149+
[ValidateNotNull()]
150+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
151+
[System.Management.Automation.PSCredential]
152+
# Credentials for a proxy server to use for the remote call
153+
${ProxyCredential},
154+
155+
[Parameter(DontShow)]
156+
[Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Runtime')]
157+
[System.Management.Automation.SwitchParameter]
158+
# Use the default credentials for the proxy
159+
${ProxyUseDefaultCredentials}
160+
)
161+
162+
if(-Not (ISFrontDoorCdnProfile($PSBoundParameters['SkuName']))){
163+
Az.Cdn.internal\New-AzCdnProfile @PSBoundParameters
164+
}else{
165+
throw "$($PSBoundParameters['SkuName']) is not a valid SKU. Please use a valid AzureCDN SkuName.";
166+
}
167+
}
168+

0 commit comments

Comments
 (0)