|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (31)
View Page HistoryUse the {{createVolumeWithDirectory}} API to create a volume that includes a directory if it does not exist.
Use the {{createReport}} API to a report that is enabled, runs twice a day, and filters by task state and task alert.
{code}
########====CDP Server Configuration Start====########
########====CDP Server Configuration Start====########
...
########====CDP Server Configuration End====########
#arguments
$VOLNAME="APItest5";
$VOLDESC="APItestDesc";
$VOLPATH="/root/APIVol5";
$VOLQUOTATYPE="NONE";
$HARDQUOTA="";
$SOFTQUOTA="";
$CREATEDIR="createDirectoryIfItDoesNotExist";
$VOLNAME="APItest5";
$VOLDESC="APItestDesc";
$VOLPATH="/root/APIVol5";
$VOLQUOTATYPE="NONE";
$HARDQUOTA="";
$SOFTQUOTA="";
$CREATEDIR="createDirectoryIfItDoesNotExist";
########====Report configuration start====########
if ($VOLNAME!="")
{
$volumeObj->name = $VOLNAME;
}
{
$volumeObj->name = $VOLNAME;
}
### Set id of user who will be owner of the report being created(Optional). If not set, current user will be made report owner.
#$ID = "d1b43ea9-9a89-4a82-873a-677674a43ec0";
$ENABLED = true;
$REPORT_NAME = "reportName1";
$REPORT_SUBJECT = "reportSubject1";
$ALERT_AFTER_DAYS = 1;
$HARD_QUOTA = -1;
### See "FrequencyValues.FrequencyType" in Java Docs for more details.
$FREQUENCY_TYPE = "DAILY";
### See "FrequencyValues" in Java Docs for more details.
$FREQUENCY_VALUES->startingMinute = 5;
$FREQUENCY_VALUES->hoursOfDay = array("2","14");
### Recipient email addresses
$RECIPIENT_EMAIL_ADDRESSES = array("recipient1@test.com", "recipient2@test.com");
$FROM_ADDRESS = "from@test.com";
#$ID = "d1b43ea9-9a89-4a82-873a-677674a43ec0";
$ENABLED = true;
$REPORT_NAME = "reportName1";
$REPORT_SUBJECT = "reportSubject1";
$ALERT_AFTER_DAYS = 1;
$HARD_QUOTA = -1;
### See "FrequencyValues.FrequencyType" in Java Docs for more details.
$FREQUENCY_TYPE = "DAILY";
### See "FrequencyValues" in Java Docs for more details.
$FREQUENCY_VALUES->startingMinute = 5;
$FREQUENCY_VALUES->hoursOfDay = array("2","14");
### Recipient email addresses
$RECIPIENT_EMAIL_ADDRESSES = array("recipient1@test.com", "recipient2@test.com");
$FROM_ADDRESS = "from@test.com";
if ($VOLDESC!="")
{
$volumeObj->description = $VOLDESC;
}
{
$volumeObj->description = $VOLDESC;
}
########====Report configuration End====########
if ($VOLPATH!="")
{
$volumeObj->path = $VOLPATH;
}
{
$volumeObj->path = $VOLPATH;
}
if ($QUOTATYPE!="")
{
$volumeObj->quotaType = $VOLQUOTATYPE;
}
{
$volumeObj->quotaType = $VOLQUOTATYPE;
}
########====Initialize a report object start====########
if ($HARDQUOTA!="")
{
$volumeObj->hardQuota = $HARDQUOTA;
}
{
$volumeObj->hardQuota = $HARDQUOTA;
}
$reportObj->enabled = $ENABLED;
$reportObj->name = $REPORT_NAME;
$reportObj->subject = $REPORT_SUBJECT;
$reportObj->reportOwnerID = $ID;
$reportObj->reportFrequencyType = $FREQUENCY_TYPE;
$reportObj->reportFrequencyValues = $FREQUENCY_VALUES;
$reportObj->agentAlertAfterDays = $ALERT_AFTER_DAYS;
$reportObj->hardQuota = $HARD_QUOTA;
$reportObj->emailAddresses = $RECIPIENT_EMAIL_ADDRESSES;
$reportObj->name = $REPORT_NAME;
$reportObj->subject = $REPORT_SUBJECT;
$reportObj->reportOwnerID = $ID;
$reportObj->reportFrequencyType = $FREQUENCY_TYPE;
$reportObj->reportFrequencyValues = $FREQUENCY_VALUES;
$reportObj->agentAlertAfterDays = $ALERT_AFTER_DAYS;
$reportObj->hardQuota = $HARD_QUOTA;
$reportObj->emailAddresses = $RECIPIENT_EMAIL_ADDRESSES;
if ($SOFTQUOTA!="")
{
$volumeObj->softQuota = $SOFTQUOTA;
}
if ($CREATEDIR!="")
{
$volumeObj->createDirectoryIfItDoesNotExist = $CREATEDIR;
}
#Create a volume that includes a directory if it does not exist.
try{
$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1
)
);
{
$volumeObj->softQuota = $SOFTQUOTA;
}
if ($CREATEDIR!="")
{
$volumeObj->createDirectoryIfItDoesNotExist = $CREATEDIR;
}
#Create a volume that includes a directory if it does not exist.
try{
$client = new soapclient("https://$HOST:$PORT/Volume?wsdl",
array('login'=>"$USER",
'password'=>"$PASS",
'trace'=>1
)
);
$reportObj->sendIndividualEmails = true;
$reportObj->sendIfEmpty = false;
$reportObj->includeFullAlertDetails = false;
$reportObj->fromAddress = $FROM_ADDRESS;
$reportObj->sendIfEmpty = false;
$reportObj->includeFullAlertDetails = false;
$reportObj->fromAddress = $FROM_ADDRESS;
########====Initialize a report object End====########
$client->createVolumeWithDirectory(array('volume'=>$volumeObj));
echo "Successfully created Volume: $VOLNAME\n";
########====Set REPORT FILTERS start====########
### To enable "Filter by Server", provide UUIDs of existing servers
#$reportObj->agentIDsFilterList=array("88632b8e-b7d3-4111-a224-03cc1ba49264", "2823c163-6436-4084-bf5a-63d53a830c48");
### To enable "Filter by Server", provide UUIDs of existing servers
#$reportObj->agentIDsFilterList=array("88632b8e-b7d3-4111-a224-03cc1ba49264", "2823c163-6436-4084-bf5a-63d53a830c48");
exit(0);
### See "TaskState" in Java Docs for more details.
$reportObj->taskStateFilterList=array("QUEUED", "FINISHED");
$reportObj->taskStateFilterList=array("QUEUED", "FINISHED");
}
### See "TaskType" in Java Docs for more details.
#$reportObj->taskTypeFilterList=array("DISK_SAFE_VERIFICATION", "TASK_HISTORY_CLEANUP");
#$reportObj->taskTypeFilterList=array("DISK_SAFE_VERIFICATION", "TASK_HISTORY_CLEANUP");
catch (SoapFault $exception)
### See "LogLevel" in Java Docs for more details.
#$reportObj->logLevelFilterList=array("INFO", "SEVERE");
#$reportObj->logLevelFilterList=array("INFO", "SEVERE");
{
echo $exception;
### To select "Filter by Task Alert", this should be set to true or false depending if we want to include tasks with alerts or without alerts.
exit(1); $reportObj->taskWithAlertsFilter=true;
########====Set REPORT FILTERS end====########
try {
$reportClient = new soapclient("https://$HOST:$PORT/Reporting?wsdl",
array(
'login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl'=>WSDL_CACHE_NONE,
'features'=>SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);
$createdReport = $reportClient->createReport(array('report'=>$reportObj));
echo "Successfully executed create report \n";
try {
$reportClient = new soapclient("https://$HOST:$PORT/Reporting?wsdl",
array(
'login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl'=>WSDL_CACHE_NONE,
'features'=>SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);
$createdReport = $reportClient->createReport(array('report'=>$reportObj));
echo "Successfully executed create report \n";
}
catch(SoapFault $exception)
{
echo "Failed to create report \n";
echo $exception;
exit(1);
{
echo "Failed to create report \n";
echo $exception;
exit(1);
{code}