dae.psm1


$DAEControllersDefaultProperties = ('name', 'index', 'sys-name', 'brick-name', 'model', 'serial-number', 'fru-lifecycle-state', 'fw-version')
$DAERowControllersDefaultProperties = ('name', 'index', 'sys-name');
$DAERowControllerDefaultProperties = ('name', 'index', 'serial-number', 'fru-lifecycle-state', 'obj-severity', 'temperature-state', 'location', 'temperature')
$DAEsDefaultProperties = ('name', 'index', 'sys-name', 'brick-name', 'model', 'serial-number', 'fru-lifecycle-state', 'fw-version')
$DAEPSUsDefaultProperties = ('name', 'index', 'sys-name', 'power-feed', 'location', 'fru-lifecycle-state', 'enabled-state', 'input')

.(commonLib) 

Function Get-XtremDAERowControllers {
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [array]$Property = $DAERowControllerDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [array]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/dae-row-controllers'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -Properties $Property -ObjectSelection $ObjectSelection -Filters $Filter -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremDAERowController {
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'dae-row-controllers' name })] 
        $DAEController,
        [Alias("Properties")]
        [array]$Property = $DAERowControllerDefaultProperties,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand    
    $Route = '/types/dae-row-controllers'
    $Route, $GetProperty = SetParametersForRequest $Route $DAEController

    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent
    
    $result = formatOutPut $Property $result

    finalizeCommand
    return $result
}

Function Get-XtremDAEControllers
{
    
    <#
    .DESCRIPTION
    displays the list of DAE Controllers.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAEControllers
  #>

    
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $DAEControllersDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/dae-controllers'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremDAEController {
  <#
    .DESCRIPTION
    displays the details of DAE Controllers.
 
    .PARAMETER DAEControllerName
    DAE Controller's name or index number
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAEController -DAEControllerName name
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'dae-controllers' name })]
        $DAEControllerName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/dae-controllers'
    $Route, $GetProperty = SetParametersForRequest $Route $DAEControllerName
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -XtremClusterName $XtremClusterName -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent

    $result = formatOutPut $Property $result

    finalizeCommand
    return $result
}

Function Get-XtremDAEs {
    <#
    .DESCRIPTION
    displays the list of DAEs.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAEs
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $DAEsDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/daes'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -XtremClusterName $XtremClusterName -Session $Session -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result

    finalizeCommand
    return $result
}

Function Get-XtremDAE {
  <#
    .DESCRIPTION
    displays the details of the selected DAE.
 
    .PARAMETER DAEName
    DAE's name or index number
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAE -DAEName dae
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'daes' name })]
        $DAEName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/daes'
    $Route, $GetProperty = SetParametersForRequest $Route $DAEName
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -XtremClusterName $XtremClusterName -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent

    $result = formatOutPut $Property $result

    finalizeCommand
    return $result
}

Function Get-XtremDAEPSUs
{
    
    <#
    .DESCRIPTION
    displays the list of DAE PSUs.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAEPSUs
  #>

    
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $DAEPSUsDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/dae-psus'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -XtremClusterName $XtremClusterName -Session $Session -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent

    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremDAEPSU {
  <#
    .DESCRIPTION
    displays the details of the selected DAE PSU.
 
    .PARAMETER DAEPSUName
    DAE PSU's name or index number
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremDAEPSU -DAEPSUName:name
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'dae-psus' name })]
        $DAEPSUName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/dae-psus'
    $Route, $GetProperty = SetParametersForRequest $Route $DAEPSUName
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -XtremClusterName $XtremClusterName -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent

    $result = formatOutPut $Property $result

    finalizeCommand
    return $result
}

Export-ModuleMember Get-XtremDAERowControllers
Export-ModuleMember Get-XtremDAERowController
Export-ModuleMember Get-XtremDAEControllers
Export-ModuleMember Get-XtremDAEController
Export-ModuleMember Get-XtremDAEPSU
Export-ModuleMember Get-XtremDAEPSUs
Export-ModuleMember Get-XtremDAE
Export-ModuleMember Get-XtremDAEs