Platformsh\Cli\Command\Snapshot\SnapshotCreateCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateInput($input);
        $selectedEnvironment = $this->getSelectedEnvironment();
        $environmentId = $selectedEnvironment->id;
        if (!$selectedEnvironment->operationAvailable('backup')) {
            $this->stdErr->writeln("Operation not available: cannot create a snapshot of <error>{$environmentId}</error>");
            if ($selectedEnvironment->is_dirty) {
                $this->api()->clearEnvironmentsCache($selectedEnvironment->project);
            }
            return 1;
        }
        $activity = $selectedEnvironment->backup();
        $this->stdErr->writeln("Creating a snapshot of <info>{$environmentId}</info>");
        if (!$input->getOption('no-wait')) {
            $this->stdErr->writeln("Waiting for the snapshot to complete...");
            $success = ActivityUtil::waitAndLog($activity, $this->stdErr, "A snapshot of environment <info>{$environmentId}</info> has been created", "The snapshot failed");
            if (!$success) {
                return 1;
            }
        }
        if (!empty($activity['payload']['backup_name'])) {
            $name = $activity['payload']['backup_name'];
            $output->writeln("Snapshot name: <info>{$name}</info>");
        }
        return 0;
    }
SnapshotCreateCommand