Functions/LDAPDirectories/Remove-PASDirectoryMapping.ps1

# .ExternalHelp psPAS-help.xml
function Remove-PASDirectoryMapping {
    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [string]$DirectoryName,

        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [string]$MappingID
    )

    BEGIN {
        Assert-VersionRequirement -RequiredVersion 11.1
    }#begin

    PROCESS {

        #Create URL for request
        $URI = "$Script:BaseURI/api/Configuration/LDAP/Directories/$DirectoryName/Mappings/$MappingID/"

        if ($PSCmdlet.ShouldProcess($MappingID, 'Delete Directory Mapping')) {

            #send request to web service
            Invoke-PASRestMethod -Uri $URI -Method DELETE -WebSession $Script:WebSession

        }

    }#process

    END { }#end

}