Public/Caches/Import-R1Cache.ps1
|
# .ExternalHelp psRadiantOne-help.xml function Import-R1Cache { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] [OutputType('System.Object')] param( [parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateScript( { Test-Path -Path $_ -PathType Leaf })] [Alias('FullName')] [string]$Path ) Begin { Assert-R1Session -RequireToken }#begin Process { $URI = Resolve-R1ServiceUrl -Service Namespace -Path 'caches/upload' $UploadFile = Get-Item -Path $Path $Form = ConvertTo-MultipartFormData -Field @{ file = $UploadFile } if ($PSCmdlet.ShouldProcess($UploadFile.Name, 'Upload Cache LDIF')) { Invoke-R1RestMethod -Uri $URI -Method POST -Body $Form.Body -ContentType $Form.ContentType } }#process End { }#end } |