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

First version of MySql flexible server cmdlets #13622

Merged
merged 2 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,184 changes: 1,120 additions & 64 deletions src/MySql/Az.MySql.format.ps1xml

Large diffs are not rendered by default.

45 changes: 27 additions & 18 deletions src/MySql/Az.MySql.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 8/21/2020
# Generated on: 12/1/2020
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = './Az.MySql.psm1'

# Version number of this module.
ModuleVersion = '0.2.0'
ModuleVersion = '0.1.0'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down Expand Up @@ -63,21 +63,36 @@ RequiredAssemblies = './bin/Az.MySql.private.dll'
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Az.MySql.format.ps1xml'
FormatsToProcess = 'Az.MySql.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-AzMySqlConfiguration', 'Get-AzMySqlConnectionString',
'Get-AzMySqlFirewallRule', 'Get-AzMySqlReplica', 'Get-AzMySqlServer',
'Get-AzMySqlVirtualNetworkRule', 'New-AzMySqlFirewallRule',
'New-AzMySqlReplica', 'New-AzMySqlServer',
'New-AzMySqlVirtualNetworkRule', 'Remove-AzMySqlFirewallRule',
'Remove-AzMySqlServer', 'Remove-AzMySqlVirtualNetworkRule',
'Restart-AzMySqlServer', 'Restore-AzMySqlServer',
'Update-AzMySqlConfiguration', 'Update-AzMySqlFirewallRule',
'Update-AzMySqlServer', 'Update-AzMySqlVirtualNetworkRule'
'Get-AzMySqlFirewallRule', 'Get-AzMySqlFlexibleServer',
'Get-AzMySqlFlexibleServerConfiguration',
'Get-AzMySqlFlexibleServerDatabase',
'Get-AzMySqlFlexibleServerFirewallRule',
'Get-AzMySqlFlexibleServerReplica', 'Get-AzMySqlReplica',
'Get-AzMySqlServer', 'Get-AzMySqlVirtualNetworkRule',
'New-AzMySqlFirewallRule', 'New-AzMySqlFlexibleServer',
'New-AzMySqlFlexibleServerDatabase',
'New-AzMySqlFlexibleServerFirewallRule',
'New-AzMySqlFlexibleServerReplica', 'New-AzMySqlReplica',
'New-AzMySqlServer', 'New-AzMySqlVirtualNetworkRule',
'Remove-AzMySqlFirewallRule', 'Remove-AzMySqlFlexibleServer',
'Remove-AzMySqlFlexibleServerDatabase',
'Remove-AzMySqlFlexibleServerFirewallRule', 'Remove-AzMySqlServer',
'Remove-AzMySqlVirtualNetworkRule', 'Restart-AzMySqlFlexibleServer',
'Restart-AzMySqlServer', 'Restore-AzMySqlFlexibleServer',
'Restore-AzMySqlServer', 'Start-AzMySqlFlexibleServer',
'Stop-AzMySqlFlexibleServer', 'Update-AzMySqlConfiguration',
'Update-AzMySqlFirewallRule', 'Update-AzMySqlFlexibleServer',
'Update-AzMySqlFlexibleServerConfiguration',
'Update-AzMySqlFlexibleServerDatabase',
'Update-AzMySqlFlexibleServerFirewallRule', 'Update-AzMySqlServer',
'Update-AzMySqlVirtualNetworkRule'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down Expand Up @@ -115,13 +130,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Removed legacy SkuSize from input and output (#11725)
* Added AllowAll & ClientIpAddress Modes to firewall rule cmdlets (#11932)
* specified a default name when created MySql firewall rule without a name (#11932)
* Added validateset for parameter StorageAutogrow (#11936)
* Renamed New-AzMySqlServerReplica to New-AzMySqlReplica (#11938)
* Used ''master'' and ''replica'' to avoid confusion when created mysql replica server (#11939)
* Provided hint in doc to use Update-AzMySqlServer & Update-AzMySqlServerConfiguration as a candidate for each other (#11954)'
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''
Expand Down
1 change: 1 addition & 0 deletions src/MySql/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added MySql flexible server cmdlets

## Version 0.2.0
* Removed legacy SkuSize from input and output (#11725)
Expand Down
206 changes: 206 additions & 0 deletions src/MySql/custom/New-AzMySqlFlexibleServer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@

# ----------------------------------------------------------------------------------
#
# 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.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Creates a new MySQL flexible server
.Description
Creates a new MySQL flexible server
#>
function New-AzMySqlFlexibleServer {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20200701Preview.IServerAutoGenerated])]
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Description('Creates a new server.')]
param(
[Parameter(Mandatory, HelpMessage = 'The name of the server.')]
[Alias('ServerName')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
[System.String]
${Name},

[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.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
[System.String]
${ResourceGroupName},

[Parameter(HelpMessage='The subscription ID that identifies an Azure subscription.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
${SubscriptionId},

[Parameter(HelpMessage = 'The location the resource resides in.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.String]
${Location},

[Parameter(Mandatory, HelpMessage = 'Administrator username for the server. Once set, it cannot be changed.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.String]
${AdministratorUserName},

[Parameter(Mandatory, HelpMessage = 'The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.Security.SecureString]
[ValidateNotNullOrEmpty()]
${AdministratorLoginPassword},

[Parameter(HelpMessage = 'The name of the sku, typically, tier + family + cores, e.g. Standard_B1ms, Standard_D2ds_v4.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.String]
${Sku},

[Parameter(HelpMessage = 'Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized. Default: Burstable.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.String]
${SkuTier},

[Parameter(HelpMessage = "Backup retention days for the server. Day count is between 7 and 35.")]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.Int32]
${BackupRetentionDay},

[Parameter(HelpMessage = 'Max storage allowed for a server.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[System.Int32]
${StorageInMb},

[Parameter(HelpMessage = 'Application-specific metadata in the form of key-value pairs.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServerForCreateTags]))]
[System.Collections.Hashtable]
${Tag},

[Parameter(HelpMessage = 'Server version.')]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.ServerVersion])]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.ServerVersion]
${Version},

[Parameter(HelpMessage = 'The credentials, account, tenant, and subscription used for communication with Azure.')]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Azure')]
[System.Management.Automation.PSObject]
${DefaultProfile},

[Parameter(HelpMessage = 'Run the command as a job.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
${AsJob},

[Parameter(DontShow, HelpMessage = 'Wait for .NET debugger to attach.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline.
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline.
${HttpPipelinePrepend},

[Parameter(HelpMessage = 'Run the command asynchronously.')]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
${NoWait},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use.
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call.
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy.
${ProxyUseDefaultCredentials}
)

process {
try {
if ($PSBoundParameters.ContainsKey('Name')) {
$PSBoundParameters.ServerName = $PSBoundParameters['Name']
$null = $PSBoundParameters.Remove('Name')
}

if ($PSBoundParameters.ContainsKey('Sku')) {
$PSBoundParameters.SkuName = $PSBoundParameters['Sku']
$null = $PSBoundParameters.Remove('Sku')
}
else {
$PSBoundParameters.SkuName = 'Standard_B1ms'
}

if ($PSBoundParameters.ContainsKey('BackupRetentionDay')) {
$PSBoundParameters.StorageProfileBackupRetentionDay = $PSBoundParameters['BackupRetentionDay']
$null = $PSBoundParameters.Remove('BackupRetentionDay')
}
else {
$PSBoundParameters.StorageProfileBackupRetentionDay = 7
}

if ($PSBoundParameters.ContainsKey('StorageInMb')) {
$PSBoundParameters.StorageProfileStorageMb = $PSBoundParameters['StorageInMb']
$null = $PSBoundParameters.Remove('StorageInMb')
}
else {
$PSBoundParameters.StorageProfileStorageMb = 10240
}

if (!$PSBoundParameters.ContainsKey('Version')) {
$PSBoundParameters.Version = '5.7'
}

if (!$PSBoundParameters.ContainsKey('SkuTier')) {
$PSBoundParameters.SkuTier = 'Burstable'
}

if (!$PSBoundParameters.ContainsKey('Location')) {
$PSBoundParameters.Location = 'westus2'
}

if ($PSBoundParameters.ContainsKey('AdministratorUserName')) {
$PSBoundParameters.AdministratorLogin = $PSBoundParameters['AdministratorUserName']
$null = $PSBoundParameters.Remove('AdministratorUserName')
}

$PSBoundParameters.CreateMode = [Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.CreateMode]::Default
$PSBoundParameters.AdministratorLoginPassword = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['AdministratorLoginPassword']

Az.MySql.internal\New-AzMySqlFlexibleServer @PSBoundParameters
} catch {
throw
}
}
}


Loading