You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to github pull/request stuff and couldn't figure out how to do it. Here's some functions I added to the class to support getting traffic rules with enabling and disabling. Feel free to add.
/** * Fetch traffic rules * * @returns array of traffic rule objects */publicfunctionlist_trafficrules()
{
return$this->fetch_results('/v2/api/site/' . $this->site . '/trafficrules');
}
/** * Enable a specific traffic rule * * @param string $ruleDesc - specify the rule 'note' text to identify the rule * * @return bool true on success */publicfunctionenable_trafficrule(string$ruleDesc)
{
$rules = $this->list_trafficrules();
foreach($rulesas$rule) {
if(strtoupper($rule->description) != strtoupper($ruleDesc)) { continue; }
$rule->enabled = true;
$this->set_trafficrule($rule);
returntrue;
}
returnfalse;
}
/** * Disable a specific traffic rule * * @param string $ruleDesc - specify the rule 'note' text to identify the rule * * @return bool true on success */publicfunctiondisable_trafficrule($ruleDesc)
{
$rules = $this->list_trafficrules();
foreach($rulesas$rule) {
if(strtoupper($rule->description) != strtoupper($ruleDesc)) { continue; }
$rule->enabled = false;
$this->set_trafficrule($rule);
returntrue;
}
returnfalse;
}
/** * Set a traffic rule configuration. * * In order for this to work the PUT literally has to put the entire rule object as pulled from * list_trafficrules with modified properties Other wrapper functions should modify the rule then send * it to this function to 'commit' * * @return array|bool returns results */privatefunctionset_trafficrule($ruleObj)
{
$this->curl_method = 'PUT';
$payload = $ruleObj;
return$this->fetch_results('/v2/api/site/' . $this->site . '/trafficrules/' . trim($ruleObj->_id), $payload);
}
The text was updated successfully, but these errors were encountered:
I'm new to github pull/request stuff and couldn't figure out how to do it. Here's some functions I added to the class to support getting traffic rules with enabling and disabling. Feel free to add.
The text was updated successfully, but these errors were encountered: