Public/NamingContexts/Set-R1NamingContextInterceptionScriptCode.ps1
|
# .ExternalHelp psRadiantOne-help.xml function Set-R1NamingContextInterceptionScriptCode { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] [OutputType([void])] param( [parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateNotNullOrEmpty()] [string]$dn, [parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateLength(1, 100000)] [string]$scriptContents ) Begin { Assert-R1Session -RequireToken }#begin Process { $URI = Resolve-R1ServiceUrl -Service Namespace -Path "naming_contexts/$($dn | Get-EscapedString)/interception_script/code" #Retrieve the current script so its file and class names are sent back unchanged $Existing = Get-R1NamingContextInterceptionScriptCode -dn $dn $Template = [ordered]@{ scriptContents = $null filename = $null classname = $null } $Request = Merge-R1Parameter -Template $Template -BoundParameter ($PSBoundParameters | Get-Parameter -ParametersToRemove dn) -Fallback $Existing $Body = $Request | ConvertTo-R1JsonBody if ($PSCmdlet.ShouldProcess($dn, 'Update Interception Script')) { $null = Invoke-R1RestMethod -Uri $URI -Method PUT -Body $Body } }#process End { }#end } |