You are here

public function AcquiaLiftAPI::deleteAgent in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 includes/AcquiaLiftAPI.inc \AcquiaLiftAPI::deleteAgent()

Deletes an agent.

Parameters

$agent_name: The name of the agent to delete.

File

includes/acquia_lift.classes.inc, line 626
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function deleteAgent($agent_name) {
  $url = $this
    ->generateEndpoint("/agent-api/{$agent_name}");
  $response = $this
    ->httpClient()
    ->delete($url);
  $vars = array(
    'agent' => $agent_name,
  );
  $success_msg = 'The Acquia Lift campaign {agent} was deleted';
  $fail_msg = 'Could not delete Acquia Lift campaign {agent}';
  if ($response->code == 200) {
    $this
      ->logger()
      ->log(PersonalizeLogLevel::INFO, $success_msg, $vars);
  }
  else {
    $this
      ->handleBadResponse($response->code, $fail_msg, $vars);
  }
}