Public/Disable-OnePAMResource.ps1
|
function Disable-OnePAMResource { <# .SYNOPSIS Disables a OnePAM resource. .DESCRIPTION Sets the resource's enabled flag to false via PATCH. .PARAMETER Id The UUID of the resource to disable. .EXAMPLE Disable-OnePAMResource -Id "abc-123" #> [CmdletBinding()] param( [Parameter(Mandatory)] [string]$Id ) Assert-OpSafePathSegment -Value $Id -Label 'resource ID' $encoded = [System.Uri]::EscapeDataString($Id) Invoke-OpApi -Method PATCH -Path "/api/v1/resources/$encoded" -Body @{ enabled = $false } | Out-Null Write-Host "Resource $Id disabled." -ForegroundColor Yellow } |