Public/Disconnect-IAMCoreConnectorDataObject.ps1

function Disconnect-IAMCoreConnectorDataObject {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id
        [string]$ConnectorId,

        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
        [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id
        [string]$ConnectorObjectId
    )

    begin {
        if (-not $Script:APIRoot -or -not $Script:AccessTokenProfile) {
            throw "Not connected to IAM Core. Please run Connect-IAMCore first."
        }
    }

    process {
        $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/connectors/$($ConnectorId)/data/$($ConnectorObjectId)/disconnect" -Headers (Get-IAMCoreHeader) -Method Post

        if ($Result.IsSuccess) {
            return $Result.Data
        }
        else {
            throw "Failed to disconnect IAM Core connector data object: $($Result.ErrorMessage)"
        }
    }
}