Public/Upload-Image.ps1
<#
.DESCRIPTION Wrapper for Nutanix API version 0.3. .NOTES Author: Timothy Rasiah #> function Upload-Image { [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [String]$Uuid, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$LiteralPath, [ValidateSet("SHA_1", "SHA_256")] [String]$ChecksumType, [String]$ChecksumBytes ) # $data = [System.IO.File]::ReadAllBytes($LiteralPath) # $contenttype = "application/octet-stream" $params = @{} if ($ChecksumType) { $params["X-Nutanix-Checksum-Type"] = $ChecksumType } if ($ChecksumBytes) { $params["X-Nutanix-Checksum-Bytes"] = $ChecksumBytes } $response = Send-RequestFile -method "PUT" -endpoint "/images/$($Uuid)/file" -params $params -LiteralPath $LiteralPath return $response } |