exports/Enable-NmeConsoleConnectRegion.ps1


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

<#
.Synopsis
Turning on a region takes 25 licenses for that region.\n \nRequest body:\n AllowUninstall (optional) - Whether users can uninstall the Console Connect agent.
Defaults to true if not specified.\n \nThis method can throw exceptions in the following cases:\n The user has not approved the Console Connect agreement.\n The user tries to enable a region that is already enabled.\n Another Console Connect enable/disable job is already waiting or running.\n \nThis method returns a job that performs all actions required to enable\nConsole Connect for the specified region.\n \nYou should wait until the job is completed before working with this region.\nYou also cannot enable or disable Console Connect for any region until the job\nis completed, because this can cause unexpected issues.\n \nFor example, if you want to disable Console Connect for a specific region,\nbut there is already an enable/disable job for this region, you should wait\nuntil that job is completed.\n \nAfter the job is completed, you can check the region status by using the GET method.
.Description
Turning on a region takes 25 licenses for that region.\n \nRequest body:\n AllowUninstall (optional) - Whether users can uninstall the Console Connect agent.
Defaults to true if not specified.\n \nThis method can throw exceptions in the following cases:\n The user has not approved the Console Connect agreement.\n The user tries to enable a region that is already enabled.\n Another Console Connect enable/disable job is already waiting or running.\n \nThis method returns a job that performs all actions required to enable\nConsole Connect for the specified region.\n \nYou should wait until the job is completed before working with this region.\nYou also cannot enable or disable Console Connect for any region until the job\nis completed, because this can cause unexpected issues.\n \nFor example, if you want to disable Console Connect for a specific region,\nbut there is already an enable/disable job for this region, you should wait\nuntil that job is completed.\n \nAfter the job is completed, you can check the region status by using the GET method.

#>

function Enable-NmeConsoleConnectRegion {
[OutputType([NmePowershell.Models.IResponseWithJob])]
[CmdletBinding(DefaultParameterSetName='EnableExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
    [Parameter(Mandatory)]
    [NmePowershell.PSArgumentCompleterAttribute("US", "EU", "CA", "AU")]
    [NmePowershell.Category('Path')]
    [System.String]
    # .
    ${Region},

    [Parameter(ParameterSetName='Enable', Mandatory, ValueFromPipeline)]
    [NmePowershell.Category('Body')]
    [NmePowershell.Models.IConsoleConnectRegionEnable]
    # .
    ${Body},

    [Parameter(ParameterSetName='EnableExpanded')]
    [NmePowershell.Category('Body')]
    [System.Management.Automation.SwitchParameter]
    # .
    ${AllowUninstall},

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

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

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

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

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

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

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PSCmdlet.ParameterSetName
        
        $testPlayback = $false
        $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('NmePowershell.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }

        $mapping = @{
            Enable = 'NerdioManagerPowerShell.private\Enable-NmeConsoleConnectRegion_Enable';
            EnableExpanded = 'NerdioManagerPowerShell.private\Enable-NmeConsoleConnectRegion_EnableExpanded';
        }
        $cmdInfo = Get-Command -Name $mapping[$parameterSet]
        [NmePowershell.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        [NmePowershell.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
        if ($wrappedCmd -eq $null) {
            $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function)
        }
        $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
    }
} 
}