public/Get-VSARoleType.ps1
function Get-VSARoleType { <# .Synopsis Returns VSA user role types. .DESCRIPTION Returns existing VSA user role types. Takes either persistent or non-persistent connection information. .PARAMETER VSAConnection Specifies existing non-persistent VSAConnection. .PARAMETER URISuffix Specifies URI suffix if it differs from the default. .PARAMETER RoleTypeId Specifies RoleTypeId to return. .PARAMETER Filter Specifies REST API Filter. .PARAMETER Paging Specifies REST API Paging. .PARAMETER Sort Specifies REST API Sorting. .EXAMPLE Get-VSARoleType .EXAMPLE Get-VSARoleType -VSAConnection $connection .EXAMPLE Get-VSARoleType -RoleTypeId 100 .INPUTS Accepts piped non-persistent VSAConnection .OUTPUTS Array of objects that represent existing VSA user role types. #> [CmdletBinding()] param ( [parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [VSAConnection] $VSAConnection, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $URISuffix = 'api/v1.0/system/roletypes', [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [ValidateScript({ if( (-not [string]::IsNullOrEmpty($_)) -and ($_ -notmatch "^\d+$") ) { throw "Non-numeric Id" } return $true })] [string] $RoleTypeId, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $Filter, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $Paging, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $Sort ) if ( -not [string]::IsNullOrEmpty($RoleTypeId)) { $URISuffix += "/$RoleTypeId" } [hashtable]$Params = @{ URISuffix = $URISuffix VSAConnection = $VSAConnection Filter = $Filter Paging = $Paging Sort = $Sort } foreach ( $key in $Params.Keys.Clone() ) { if ( -not $Params[$key]) { $Params.Remove($key) } } return Invoke-VSARestMethod @Params } New-Alias -Name Get-VSARoleTypes -Value Get-VSARoleType Export-ModuleMember -Function Get-VSARoleType -Alias Get-VSARoleTypes |