SingleScripts/Delete-Cluster.ps1

[CmdletBinding()]
Param(
  [Parameter(Mandatory=$true,Position=1)] [string] $DBAPIRootUrl,
  [Parameter(Mandatory=$True,Position=2)] [string] $DBAPIKey,
  [Parameter(Mandatory=$True,Position=3)] [object] $ClusterId
)
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$DBAPIUrl = $DBAPIRootUrl.Trim('/') + "/api/2.0/clusters/permanent-delete"

$headers = @{
  Authorization = "Bearer $DBAPIKey"
  "Content-Type" = "application/json"
}

$bodyJson = @{
  cluster_id = $ClusterId
} | ConvertTo-Json
  
Write-Information "Permanently deleting Cluster $ClusterId..."
$result = Invoke-RestMethod -Uri $DBAPIUrl -Method POST -Headers $headers -Body $bodyJson

$result