Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/MariaDB/.gitattributes

This file was deleted.

15 changes: 0 additions & 15 deletions src/MariaDB/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion src/MariaDB/Az.MariaDb.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<copyright>Microsoft Corporation. All rights reserved.</copyright>
<tags>Azure ResourceManager ARM PSModule $(service-name)</tags>
<dependencies>
<dependency id="Az.Accounts" version="1.6.0" />
<dependency id="Az.Accounts" version="1.7.2" />
</dependencies>
</metadata>
<files>
Expand Down
2 changes: 1 addition & 1 deletion src/MariaDB/Az.MariaDb.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.MariaDb.private.dll'
FormatsToProcess = './Az.MariaDb.format.ps1xml'
CmdletsToExport = 'Get-AzMariaDbConfiguration', 'Get-AzMariaDbConnectionString', 'Get-AzMariaDbFirewallRule', 'Get-AzMariaDbReplica', 'Get-AzMariaDbServer', 'Get-AzMariaDbVirtualNetworkRule', 'New-AzMariaDbFirewallRule', 'New-AzMariaDbServer', 'New-AzMariaDbServerReplica', 'New-AzMariaDbVirtualNetworkRule', 'Remove-AzMariaDbFirewallRule', 'Remove-AzMariaDbServer', 'Remove-AzMariaDbVirtualNetworkRule', 'Restart-AzMariaDbServer', 'Restore-AzMariaDbServer', 'Update-AzMariaDbConfiguration', 'Update-AzMariaDbFirewallRule', 'Update-AzMariaDbServer', 'Update-AzMariaDbVirtualNetworkRule', '*'
FunctionsToExport = 'Get-AzMariaDbConfiguration', 'Get-AzMariaDbConnectionString', 'Get-AzMariaDbFirewallRule', 'Get-AzMariaDbReplica', 'Get-AzMariaDbServer', 'Get-AzMariaDbVirtualNetworkRule', 'New-AzMariaDbFirewallRule', 'New-AzMariaDbServer', 'New-AzMariaDbServerReplica', 'New-AzMariaDbVirtualNetworkRule', 'Remove-AzMariaDbFirewallRule', 'Remove-AzMariaDbServer', 'Remove-AzMariaDbVirtualNetworkRule', 'Restart-AzMariaDbServer', 'Restore-AzMariaDbServer', 'Update-AzMariaDbConfiguration', 'Update-AzMariaDbFirewallRule', 'Update-AzMariaDbServer', 'Update-AzMariaDbVirtualNetworkRule', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Expand Down
10 changes: 5 additions & 5 deletions src/MariaDB/Az.MariaDb.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
}
}
if(-not $accountsModule) {
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.6.0' } | Measure-Object).Count -gt 0
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.2' } | Measure-Object).Count -gt 0
if($hasAdequateVersion) {
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.6.0 -Scope Global -PassThru
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.2 -Scope Global -PassThru
}
}
}

if(-not $accountsModule) {
Write-Error "`nThis module requires $accountsName version 1.6.0 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'1.6.0') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 1.6.0 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. 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
Write-Error "`nThis module requires $accountsName version 1.7.2 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'1.7.2') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 1.7.2 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
}
Write-Information "Loaded Module '$($accountsModule.Name)'"

Expand Down
2 changes: 1 addition & 1 deletion src/MariaDB/check-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if(Test-Path -Path $localModulesPath) {
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
}

DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.6.0'
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.7.2'
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -versionMinimum ''

