Modules/mtree.psm1
#GET /rest/v1.0/dd-systems/{SYSTEM-ID}/mtrees function Get-DDmtrees { [CmdletBinding()] param ( [CmdletBinding()] [Parameter(Mandatory = $true, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [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 = "rest/v1.0" $uri = "dd-systems/$($SYSTEM_ID)/mtrees" } 'byID' { $apiver = "rest/v3.0" $uri = "dd-systems/$($SYSTEM_ID)/mtrees/$ID" } } $parameters = @{ uri = $uri apiver = $apiver Method = $METHOD body = $body RequestMethod = "REST" Verbose = $PSBoundParameters['Verbose'] -eq $true Debug = $PSBoundParameters['Debug'] -eq $true } try { $Response += Invoke-DDapirequest @Parameters } catch { Get-DDWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'default' { $response.mtree| Select-Object -ExcludeProperty link } 'byID' { $response | Select-Object -Property * -ExcludeProperty link } } } } # get /rest/v3.0/dd-systems/{SYSTEM-ID}/stats/performances/mtrees/{ID} function Get-DDmtreesPerformances { [CmdletBinding()] param ( [CmdletBinding()] [Parameter(Mandatory = $true, ParameterSetName = 'byID', ValueFromPipelineByPropertyName = $true)] [string]$id, [Parameter(Mandatory = $false, ParameterSetName = 'byID')] [string] $SYSTEM_ID = $Global:DD_UUID, $body = @{} ) begin { $Response = @() $METHOD = "GET" } process { switch ($PsCmdlet.ParameterSetName) { default { $apiver = "rest/v3.0" $uri = "dd-systems/$($SYSTEM_ID)/mtrees" } 'byID' { $apiver = "rest/v3.0" $uri = "dd-systems/$($SYSTEM_ID)/stats/performances/mtrees/$ID" } } $parameters = @{ uri = $uri apiver = $apiver Method = $METHOD body = $body RequestMethod = "REST" Verbose = $PSBoundParameters['Verbose'] -eq $true Debug = $PSBoundParameters['Debug'] -eq $true } try { $Response += Invoke-DDapirequest @Parameters } catch { Get-DDWebException -ExceptionMessage $_ break } write-verbose ($response | Out-String) } end { switch ($PsCmdlet.ParameterSetName) { 'default' { $response | Select-Object -ExcludeProperty link } 'byID' { $response.mtree_show_perf_detail | Select-Object -Property @{N="id";E={$id}},* -ExcludeProperty link } } } } #POST/rest/v1.0/dd-systems/{SYSTEM-ID}/mtrees # Put /rest/v1.0/dd-systems/{SYSTEM-ID}/mtrees/{ID} |