Public/Schemas/Remove-R1SchemaRelationship.ps1

# .ExternalHelp psRadiantOne-help.xml
function Remove-R1SchemaRelationship {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [Alias('name')]
        [string]$schemaName,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [Alias('id')]
        [string]$relationshipId
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Catalog -Path "schemas/$($schemaName | Get-EscapedString)/relationships/$($relationshipId | Get-EscapedString)"

        if ($PSCmdlet.ShouldProcess($relationshipId, 'Delete Relationship')) {

            $null = Invoke-R1RestMethod -Uri $URI -Method DELETE

        }

    }#process

    End { }#end

}