Public/Enable-OnePAMResource.ps1
|
function Enable-OnePAMResource { <# .SYNOPSIS Enables a OnePAM resource. .DESCRIPTION Sets the resource's enabled flag to true via PATCH. .PARAMETER Id The UUID of the resource to enable. .EXAMPLE Enable-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 = $true } | Out-Null Write-Host "Resource $Id enabled." -ForegroundColor Green } |