exports/Complete-SysManAction.ps1

<#
.Synopsis
Finish an action. When an action is finished the source that finished it will be stored and further calls to any\r\nGetAction method (that accepts a source parameter) will filter out the\r\nall finished actions.
.Description
Finish an action. When an action is finished the source that finished it will be stored and further calls to any\r\nGetAction method (that accepts a source parameter) will filter out the\r\nall finished actions.
.Link
https://docs.microsoft.com/en-us/powershell/module/sysman.webapi/complete-sysmanaction
#>

function Complete-SysManAction {
[OutputType('SysMan.Powershell.Models.IApiErrorMessage')]
[CmdletBinding(DefaultParameterSetName='Finish', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[SysMan.Powershell.Description('Finish an action. When an action is finished the source that finished it will be stored and further calls to any\r\nGetAction method (that accepts a source parameter) will filter out the\r\nall finished actions.')]
param(
    [Parameter(Mandatory, HelpMessage='The id of the finished action')]
    [SysMan.Powershell.Category('Path')]
    [System.Int64]
    ${Id},

    [Parameter(ParameterSetName='Finish', ValueFromPipeline, HelpMessage='The required information to complete an existing action')]
    [SysMan.Powershell.Category('Body')]
    [SysMan.Powershell.Models.IFinishActionV2Command]
    ${Cmd},

    [Parameter(ParameterSetName='FinishExpanded', HelpMessage='The log of the method execution. The recommended format for this text is [VERBOSE]: text or [WARNING]: text or[ERROR]: text')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ExecutionLog},

    [Parameter(ParameterSetName='FinishExpanded', HelpMessage='The status of the execution')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${ExecutionStatus},

    [Parameter(ParameterSetName='FinishExpanded', Mandatory, HelpMessage='Which method that was used when executing the action. Example: Application Installation.')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Method},

    [Parameter(ParameterSetName='FinishExpanded', Mandatory, HelpMessage='The version of the method')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${MethodVersion},

    [Parameter(ParameterSetName='FinishExpanded', Mandatory, HelpMessage='Which external system that executed the action. Example: SysManService')]
    [SysMan.Powershell.Category('Body')]
    [System.String]
    ${Source},

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

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

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

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

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

    [Parameter(DontShow, HelpMessage='Use the default credentials for the proxy')]
    [SysMan.Powershell.Category('Runtime')]
    [System.Management.Automation.SwitchParameter]
    ${ProxyUseDefaultCredentials}
)

begin {
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $parameterSet = $PsCmdlet.ParameterSetName
        $mapping = @{
            Finish = 'SysMan.WebApi.private\Complete-SysManAction_Finish';
            FinishExpanded = 'SysMan.WebApi.private\Complete-SysManAction_FinishExpanded';
        }
        $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
    }
}
}