Use the createPolicy API to create a new policy.
########====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====########
$DISKSAFEID= "a36f60f2-706f-4efe-b302-f82dbb9972ec";
$replScheFreqVals->startingMinute = 0;
$mergScheFreqVals->hoursOfDay = 2;
$mergScheFreqVals->startingMinute = 0;
$diskSafeVerificationFreqVals->hoursOfDay = 3;
$diskSafeVerificationFreqVals->startingMinute = 15;
$policyObj->enabled = True;
$policyObj->name = "APItestCrypt";
$policyObj->description = "PolicyAPItest";
$policyObj->diskSafeID = $DISKSAFEID;
$policyObj->replicationScheduleFrequencyType = "HOURLY";
$policyObj->replicationScheduleFrequencyValues = $replScheFreqVals;
$policyObj->mergeScheduleFrequencyValues = $mergScheFreqVals;
$policyObj->mergeScheduleFrequencyType = "DAILY";
$policyObj->recoveryPointLimit = 10;
$policyObj->forceFullBlockScan = FALSE;
$policyObj->multiVolumeSnapshot = true;
$policyObj->diskSafeVerificationScheduleFrequencyType = "DAILY";
$policyObj->diskSafeVerificationScheduleFrequencyValues = $diskSafeVerificationFreqVals;
#Create a new policy.
try{
$client = new soapclient("https://$HOST:$PORT/Policy2?wsdl",
array(
'login'=>"$USER",
'password'=>"$PASS",
'trace'=>1,
'classmap'=>array('Policy'=>'Policy')
)
);
$newPolicyObj = $client->createPolicy(array('policy'=>$policyObj));
var_dump($newPolicyObj);
echo "\nSuccessfully created new policy\n";
}
catch (SoapFault $exception)
{
echo $exception;
}
Labels:
None