Functions/Get-IADataDefinition.ps1

Function Get-IADataDefinition {
    <#
        .SYNOPSIS
            Returns a list of DataDefinitions.
        .DESCRIPTION
            DataDefinitions are used to link together Configurations with TaskSchedules and ConnectorModules. Also displays the state of a DataDefinition ('Operational', 'Incomplete' etc...).
        .EXAMPLE
            Get-IADataDefinition -All
    #>

    Param(
        [Parameter(Mandatory = $true, ParameterSetName='Name')]
        [String] $Name,
        [Parameter(Mandatory = $true, ParameterSetName='Filter')]
        [String] $Filter,
        [Parameter(Mandatory = $true, ParameterSetName='All')]
        [switch] $All
    )

    $Uri = "DataDefinitions"

    if($All){}
    elseif($Name){
        $Uri += "?`$filter=Name eq '$Name'"
    }
    elseif ($Filter) {
        $Uri += "?&`$filter=$Filter"
    }

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Get

    if ($null -eq $response.value) {
        return $null
    }

    return $response.value
}