Public/Search-DirectoryService.ps1

<#
    .DESCRIPTION
    Wrapper for Nutanix API version 0.3.
 
    .NOTES
    Author: Timothy Rasiah
#>


function Search-DirectoryService {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [String]$Uuid,
        [Parameter(Mandatory=$true)]
        [String]$Query,
        [String[]]$SearchedAttributeList,
        [String[]]$ReturnedAttributeList,
        [Boolean]$IsWildcardSearch = $true
    )

    $data = @{
        "query" = $Query
    }

    if ($SearchedAttributeList) {
        $data["searched_attribute_list"] = $SearchedAttributeList
    }

    if ($ReturnedAttributeList) {
        $data["returned_attribute_list"] = $ReturnedAttributeList
    }
    
    if ($null -ne $IsWildcardSearch) {
        $data["is_wildcard_search"] = $IsWildcardSearch
    }
    
    $response = Send-Request -method "POST" -endpoint "/directory_services/$($Uuid)/search" -data $data
    return $response
}