bricks.psm1


$BricksDefaultProperties = ('name', 'index', 'sys-name', 'brick-state', 'num-of-ssds')

.(commonLib) 

Function Get-XtremBricks {
  <#
    .DESCRIPTION
    displays the list of all X-Bricks.
 
    .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-XtremBricks
  #>

    
    [cmdletbinding()]
    Param (
        [parameter()]
        $XtremClusterName =  (Get-XtremDefaultSession)._XtremClusterName,
        [parameter()]
        [Alias("Properties")]
        [Argumentcompleter( { doComplete $args 'bricks' prop })]
        [string[]]$Property = $BricksDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/bricks'

    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-XtremBrick {
   <#
    .DESCRIPTION
    Retrieves information about an XtremIO Brick
 
    .PARAMETER BrickName
    Index or name of the XtremIO Brick
 
    .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-XtremBrick -BrickName X1
  #>

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

Export-ModuleMember Get-XtremBricks
Export-ModuleMember Get-XtremBrick