You are here

public function AkamaiClientBase::setAction in Akamai 8.3

Helper function to set the action for purge request.

Parameters

string $action: Action to be taken while purging.

Return value

$this

Overrides AkamaiClientInterface::setAction

File

src/AkamaiClientBase.php, line 383

Class

AkamaiClientBase
Connects to the Akamai EdgeGrid.

Namespace

Drupal\akamai

Code

public function setAction($action) {
  $valid_actions = $this
    ->validActions();
  if (in_array($action, $valid_actions)) {
    $this->action = $action;
  }
  else {
    throw new \InvalidArgumentException('Action must be one of: ' . implode(', ', $valid_actions));
  }
  return $this;
}