exports/Get-CVSQLDatabase.ps1


# ----------------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/powershell@4.0.708)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Method to retrieve SQL databases protected within the CommServe.
.Description
This method is implemented with Powershell paging support.
If the Name parameter is not provided, this method will output all protected SQL databases.
If the Name parameter is provided, SQL databases matching the name will be output.
.Example
{{ Add code here }}
.Example
{{ Add code here }}
 
.Inputs
System.Object
.Outputs
System.Management.Automation.PSObject
.Link
https://learn.microsoft.com/powershell/module/commvaultpowershell/get-cvsqldatabase
#>

function Get-CVSQLDatabase {
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(DefaultParameterSetName='Default', PositionalBinding=$false)]
param(
    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [CVSQLDatabaseSortColumn]
    # Sort SQL databases by: bkpTime, bkpSize, insName, dbName, cName, planName.
    ${SortColumn},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Sort SQL databases by specified column in descending order; Default is ascending order.
    ${SortDescending},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Get only SQL databases with missed SLAs.
    ${OnlySLA},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Get SQL databases including system databases.
    ${ShowSysDB},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # Get SQL databases with all properties.
    ${AllProperties},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.UInt64]
    # Gets only the first 'n' objects.
    ${First},

    [Parameter()]
    [Commvault.Powershell.Category('Body')]
    [System.UInt64]
    # Ignores the first 'n' objects and then gets the remaining objects.
    ${Skip},

    [Parameter(ParameterSetName='ByName')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # Get SQL database specified by Name.
    ${Name},

    [Parameter(ParameterSetName='ByName')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # Get SQL databases associated with ClientName.
    ${ClientName},

    [Parameter(ParameterSetName='ByName')]
    [Commvault.Powershell.Category('Body')]
    [System.String]
    # Get SQL databases associated with InstanceName.
    ${InstanceName},

    [Parameter(ParameterSetName='ById')]
    [Commvault.Powershell.Category('Body')]
    [System.Int32]
    # Get SQL database specified by database Id.
    ${Id},

    [Parameter(ParameterSetName='ById')]
    [Commvault.Powershell.Category('Body')]
    [System.Int32]
    # Get SQL databases associated with InstanceId.
    ${InstanceId},

    [Parameter(ParameterSetName='ByObject', ValueFromPipeline, ValueFromPipelineByPropertyName)]
    [Commvault.Powershell.Category('Body')]
    [System.Object]
    # Get SQL databases associated with piped InstanceObject.
    ${InstanceObject}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PSCmdlet.ParameterSetName

        $mapping = @{
            Default = 'CommvaultPowerShell.custom\Get-CVSQLDatabase';
            ByName = 'CommvaultPowerShell.custom\Get-CVSQLDatabase';
            ById = 'CommvaultPowerShell.custom\Get-CVSQLDatabase';
            ByObject = 'CommvaultPowerShell.custom\Get-CVSQLDatabase';
        }
        $cmdInfo = Get-Command -Name $mapping[$parameterSet]
        [Commvault.Powershell.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        [Commvault.Powershell.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
        $scriptCmd = {& $wrappedCmd @PSBoundParameters}
        $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
        $steppablePipeline.Begin($PSCmdlet)
    } catch {

        throw
    }
}

process {
    try {
        $steppablePipeline.Process($_)
    } catch {

        throw
    }

}
end {
    try {
        $steppablePipeline.End()

    } catch {

        throw
    }
} 
}