forked from Cephalowat/PSFalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNew-RtrFile.psm1
56 lines (49 loc) · 1.31 KB
/
New-RtrFile.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
function New-RtrFile {
<#
.SYNOPSIS
Upload a new put-file to use for the RTR 'put' command
.PARAMETER PATH
Full path to the file to upload
.PARAMETER DESCRIPTION
File description
.PARAMETER NAME
File name (if different than actual file name)
.PARAMETER COMMENT
The audit log comment
#>
[CmdletBinding()]
[OutputType([psobject])]
param(
[Parameter(Mandatory = $true)]
[string]
$Path,
[Parameter(Mandatory = $true)]
[string]
$Description,
[string]
$Name,
[string]
$Comment
)
process{
$Param = @{
Uri = '/real-time-response/entities/put-files/v1'
Method = 'post'
Header = @{
accept = 'application/json'
'content-type' = 'multipart/form-data'
}
Form = @{
file = (Get-Item -Path $Path)
description = $Description
}
}
switch ($PSBoundParameters.Keys) {
'Name' { $Param.Form['name'] = $Name }
'Comment' { $Param.Form['comments_for_audit_log'] = $Comment }
'Verbose' { $Param['Verbose'] = $true }
'Debug' { $Param['Debug'] = $true }
}
Invoke-CsAPI @Param
}
}