private/steps/Stop-ConfluenceRefresh.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Stop-ConfluenceRefresh {
    [CmdletBinding()]
    param (
        # Id of the refresh batch to end
        [Parameter(Mandatory, Position=0)]
        [int]
        $RefreshId,

        # The sql instance to update data in
        [Parameter(Mandatory,Position=1)]
        [string]
        $SqlInstance,

        # The sql database to update data in
        [Parameter(Mandatory,Position=2)]
        [string]
        $SqlDatabase,

        # Indicates whether the job succeeded or failed
        [Parameter(Mandatory,Position=3)]
        [bool]
        $Success
    )
    
    begin {
        Write-Verbose "Recording Confluence Refresh end (RefreshID: $RefreshId)"
    }
    
    process {
        #magic numbers, bad developer
        $status = IIF $Success 'C' 'A'
        Invoke-SqlCmd -ServerInstance $SqlInstance -Database $SqlDatabase -Query "EXEC dbo.usp_Confluence_Refresh_Update_End $RefreshId, '$status'"
    }
    
    end {
    }
}