You are here

public function AcquiaContentHubFiltersCommands::listFilters in Acquia Content Hub 8.2

Prints cloud filters list.

@command acquia:contenthub-filters @aliases ach-cf

@option webhook @option interactive

@default webhook null @default interactive false

@usage acquia:contenthub-filters Prints cloud filters list. @usage acquia:contenthub-filters --interactive Allows user to select webhook to display related filters. @usage acquia:contenthub-filters --webhook=[WEBHOOK_URL] Allows user to define webhook to display related filters.

Throws

\Exception

File

src/Commands/AcquiaContentHubFiltersCommands.php, line 59

Class

AcquiaContentHubFiltersCommands
Drush command to interact with Acquia Content Hub filters.

Namespace

Drupal\acquia_contenthub\Commands

Code

public function listFilters() : void {
  $client = $this->clientFactory
    ->getClient();
  $webhooks = $client
    ->getWebHooks();

  // User can reduce filters list by site (webhook).
  $webhook = $this->input
    ->getOption('webhook');
  $isInteractive = $this->input
    ->getOption('interactive');
  $filters = $this
    ->buildCloudFiltersList($webhooks, $webhook, $isInteractive);
  if (empty($filters)) {
    $this->logger
      ->log(LogLevel::CANCEL, 'There are no cloud filters defined in this subscription.');
    return;
  }
  $rows = $this
    ->buildRows($filters, $webhooks);
  (new Table($this->output))
    ->setHeaders([
    '#',
    'UUID',
    'Name',
    'Assigned to',
    'Is real time filter',
  ])
    ->setRows($rows)
    ->render();
}