$tools = Join-Path $PSScriptRoot 'tools'
Expand Down
2 changes: 1 addition & 1 deletion src/MariaDB/custom/Get-AzMariaDBConnectionString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Get-AzMariaDbConnectionString {
# You can obtain this value from the Azure Resource Manager API or the portal.
${ResourceGroupName},

[Parameter(HelpMessage='The subscription ID is part of the URI for every service call')]
[Parameter(ParameterSetName='ServerName', HelpMessage='The subscription ID is part of the URI for every service call')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
Expand Down
6 changes: 3 additions & 3 deletions src/MariaDB/custom/New-AzMariaDBServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ function New-AzMariaDbServer {
$null = $PSBoundParameters.Remove('StorageProfileStorageAutogrow')
}

if ($PSBoundParameters.ContainsKey('StorageProfileStorageMb')) {
$Parameter.StorageProfileStorageMb = $PSBoundParameters['StorageProfileStorageMb']
$null = $PSBoundParameters.Remove('StorageProfileStorageMb')
if ($PSBoundParameters.ContainsKey('StorageProfileStorageInMb')) {
$Parameter.StorageProfileStorageMb = $PSBoundParameters['StorageProfileStorageInMb']
$null = $PSBoundParameters.Remove('StorageProfileStorageInMb')
}

if ($PSBoundParameters.ContainsKey('Tag')) {
Expand Down
21 changes: 13 additions & 8 deletions src/MariaDB/custom/New-AzMariaDbServerReplica.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function New-AzMariaDbServerReplica {

[Parameter(ParameterSetName='ServerObject', Mandatory, ValueFromPipeline, HelpMessage='The source server object to restore from.')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.IMariaDbIdentity]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.IServer]
# The source server object to restore from.
${InputObject},

Expand Down Expand Up @@ -138,27 +138,32 @@ function New-AzMariaDbServerReplica {
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.ServerPropertiesForReplica]::new()

#region ServerForCreate
if ($PSBoundParameters.ContainsKey('InputObject')) {
$Null = $PSBoundParameters.Remove('InputObject')
$ServerObject = $InputObject
if (-not $PSBoundParameters.ContainsKey('InputObject')) {
$ServerObject = Get-AzMariaDbServer -ResourceGroupName $ResourceGroupName -Name $ServerName
$Null = $PSBoundParameters.Remove('ServerName')
} else {
$InputObject = Get-AzMariaDbServer -ResourceGroupName $ResourceGroupName -Name $ServerName
$Fields = $InputObject.Id.Split('/')
$PSBoundParameters['SubscriptionId'] = $Fields[2]
$PSBoundParameters['ResourceGroupName'] = $Fields[4]
$Null = $PSBoundParameters.Remove('InputObject')
}
$Parameter.Property.SourceServerId = $InputObject.Id
$Parameter.Property.SourceServerId = $ServerObject.Id

if ($PSBoundParameters.ContainsKey('Location')) {
$Parameter.Location = $PSBoundParameters['Location']
$Null = $PSBoundParameters.Remove('Location')
} else {
$Parameter.Location = $InputObject.Location
$Parameter.Location = $ServerObject.Location
}

if ($PSBoundParameters.ContainsKey('Sku')) {
$Parameter.Sku = $PSBoundParameters['Sku']
$PSBoundParameters.SkuName = $PSBoundParameters['Sku']
$Null = $PSBoundParameters.Remove('Sku')
}

if ($PSBoundParameters.ContainsKey('Tag')) {
$Parameter.Tag = $PSBoundParameters['Tag']
$PSBoundParameters.Tag = $PSBoundParameters['Tag']
$Null = $PSBoundParameters.Remove('Tag')
}
#endregion ServerForCreate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
Expand All @@ -11,104 +12,84 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
function Restore-AzMariaDbServerWithGeo
{
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.IServer])]
function Restart-AzMariaDbServer {
[OutputType([System.Boolean])]
[CmdletBinding(DefaultParameterSetName='ServerName', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Profile('latest-2019-04-30')]
param(
[Parameter(ParameterSetName='ServerName', Mandatory, HelpMessage='MariaDb server name.')]
[Parameter(ParameterSetName='ServerName', Mandatory)]
[Alias('ServerName')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[System.String]
# MariaDb server name.
# The name of the server.
${Name},

[Parameter(ParameterSetName='ServerObject', Mandatory, ValueFromPipeline, HelpMessage='The source server object to restore from.')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.IServer]
# The source server object to restore from.
${InputObject},

[Parameter(ParameterSetName='ServerName', Mandatory, HelpMessage='You can obtain this value from the Azure Resource Manager API or the portal.')]
[Parameter(ParameterSetName='ServerName', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[System.String]
# The name of the resource group that contains the resource.
# You can obtain this value from the Azure Resource Manager API or the portal.
${ResourceGroupName},

[Parameter(HelpMessage='The subscription ID is part of the URI for every service call.')]
[Parameter(ParameterSetName='ServerName')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Gets the subscription Id which uniquely identifies the Microsoft Azure subscription.
# The subscription ID is part of the URI for every service call.
# The subscription ID that identifies an Azure subscription.
${SubscriptionId},

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

[Parameter(HelpMessage='The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Body')]
[System.String]
# The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.
${SkuName},

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

#region GeoRestore
#endregion

#region DefaultParameters
[Parameter(ParameterSetName='ServerObject', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.IMariaDbIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

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

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

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

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

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

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


[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Returns true when the command succeeds
${PassThru},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Category('Runtime')]
[System.Uri]
Expand All @@ -127,44 +108,22 @@ function Restore-AzMariaDbServerWithGeo
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
#endregion DefaultParameters
)

process {
try {
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.ServerForCreate]::new()
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.MariaDb.Models.Api20180601Preview.ServerPropertiesForGeoRestore]::new()

#region ServerForCreate
if ($PSBoundParameters.ContainsKey('Location')) {
$Parameter.Location = $PSBoundParameters['Location']
$Null = $PSBoundParameters.Remove('Location')
} else {
if ($PSBoundParameters.ContainsKey('SourceServerId')) {
$Parameter.Property.SourceServerId = $PSBoundParameters['SourceServerId']

$FieldList = $PSBoundParameters['SourceServerId'].Split('/')
$InputObject = Get-AzMariadbServer -ResourceGroupName $FieldList[4] -ServerName $FieldList[8]
$Null = $PSBoundParameters.Remove('SourceServerId')
}
if ($PSBoundParameters.ContainsKey('InputObject')) {
$Parameter.Property.SourceServerId = $InputObject.Id
$Null = $PSBoundParameters.Remove('InputObject')
}
$Parameter.Location = $InputObject.Location
}

if ($PSBoundParameters.ContainsKey('SkuName')) {
$Parameter.SkuName = $PSBoundParameters['SkuName']
$PSBoundParameters.Remove('SkuName')
if ($PSBoundParameters.ContainsKey('InputObject')) {
$Fields = $InputObject.Id.Split('/')
$PSBoundParameters.Add('SubscriptionId', $Fields[2])
$PSBoundParameters.Add('ResourceGroupName', $Fields[4])
$PSBoundParameters.Add('Name', $Fields[8])
$Null = $PSBoundParameters.Remove('InputObject')
}
#endregion ServerForCreate

$PSBoundParameters.Add('Parameter', $Parameter)

Az.MariaDb.internal\New-AzMariaDbServer @PSBoundParameters
Az.MariaDb.internal\Restart-AzMariaDbServer @PSBoundParameters
} catch {
throw
}
}
}

Loading