Public/Access/Stop-SIAAccessRequest.ps1

function Stop-SIAAccessRequest {
    <#
    .SYNOPSIS
        Cancels an open SIA access request.
    .DESCRIPTION
        Cancels a pending or approved access request that has not yet been
        used or has not yet expired.
    .PARAMETER Id
        The access request's ID, as returned by Get-SIAAccessRequest.
    .EXAMPLE
        Stop-SIAAccessRequest -Id 'req-01'

        Cancels the specified access request after confirmation.
    .INPUTS
        psSIA.AccessRequest
    .OUTPUTS
        psSIA.AccessRequest
    .LINK
        https://api-docs.cyberark.com/access-request-api/docs/access-request-api
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    [OutputType('psSIA.AccessRequest')]
    param(
        [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
        [Alias('requestId')]
        [string]$Id
    )

    process {
        if ($PSCmdlet.ShouldProcess($Id, 'Cancel access request')) {
            Invoke-SIARequest -Method POST -Path "/workflows/requests/$Id/cancel" -Service Uar |
                ConvertFrom-SIAResponse -TypeName 'psSIA.AccessRequest'
        }
    }
}