Functions/BuildQueue/Stop-BambooQueuedBuild.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<#
.SYNOPSIS
    Stops and removes a queued build.
.DESCRIPTION
    The cmdlet doesn't return any value about the stop attempt
.PARAMETER BuildKey
    Mandatory - Key for the latest build to be aborted
.EXAMPLE
    Stop-BambooBuild -BuildKey 'PRJ-PLANKEY'
#>

function Stop-BambooQueuedBuild {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidatePattern('\w+-\w+-\d+')]
        [string]$BuildKey
    )
    Invoke-BambooRestMethod -Resource "queue/$BuildKey" -Method Delete
}