Public/Get-RiskSenseExport.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
38
39
40
41
function Get-RiskSenseExport {
    <#
    .SYNOPSIS
        Download a file created by an export job
    .DESCRIPTION
        Download the file created by an export job
        Authority: User, Group Manager, Manager
    .EXAMPLE
        Get-RiskSenseExport -ClientID 1 -ExportID 1 -Token 'secrettoken'
    #>


    [CmdletBinding()]
    param(
        # ClientID
        [Parameter(Mandatory)]
        [int]$ClientID,

        # Export ID
        [Parameter(Mandatory)]
        [int]$ExportID,

        # File to save the export as
        [Parameter(Mandatory)]
        [string]$OutFile,

        # RiskSense API Key
        [Parameter(Mandatory)]
        $Token
    )

    begin {
        $headers = Get-AuthHeader $Token
    }

    process {
        Invoke-RestMethod -Uri "$uri/client/$ClientID/export/$ExportID" -Method Get -OutFile $OutFile -Headers $headers 
    }

    end {}
}