You are here

public function AcquiaContenthubCommands::contenthubUpdateSecret in Acquia Content Hub 8

Updates the Shared Secret used for Webhook Verification.

@command acquia:contenthub-update-secret @aliases ach-upsec,acquia-contenthub-update-secret

File

src/Commands/AcquiaContenthubCommands.php, line 531

Class

AcquiaContenthubCommands
A Drush commandfile.

Namespace

Drupal\acquia_contenthub\Commands

Code

public function contenthubUpdateSecret() {

  /** @var \Drupal\acquia_contenthub\Client\ClientManager $client_manager */
  $client_manager = \Drupal::service('acquia_contenthub.client_manager');

  /** @var \Drupal\acquia_contenthub\ContentHubSubscription $subscription */
  $subscription = \Drupal::service('acquia_contenthub.acquia_contenthub_subscription');
  if ($client_manager
    ->isConnected()) {
    $subscription
      ->getSettings();
    $this
      ->output()
      ->writeln(dt('The shared secret has been updated.'));
  }
  else {
    throw new \Exception(dt('The Content Hub client is not connected so the shared secret can not be updated.'));
  }
}