CancelApi.ps1


Class CancelApi : ApiClient
{
    # Default constructor
    CancelApi([hashtable]$values) : base ($values) {}

    # POST ProcessImage
    [string]CancelJob ([string]$jobId)
    {    
        LogIt "Cancelling Job $jobId" $False

        # Get the URL to use
        $url = $this.BuildJobLeafUrl("$($jobId)/`$cancel")

        # Send the POST
        try {
            $response = Invoke-RestMethod $url -Headers $this.GetAuthHeaders() -Method Post
            $status = $response.status
            return $status
        } catch {
            throw "Failed to cancel job: $_"
        }
    }
}

Function New-CancelApi {
    return [CancelApi]::New()
}