Modules/storage.psm1

# /rest/v1.0/dd-systems/{SYSTEM-ID}/storage/disks

function Get-DDDisks {
    [CmdletBinding()]
    param ( 
       [CmdletBinding()]
       [Parameter(Mandatory = $true, ParameterSetName = 'byID')]
       [string]$id,                 
       [Parameter(Mandatory = $false, ParameterSetName = 'byID')]
       [Parameter(Mandatory = $false, ParameterSetName = 'default')]
       [string]
       $SYSTEM_ID = $Global:DD_UUID,
       $body = @{}
    )
    begin {
       $Response = @()
       $METHOD = "GET"
    }
    process {
       switch ($PsCmdlet.ParameterSetName) {
          default {
             $apiver = "api/v1"
             $uri = "dd-systems/$($SYSTEM_ID)/storage/disks"
          }
          'byID' {
             $apiver = "api/v1"
             $uri = "dd-systems/$($SYSTEM_ID)/storage/disks/$ID"
          }               
       }
       $parameters = @{
          uri           = $uri          
          apiver        = $apiver
          Method        = $METHOD
          body          = $body
          RequestMethod = "REST"
          Verbose       = $PSBoundParameters['Verbose'] -eq $true
       }      
       try {
          $Response += Invoke-DDapirequest @Parameters
       }
       catch {
          Get-DDWebException  -ExceptionMessage $_
          break
       }
       write-verbose ($response | Out-String)
    }
    end {    
       switch ($PsCmdlet.ParameterSetName) {
          'default' {
             $response.diskInfo | Select-Object -ExcludeProperty link
          }
          'byID' {
             $response[-1]  | Select-Object -Property * -ExcludeProperty link
          }           
       } 
       
    }
 }