Skip to content

Commit b81de1a

Browse files
authored
Merge modification of Az.MySql in generation to master (#12653)
1 parent e9aed41 commit b81de1a

File tree

128 files changed

+6528
-4354
lines changed

Some content is hidden

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

128 files changed

+6528
-4354
lines changed

src/MySql/Az.MySql.format.ps1xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,6 @@
648648
<TableColumnHeader>
649649
<Label>SkuName</Label>
650650
</TableColumnHeader>
651-
<TableColumnHeader>
652-
<Label>SkuSize</Label>
653-
</TableColumnHeader>
654651
<TableColumnHeader>
655652
<Label>SkuTier</Label>
656653
</TableColumnHeader>
@@ -679,9 +676,6 @@
679676
<TableColumnItem>
680677
<PropertyName>SkuName</PropertyName>
681678
</TableColumnItem>
682-
<TableColumnItem>
683-
<PropertyName>SkuSize</PropertyName>
684-
</TableColumnItem>
685679
<TableColumnItem>
686680
<PropertyName>SkuTier</PropertyName>
687681
</TableColumnItem>

src/MySql/Az.MySql.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 5/9/2020
6+
# Generated on: 8/12/2020
77
#
88

99
@{
@@ -72,7 +72,7 @@ FormatsToProcess = './Az.MySql.format.ps1xml'
7272
FunctionsToExport = 'Get-AzMySqlConfiguration', 'Get-AzMySqlConnectionString',
7373
'Get-AzMySqlFirewallRule', 'Get-AzMySqlReplica', 'Get-AzMySqlServer',
7474
'Get-AzMySqlVirtualNetworkRule', 'New-AzMySqlFirewallRule',
75-
'New-AzMySqlServer', 'New-AzMySqlServerReplica',
75+
'New-AzMySqlReplica', 'New-AzMySqlServer',
7676
'New-AzMySqlVirtualNetworkRule', 'Remove-AzMySqlFirewallRule',
7777
'Remove-AzMySqlServer', 'Remove-AzMySqlVirtualNetworkRule',
7878
'Restart-AzMySqlServer', 'Restore-AzMySqlServer',
@@ -115,7 +115,7 @@ PrivateData = @{
115115
# IconUri = ''
116116

117117
# ReleaseNotes of this module
118-
ReleaseNotes = '* the first preview release'
118+
# ReleaseNotes = ''
119119

120120
# Prerelease string of this module
121121
# Prerelease = ''

src/MySql/Az.MySql.psm1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616
$accountsName = 'Az.Accounts'
1717
$accountsModule = Get-Module -Name $accountsName
1818
if(-not $accountsModule) {
19-
$localAccountsPath = Join-Path $PSScriptRoot 'generated/modules'
19+
$localAccountsPath = Join-Path $PSScriptRoot 'generated\modules'
2020
if(Test-Path -Path $localAccountsPath) {
2121
$localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1
2222
if($localAccounts) {
2323
$accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru
2424
}
2525
}
2626
if(-not $accountsModule) {
27-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0
27+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.8.1' } | Measure-Object).Count -gt 0
2828
if($hasAdequateVersion) {
29-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru
29+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.8.1 -Scope Global -PassThru
3030
}
3131
}
3232
}
3333

3434
if(-not $accountsModule) {
35-
Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36-
} elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) {
37-
Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
35+
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36+
} elseif (($accountsModule.Version -lt [System.Version]'1.8.1') -and (-not $localAccounts)) {
37+
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3838
}
3939
Write-Information "Loaded Module '$($accountsModule.Name)'"
4040

src/MySql/ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Remove legacy SkuSize from input and output (#11725)
22+
* Specify a default name when create MySql firewall rule without name and add AllowAll mode (#11932)
23+
* Enable EndIpAddress to be absent if only one IP to be authorized in firewall rule (#11933)
24+
* Add validateset for parameter StorageAutogrow (#11936)
25+
* Rename New-AzMySqlServerReplica to New-AzMySqlReplica (#11938)
26+
* Use 'master' and 'replica' to avoid confusion when create mysql replica server (#11939)
27+
* Provide hint in doc to use Update-AzMySqlServer & Update-AzMySqlServerConfiguration as a candidate for each other (#11954)
2128

2229
## Version 0.1.0
2330
* the first preview release

src/MySql/build-module.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ if(-not $Debugger) {
8888
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release')
8989
}
9090

91-
$dll = Join-Path $PSScriptRoot 'bin/Az.MySql.private.dll'
91+
$dll = Join-Path $PSScriptRoot 'bin\Az.MySql.private.dll'
9292
if(-not (Test-Path $dll)) {
9393
Write-Error "Unable to find output assembly in '$binFolder'."
9494
}
@@ -97,7 +97,7 @@ if(-not (Test-Path $dll)) {
9797
$null = Import-Module -Name $dll
9898

9999
$modulePaths = $dll
100-
$customPsm1 = Join-Path $PSScriptRoot 'custom/Az.MySql.custom.psm1'
100+
$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.MySql.custom.psm1'
101101
if(Test-Path $customPsm1) {
102102
$modulePaths = @($dll, $customPsm1)
103103
}

src/MySql/check-dependencies.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ if(-not $Isolated) {
2121
return
2222
}
2323

24-
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum) {
24+
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
2525
if($predicate) {
2626
$module = Get-Module -ListAvailable -Name $moduleName
2727
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
2828
$null = New-Item -ItemType Directory -Force -Path $path
2929
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
30-
if($versionMinimum) {
30+
if ($requiredVersion) {
31+
Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path
32+
}elseif($versionMinimum) {
3133
Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path
3234
} else {
3335
Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path
@@ -39,13 +41,13 @@ function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [
3941
$ProgressPreference = 'SilentlyContinue'
4042
$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1
4143

42-
$localModulesPath = Join-Path $PSScriptRoot 'generated/modules'
44+
$localModulesPath = Join-Path $PSScriptRoot 'generated\modules'
4345
if(Test-Path -Path $localModulesPath) {
4446
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4547
}
4648

47-
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.7.4'
48-
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -versionMinimum ''
49+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.8.1'
50+
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
4951

5052
$tools = Join-Path $PSScriptRoot 'tools'
5153
$resourceDir = Join-Path $tools 'Resources'

src/MySql/custom/Az.MySql.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.MySql.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.MySql.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.MySql.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.MySql.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
16+
<#
17+
.Synopsis
18+
Creates a new firewall rule or updates an existing firewall rule.
19+
.Description
20+
Creates a new firewall rule or updates an existing firewall rule.
21+
#>
22+
function New-AzMySqlFirewallRule {
23+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IFirewallRule])]
24+
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
25+
param(
26+
[Parameter()]
27+
[Alias('FirewallRuleName')]
28+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
29+
[System.String]
30+
# The name of the server firewall rule.
31+
# If not specified, the default is undefined.
32+
# If AllowAll is present, the default name is AllowAll_yyyy-MM-dd_HH-mm-ss.
33+
${Name},
34+
35+
[Parameter(Mandatory)]
36+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
37+
[System.String]
38+
# The name of the resource group.
39+
# The name is case insensitive.
40+
${ResourceGroupName},
41+
42+
[Parameter(Mandatory)]
43+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
44+
[System.String]
45+
# The name of the server.
46+
${ServerName},
47+
48+
[Parameter()]
49+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
50+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
51+
[System.String]
52+
# The ID of the target subscription.
53+
${SubscriptionId},
54+
55+
[Parameter(ParameterSetName='CreateExpanded')]
56+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
57+
[System.String]
58+
# The end IP address of the server firewall rule.
59+
# Must be IPv4 format.
60+
${EndIPAddress},
61+
62+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
63+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
64+
[System.String]
65+
# The start IP address of the server firewall rule.
66+
# Must be IPv4 format.
67+
# If range contains one IP, use StartIPAddress only.
68+
${StartIPAddress},
69+
70+
[Parameter(ParameterSetName='AllowAll', Mandatory)]
71+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
72+
[System.Management.Automation.SwitchParameter]
73+
# Present to allow all range IPs, from 0.0.0.0 to 255.255.255.255.
74+
${AllowAll},
75+
76+
[Parameter()]
77+
[Alias('AzureRMContext', 'AzureCredential')]
78+
[ValidateNotNull()]
79+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Azure')]
80+
[System.Management.Automation.PSObject]
81+
# The credentials, account, tenant, and subscription used for communication with Azure.
82+
${DefaultProfile},
83+
84+
[Parameter()]
85+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
86+
[System.Management.Automation.SwitchParameter]
87+
# Run the command as a job
88+
${AsJob},
89+
90+
[Parameter(DontShow)]
91+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
92+
[System.Management.Automation.SwitchParameter]
93+
# Wait for .NET debugger to attach
94+
${Break},
95+
96+
[Parameter(DontShow)]
97+
[ValidateNotNull()]
98+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
99+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]]
100+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
101+
${HttpPipelineAppend},
102+
103+
[Parameter(DontShow)]
104+
[ValidateNotNull()]
105+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
106+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]]
107+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
108+
${HttpPipelinePrepend},
109+
110+
[Parameter()]
111+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
112+
[System.Management.Automation.SwitchParameter]
113+
# Run the command asynchronously
114+
${NoWait},
115+
116+
[Parameter(DontShow)]
117+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
118+
[System.Uri]
119+
# The URI for the proxy server to use
120+
${Proxy},
121+
122+
[Parameter(DontShow)]
123+
[ValidateNotNull()]
124+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
125+
[System.Management.Automation.PSCredential]
126+
# Credentials for a proxy server to use for the remote call
127+
${ProxyCredential},
128+
129+
[Parameter(DontShow)]
130+
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
131+
[System.Management.Automation.SwitchParameter]
132+
# Use the default credentials for the proxy
133+
${ProxyUseDefaultCredentials}
134+
)
135+
136+
process {
137+
try {
138+
if($PSBoundParameters.ContainsKey('AllowAll'))
139+
{
140+
if(!$PSBoundParameters.ContainsKey('Name'))
141+
{
142+
$PSBoundParameters['Name'] = Get-Date -Format "AllowAll_yyyy-MM-dd_HH-mm-ss"
143+
}
144+
$PSBoundParameters['StartIPAddress'] = "0.0.0.0"
145+
$PSBoundParameters['EndIPAddress'] = "255.255.255.255"
146+
147+
$null = $PSBoundParameters.Remove('AllowAll')
148+
}
149+
else
150+
{
151+
if(!$PSBoundParameters.ContainsKey('Name'))
152+
{
153+
$PSBoundParameters['Name'] = "undefined"
154+
}
155+
if(!$PSBoundParameters.ContainsKey('EndIPAddress'))
156+
{
157+
$PSBoundParameters['EndIPAddress'] = $PSBoundParameters['StartIPAddress']
158+
}
159+
}
160+
161+
Az.MySql.internal\New-AzMySqlFirewallRule @PSBoundParameters
162+
} catch {
163+
throw
164+
}
165+
}
166+
}

src/MySql/custom/New-AzMySqlServerReplica.ps1 renamed to src/MySql/custom/New-AzMySqlReplica.ps1

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
# limitations under the License.
1414
# ----------------------------------------------------------------------------------
1515

16-
function New-AzMySqlServerReplica {
16+
function New-AzMySqlReplica {
1717
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServer])]
1818
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
1919
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Description('Creates a new replica from an existing database.')]
2020
param(
2121
[Parameter(Mandatory, HelpMessage = 'The name of the server.')]
22-
[Alias('ReplicaServerName')]
22+
[Alias('ReplicaServerName', 'Name')]
2323
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
2424
[System.String]
25-
${Name},
25+
${Replica},
2626

2727
[Parameter(Mandatory, HelpMessage = 'The name of the resource group that contains the resource, You can obtain this value from the Azure Resource Manager API or the portal.')]
2828
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
@@ -36,9 +36,10 @@ function New-AzMySqlServerReplica {
3636
${SubscriptionId},
3737

3838
[Parameter(Mandatory, ValueFromPipeline, HelpMessage = 'The source server object to create replica from.')]
39+
[Alias('InputObject')]
3940
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
4041
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServer]
41-
${InputObject},
42+
${Master},
4243

4344
[Parameter(HelpMessage = 'The location the resource resides in.')]
4445
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
@@ -112,10 +113,10 @@ function New-AzMySqlServerReplica {
112113
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.ServerPropertiesForReplica]::new()
113114
$Parameter.CreateMode = [Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.CreateMode]::Replica
114115

115-
$server = $PSBoundParameters['InputObject']
116+
$server = $PSBoundParameters['Master']
116117
$Parameter.Property.SourceServerId = $server.Id
117118
$Parameter.Location = $server.Location
118-
$null = $PSBoundParameters.Remove('InputObject')
119+
$null = $PSBoundParameters.Remove('Master')
119120

120121
if ($PSBoundParameters.ContainsKey('Location')) {
121122
$Parameter.Location = $PSBoundParameters['Location']
@@ -127,6 +128,12 @@ function New-AzMySqlServerReplica {
127128
$null = $PSBoundParameters.Remove('Sku')
128129
}
129130

131+
if ($PSBoundParameters.ContainsKey('Replica'))
132+
{
133+
$PSBoundParameters['Name'] = $PSBoundParameters['Replica']
134+
$null = $PSBoundParameters.Remove('Replica')
135+
}
136+
130137
$PSBoundParameters.Add('Parameter', $Parameter)
131138

132139
Az.MySql.internal\New-AzMySqlServer @PSBoundParameters

src/MySql/custom/New-AzMySqlServer.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function New-AzMySqlServer {
7575

7676
[Parameter(HelpMessage = 'Enable Storage Auto Grow.')]
7777
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.StorageAutogrow])]
78+
[Validateset('Enabled', 'Disabled')]
7879
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
7980
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.StorageAutogrow]
8081
${StorageAutogrow},

0 commit comments

Comments
 (0)