You are here

class CreateEdgeRoleCommand in Apigee Edge 8

Developer synchronization command class for Drupal Console.

@Drupal\Console\Annotations\DrupalCommand ( extension="apigee_edge", extensionType="module" )

Hierarchy

  • class \Drupal\apigee_edge\Command\CommandBase extends \Drupal\Console\Core\Command\Command uses \Drupal\Console\Core\Command\Shared\CommandTrait

Expanded class hierarchy of CreateEdgeRoleCommand

1 file declares its use of CreateEdgeRoleCommand
CreateEdgeRoleCommandTest.php in tests/src/Unit/Command/CreateEdgeRoleCommandTest.php
1 string reference to 'CreateEdgeRoleCommand'
console.services.yml in ./console.services.yml
console.services.yml
1 service uses CreateEdgeRoleCommand
apigee_edge.edge_role_create in ./console.services.yml
Drupal\apigee_edge\Command\CreateEdgeRoleCommand

File

src/Command/CreateEdgeRoleCommand.php, line 35

Namespace

Drupal\apigee_edge\Command
View source
class CreateEdgeRoleCommand extends CommandBase {

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this
      ->setName('apigee_edge:role:create')
      ->setDescription($this
      ->trans('commands.apigee_edge.role.create.description'))
      ->setHelp('commands.apigee_edge.role.create.help')
      ->addArgument('org', InputArgument::REQUIRED, $this
      ->trans('commands.apigee_edge.role.create.arguments.org'))
      ->addArgument('email', InputArgument::REQUIRED, $this
      ->trans('commands.apigee_edge.role.create.arguments.email'))
      ->addOption('password', 'p', InputArgument::OPTIONAL, $this
      ->trans('commands.apigee_edge.role.create.options.password'))
      ->addOption('base-url', 'b', InputArgument::OPTIONAL, $this
      ->trans('commands.apigee_edge.role.create.options.base-url'))
      ->addOption('role-name', 'r', InputArgument::OPTIONAL, $this
      ->trans('commands.apigee_edge.role.create.options.role-name'))
      ->addOption('force', 'f', InputOption::VALUE_NONE, $this
      ->trans('commands.apigee_edge.role.create.options.force'));
  }

  /**
   * {@inheritdoc}
   */
  public function interact(InputInterface $input, OutputInterface $output) {
    $this
      ->setupIo($input, $output);
    $password = $input
      ->getOption('password');
    if (!$password) {
      $password = $this
        ->getIo()
        ->askHidden($this
        ->trans('commands.apigee_edge.role.create.questions.password'));
      $input
        ->setOption('password', $password);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function execute(InputInterface $input, OutputInterface $output) {
    $this
      ->setupIo($input, $output);
    $org = $input
      ->getArgument('org');
    $email = $input
      ->getArgument('email');
    $password = $input
      ->getOption('password');
    $base_url = $input
      ->getOption('base-url');
    $role_name = $input
      ->getOption('role-name');
    $force = $input
      ->getOption('force');
    $this->cliService
      ->createEdgeRoleForDrupal($this
      ->getIo(), 't', $org, $email, $password, $base_url, $role_name, $force);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommandBase::$cliService protected property The interoperability cli service.
CommandBase::$io protected property The IO interface composed of a commands input and output.
CommandBase::$loggerChannelFactory protected property The logger channel factory.
CommandBase::$logMessageParser protected property The parser object.
CommandBase::getIo public function Gets the IO interface.
CommandBase::setupIo protected function Sets up the IO interface.
CommandBase::setupLogger protected function Sets up the logger service.
CommandBase::__construct public function Constructor with cli service injection.
CreateEdgeRoleCommand::configure protected function
CreateEdgeRoleCommand::execute public function
CreateEdgeRoleCommand::interact public function