Public/NamingContexts/New-R1NamingContextInterceptionScript.ps1

# .ExternalHelp psRadiantOne-help.xml
function New-R1NamingContextInterceptionScript {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$dn,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateLength(1, 1000)]
        [string]$name
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Namespace -Path "naming_contexts/$($dn | Get-EscapedString)/content/interception_script/new"

        $Body = @{ name = $name } | ConvertTo-R1JsonBody

        if ($PSCmdlet.ShouldProcess($dn, "Create Interception Script '$name'")) {

            $null = Invoke-R1RestMethod -Uri $URI -Method POST -Body $Body

        }

    }#process

    End { }#end

}