Hp OneView Manual de usuario Pagina 298

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 309
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 297
None, does not accept piping
.OUTPUTS
The response body to the upload post request.
.EXAMPLE
$uploadResponse = uploadTo-appliance $filePath $sessionID $hostname $fileName
#>
$uploadUri = "/rest/backups/archive"
$fullUploadUri = $hostname + $uploadUri
$curlUploadCommand = "curl -s -k -X POST " +
"-H 'content-type: multipart/form-data' " +
"-H 'accept: application/json' " +
"-H 'auth: " + $authinfo + "' " +
"-H 'X-API-Version: $global:scriptApiVersion' " +
"-F file=@" + $filepath + " " +
$fullUploadUri
Write-Host "Uploading backup file to appliance, this may take a few minutes..."
try
{
$testCurlSslOption = curl -V
if ($testCurlSslOption -match "SSL")
{
$rawUploadResponse = invoke-expression $curlUploadCommand
if ($rawUploadResponse -eq $null)
{
return
}
$uploadResponse = $rawUploadResponse | convertFrom-Json
if ($uploadResponse.status -eq "SUCCEEDED")
{
Write-Host "Upload complete."
return $uploadResponse
}
else
{
Write-Host $uploadResponse
return
}
}
else
{
Write-Host "Version of curl must support SSL to get improved upload performance."
return uploadTo-appliance-without-curl $filepath $authinfo $hostname $backupFile
}
}
catch [System.Management.Automation.CommandNotFoundException]
{
return uploadTo-appliance-without-curl $filepath $authinfo $hostname $backupFile
}
catch [System.Exception]
{
Write-Host "Not able to upload backup"
Write-Host $error[0].Exception
return
}
}
##### Upload the backup file to the appliance without using the curl command #####
function uploadTo-appliance-without-curl
([string]$filepath,[string]$authinfo,[string]$hostname,[string]$backupFile)
{
<#
.DESCRIPTION
Attempts to upload a backup to the appliance without using curl.
.PARAMETER filepath
The absolute filepath to the backup file.
.PARAMETER authinfo
The authorized session ID returned by the login request
.PARAMETER hostname
The appliance to connect to
.PARAMETER backupFile
The name of the file to upload. Only used to tell the server what file is contained in the post
request.
.INPUTS
None, does not accept piping
.OUTPUTS
The response body to the upload post request.
298 Beispiele für Sicherungs- und Wiederherstellungsskripts
Vista de pagina 297
1 2 ... 293 294 295 296 297 298 299 300 301 302 303 ... 308 309

Comentarios a estos manuales

Sin comentarios