Public/Get-DattoDtcClientAsset.ps1
|
function Get-DattoDtcClientAsset { <# .SYNOPSIS Returns Direct-to-Cloud assets for one client or details for one asset. .DESCRIPTION Implements GET /v1/dtc/{clientId}/assets and GET /v1/dtc/{clientId}/assets/{assetUuid}. .PARAMETER ClientId The Direct-to-Cloud client ID. .PARAMETER AssetUuid The UUID of a specific asset. .PARAMETER Page The one-based API page number for client asset listings. .PARAMETER PerPage The number of records requested per page. .PARAMETER All Retrieves every available listing page when pagination metadata is returned. .PARAMETER RawResponse Returns the API response body or envelope. .PARAMETER Connection A connection object, name, or ID. .EXAMPLE Get-DattoDtcClientAsset -ClientId 12345 -All .EXAMPLE Get-DattoDtcClientAsset -ClientId 12345 -AssetUuid 'deadbeef-dead-beef-dead-beefdeadbeef' #> [CmdletBinding(DefaultParameterSetName = 'List')] param( [Parameter(Mandatory, ValueFromPipelineByPropertyName)][ValidateRange(1, [int]::MaxValue)][int]$ClientId, [Parameter(Mandatory, ParameterSetName = 'ByAsset')][ValidateNotNullOrEmpty()][string]$AssetUuid, [Parameter(ParameterSetName = 'List')][ValidateRange(1, [int]::MaxValue)][int]$Page = 1, [Parameter(ParameterSetName = 'List')][ValidateRange(1, [int]::MaxValue)][int]$PerPage = 25, [Parameter(ParameterSetName = 'List')][switch]$All, [Parameter()][switch]$RawResponse, [Parameter()][AllowNull()][object]$Connection ) process { if ($PSCmdlet.ParameterSetName -eq 'ByAsset') { $asset = ConvertTo-DattoApiPathSegment -Value $AssetUuid Invoke-DattoApiRequest -Path "/v1/dtc/$ClientId/assets/$asset" -RawResponse:$RawResponse -Connection $Connection } else { Invoke-DattoApiRequest -Path "/v1/dtc/$ClientId/assets" -Query @{ _page = $Page; _perPage = $PerPage } -All:$All -RawResponse:$RawResponse -Connection $Connection } } } |