HELIX BO Profiles backend functions
//Create mandatory slots to enable BO profiles
//Here below the values are not final, just for testing under the radar
//---------------------------------------------------------------------
$TopLevelEventClass = "PPX_EV"; //must exist
$TempSlot1 = "temp_ppx_profile"; //to create when module is enabled - must agree on final name
$TempSlot2 = "temp_ppx_profile_list"; //to create when module is enabled - must agree on final name
$FinalSlot = "ppx_profiles"; //to create when module is enabled - must agree on final name
pprint_r(HELIXAddSlotToEventClass($TempSlot1,$TopLevelEventClass,"STRING"));
pprint_r(HELIXAddSlotToEventClass($TempSlot2,$TopLevelEventClass,"STRING"));
pprint_r(HELIXAddSlotToEventClass($FinalSlot,$TopLevelEventClass,"STRING_LIST"));
//Note : to revert:
//-----------------
//pprint_r(HELIXDelSlotFromEventClass($TempSlot1 ,$TopLevelEventClass));
//pprint_r(HELIXDelSlotFromEventClass($TempSlot2 ,$TopLevelEventClass));
//pprint_r(HELIXDelSlotFromEventClass($FinalSlot ,$TopLevelEventClass));
//General values for the BO module
$StartExecutionOrder= 1000;
//These slots should exist in TopLevelEventClass but this is not checked yet.
$ProfileSlots = array("source_hostname","artifact","entityName","sourceTags");
//List BO profiles and obtain "max execution order".
//Each profile requires 2 event policies that must run one after the other
//-----------------------------------------------------------------------------
$JSON = HELIXListBOProfiles();
if ( $JSON["statusCode"] == 200 )
{
if ( $JSON["MaxExecutionOrder"] != 0 )
{
$StartExecutionOrder = $JSON["MaxExecutionOrder"] + 1 ;
}
}
else
{
print "abort";
}
//Create BO Profile
//-----------------
$ProfileName="TestProfile";
pprint_r(HELIXCreateBOProfile($ProfileName,"My Profile Description",$TopLevelEventClass,$ProfileSlots,$StartExecutionOrder));
//Retrieve existing profiles
//--------------------------
pprint_r(HELIXListBOProfiles());
//Look at profile content
//-----------------------
pprint_r(HELIXGetProfileContent($ProfileName));
//Push new content in profile
//---------------------------
$CSVData="host1,*,*,*,$ProfileName
host2,*,*,*,$ProfileName
host3,*,*,*,$ProfileName";
pprint_r(HELIXPushProfileContent($ProfileName,$CSVData));
//Look at profile content
//-----------------------
pprint_r(HELIXGetProfileContent($ProfileName));
//Delete profile
//--------------
pprint_r(HELIXDeleteBOProfile($ProfileName));
pprint_r(HELIXListBOProfiles());