Use the updateDiskSafe API to refresh the values for a Disk Safe.
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="10.230.131.25";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="admin";
########====CDP Server Configuration End====########
#arguments
$DISKSAFEDESC="APIeditedDS";
$DISKSAFEID="0bd90c9b-fc2c-44ed-8716-2429f98a4e7b";
$AGENTID="ec04cd66-aef7-491e-852c-2bb81446de1f";
$VOLUMEID="2a6f6bc0-0625-4128-a121-147af155cd98";
$OPEN="true";
$COMPRESSIONTYPE="ZLIB";
$COMPRESSIONLEVEL="MEDIUM";
$DEVICEBACKUPTYPE="AUTO_ADD_DEVICES";
#$diskSafeObj = getDiskSafes($USER,$PASS,$HOST,$PORT);
#Refresh the values for a disk safe.
try{
$client = new soapclient("https://$HOST:$PORT/Agent?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);
$diskSafeObj=$client->getDiskSafes();
}
catch (SoapFault $exception)
{
echo $exception;
echo(1);
}
foreach($diskSafeObj->return as $tmp)
{
if($tmp->id == $DISKSAFEID)
{
$diskSafe = $tmp;
break;
}
}
if($DISKSAFEID)
{
$diskSafe->id = $DISKSAFEID;
}
if($DISKSAFEDESC)
{
$diskSafe->description = $DISKSAFEDESC;
}
if($AGENTID)
{
$diskSafe->agentID = $AGENTID;
}
if($VOLUMEID)
{
$diskSafe->volumeID = $VOLUMEID;
}
#java interpretation of boolean is inverse of php
if (strlen($OPEN) < 1) {
echo "ERROR: --open= can either be true or false\n";
}
else {
$diskSafe->open=$OPEN;
}
if($COMPRESSIONTYPE)
{
$diskSafe->compressionType = $COMPRESSIONTYPE;
}
if($COMPRESSIONLEVEL)
{
$diskSafe->compressionLevel = $COMPRESSIONLEVEL;
}
if($DEVICEBACKUPTYPE)
{
$diskSafe->deviceBackupType = $DEVICEBACKUPTYPE;
}
try{
$client = new soapclient("https://$HOST:$PORT/DiskSafe?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
)
);
$client->updateDiskSafe(array('diskSafe'=>$diskSafe));
echo "Successfully executed updateDiskSafe\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
Labels:
None