-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGet-CsAwsAccountInfo.psm1
71 lines (62 loc) · 1.96 KB
/
Get-CsAwsAccountInfo.psm1
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
64
65
66
67
68
69
70
71
function Get-CsAwsAccountInfo {
<#
.SYNOPSIS
Retrieve a set of AWS Accounts by specifying their IDs
.PARAMETER FILTER
The filter expression that should be used to limit the results
.PARAMETER LIMIT
The maximum records to return [default: 500]
.PARAMETER OFFSET
The offset to start retrieving records from [default: 0]
.PARAMETER ALL
Repeat request until all results are returned
.PARAMETER ID
IDs of specific accounts to return
#>
[CmdletBinding(DefaultParameterSetName = 'combined')]
[OutputType([psobject])]
param(
[Parameter(ParameterSetName = 'combined')]
[string]
$Filter,
[Parameter(ParameterSetName = 'combined')]
[ValidateRange(1,500)]
[int]
$Limit = 500,
[Parameter(ParameterSetName = 'combined')]
[int]
$Offset = 0,
[Parameter(ParameterSetName = 'combined')]
[switch]
$All,
[Parameter(ParameterSetName = 'entities', Mandatory = $true)]
[array]
$Id
)
process{
$Param = @{
Uri = '/cloud-connect-aws/combined/accounts/v1?limit=' + [string] $Limit +
'&offset=' + [string] $Offset
Method = 'get'
Header = @{
accept = 'application/json'
'content-type' = 'application/json'
}
}
switch ($PSBoundParameters.Keys) {
'Filter' { $Param.Uri += '&filter=' + $Filter }
'Id' { $Param.Uri = '/cloud-connect-aws/entities/accounts/v1?ids=' }
'Verbose' { $Param['Verbose'] = $true }
'Debug' { $Param['Debug'] = $true }
}
if ($Id) {
Split-CsArray -Activity $MyInvocation.MyCommand.Name -Param $Param -Id $Id
}
elseif ($All) {
Join-CsResult -Activity $MyInvocation.MyCommand.Name -Param $Param
}
else {
Invoke-CsAPI @Param
}
}
}