41 lines
1.4 KiB
PowerShell
41 lines
1.4 KiB
PowerShell
function Remove-PlatformElementDetails {
|
|
<#
|
|
.SYNOPSIS
|
|
Soft deletes PlatformElementDetail(s) in BoRG by setting IsCurrent = false
|
|
|
|
.EXAMPLE
|
|
Remove-PlatformElementDetails -PlatformElementDetailArray @(item1, item2) -BorgUri "http://uri.to.borg.com" -APiKey "b752be2f-9206-4706-a2fb-851162cb29bf"
|
|
|
|
.PARAMETER PlatformElementDetailArray
|
|
An array of PSObjects containing all element details to be deleted. Use New-PlatformElementDetailPSObject for creation of the required PSObjects.
|
|
|
|
.PARAMETER BorgUri
|
|
Uri to the BoRG REST service.
|
|
|
|
.PARAMETER ApiKey
|
|
Borg Api key. Required for write operations.
|
|
#>
|
|
[CmdletBinding()]
|
|
[OutputType([string])]
|
|
Param(
|
|
[Parameter(Mandatory = $true)]
|
|
[PSObject[]]$PlatformElementDetailArray,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$BorgUri,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$ApiKey
|
|
)
|
|
|
|
$uri = "$BorgUri/api/platformelementdetails"
|
|
$headers = @{ "x-api-key" = $ApiKey }
|
|
$body = ConvertTo-Json $PlatformElementDetailArray
|
|
|
|
$response = Invoke-CommandWithRetry -Arguments @($uri, $headers, $body) -Seconds 3 -JitterMin 500 -JitterMax 3000 -ScriptBlock {
|
|
param($uri, $headers, $body)
|
|
return (Invoke-RestMethod -Uri $uri -Method PATCH -Headers $headers -Body $body -ContentType "application/json")
|
|
}
|
|
|
|
return ConvertTo-Json $response
|
|
} |