Public/MIT/Get-MITTransferStatus.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function Get-MITTransferStatus
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$false)]
        [int32]$RecentlyCompletedPeriod,

        [Parameter(Mandatory=$false)]
        [int32]$StatusDistributionPeriod,

        [Parameter(Mandatory=$false)]
        [string]$UserLoginName,

        [Parameter(Mandatory=$false)]
        [string]$UserRealName,

        [Parameter(Mandatory=$false)]
        [string]$UserFullName,

        [Parameter(Mandatory=$false)]
        [string]$UserIp,

        [Parameter(Mandatory=$false)]
        [string]$FolderName,

        [Parameter(Mandatory=$false)]
        [string]$FileName,

        #Note - the REST API supports an array (i.e. ?transferStatus=Failed&transferStatus=Active).
        #However, we are using a hashtable to build up the query string by passing the hasttable to
        #the invoke-restmethod -Body parameter, so, we can only supply one transferStatus query
        #parameter.
        [Parameter(Mandatory=$false)]
        [ValidateSet('Failed','Stalled','Active','Completed')]
        [string]$TransferStatus,

        [Parameter(Mandatory=$false)]
        [string]$Search,

        [Parameter(Mandatory=$false,
                    ParameterSetName='List')]
        [int32]$Page,

        [Parameter(Mandatory=$false,
                    ParameterSetName='List')]
        [int32]$PerPage,

        [Parameter(Mandatory=$false,
                    ParameterSetName='List')]
        [ValidateSet('username', 'realname', 'lastLoginStamp', 'email')]
        [string]$SortField,

        [Parameter(Mandatory=$false,
                    ParameterSetName='List')]
        [ValidateSet('ascending', 'descending')]
        [string]$SortDirection
    )

    $query = BuildQueryFromPSBoundParameters($PSBoundParameters)
    $response = Invoke-MITRequest -Resource "xferstatus" -Query $query
    Write-MITOutput -Response $response -Typename "MIREST.MITTransferStatus"

}