storageControllers.psm1


$StorageControllerPSUsDefaultProperties = ('name', 'index', 'fru-lifecycle-state', 'location', 'input', 'enabled-state')
$StorageControllersDefaultProperties = ('name', 'sys-name', 'state', 'node-mgr-addr', 'brick-id')
$LocalDisksDefaultProperties = ('name', 'index', 'model-name', 'slot-num', 'node-id', 'local-disk-purpose', 'enabled-state')

.(commonLib) 

Function Get-XtremStorageControllers {
    <#
    .DESCRIPTION
    displays the list of Storage 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-XtremStorageControllers
  #>

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

    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-XtremStorageController {
  <#
    .DESCRIPTION
    displays details of the selected Storage Controller.
 
    .PARAMETER StorageControllerName
    Storage 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-XtremStorageController -StorageControllerName name
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'storage-controllers' name })]
        $StorageControllerName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/storage-controllers'
    $Route, $GetProperty = SetParametersForRequest $Route $StorageControllerName
    
    $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
}

######### STORAGE CONTROLLERS PSUS COMMANDS #########

Function Get-XtremStorageControllerPSUs {
    <#
    .DESCRIPTION
    displays the list of Storage Controller 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-XtremStorageControllerPSUs
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $StorageControllerPSUsDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false        
    )
    initCommand
    $Route = '/types/storage-controller-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-XtremStorageControllerPSU {
  <#
    .DESCRIPTION
    displays the details of the selected Storage Controller PSU.
 
    .PARAMETER StorageControllerPSUName
    Storage Controller 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-XtremStorageControllerPSU -StorageControllerPSUName name
  #>

    
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'storage-controller-psus' name })]
        $StorageControllerPSUName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/storage-controller-psus'
    $Route, $GetProperty = SetParametersForRequest $Route $StorageControllerPSUName
    
    $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
}

######### LOCAL DISKS COMMANDS #########

Function Get-XtremLocalDisks
{
    
    <#
    .DESCRIPTION
    displays the list of Local Disks.
 
    .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-XtremLocalDisks
  #>

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

    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-XtremLocalDisk {
  <#
    .DESCRIPTION
    displays the details of the selected Local Disk.
 
    .PARAMETER LocalDiskName
    Local Disk'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-XtremLocalDisk -LocalDiskName name
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [Alias("Name", "Index")]
        [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [Argumentcompleter( { doComplete $args 'local-disks' name })]
        $LocalDiskName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/local-disks'
    $Route, $GetProperty = SetParametersForRequest $Route $LocalDiskName
    
    $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 *-*