Public/DirectorySchema/New-R1DirectoryObjectClass.ps1
|
# .ExternalHelp psRadiantOne-help.xml function New-R1DirectoryObjectClass { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] [OutputType([void])] param( [parameter( Mandatory = $true, ValueFromPipelineByPropertyName = $true )] [ValidateLength(1, 500)] [string]$objectClass, [parameter( Mandatory = $false, ValueFromPipelineByPropertyName = $true )] [ValidateLength(1, 1000)] [string]$superClass, [parameter( Mandatory = $false, ValueFromPipelineByPropertyName = $true )] [bool]$isAuxiliary, [parameter( Mandatory = $false, ValueFromPipelineByPropertyName = $true )] [object[]]$requiredAttrs, [parameter( Mandatory = $false, ValueFromPipelineByPropertyName = $true )] [object[]]$optionalAttrs ) Begin { Assert-R1Session -RequireToken }#begin Process { $URI = Resolve-R1ServiceUrl -Service Schema -Path 'object_classes' $Request = $PSBoundParameters | Get-Parameter foreach ($Collection in 'requiredAttrs', 'optionalAttrs') { if ($Request.Contains($Collection)) { $Request[$Collection] = @($Request[$Collection]) } } $Body = $Request | ConvertTo-R1JsonBody if ($PSCmdlet.ShouldProcess($objectClass, 'Add Object Class')) { $null = Invoke-R1RestMethod -Uri $URI -Method POST -Body $Body } }#process End { }#end } |