Skip to content

Commit 89ebf5c

Browse files
author
Jordi Donadeu
committed
Merge branch 'block-storage-methods' into 'master'
Block storage methods See merge request transip/restapi-cli-client!177
2 parents 9a1eaba + d86f614 commit 89ebf5c

28 files changed

+548
-21
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
CHANGELOG
22
=========
33

4+
6.32.0
5+
-----
6+
* Added block storage commands. Deprecated big storage methods.
7+
48
6.31.0
59
-----
610
* Added ssh key support to rescue images

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/console": "^5.4",
2424
"symfony/finder": "^5.4",
2525
"symfony/filesystem": "^5.4",
26-
"transip/transip-api-php": "^6.45",
26+
"transip/transip-api-php": "^6.48",
2727
"symfony/yaml": "^5.4"
2828
},
2929
"require-dev": {

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Command/AbstractCommand.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\Console\Input\InputInterface;
99
use Symfony\Component\Console\Input\InputOption;
1010
use Symfony\Component\Console\Output\OutputInterface;
11+
use Symfony\Component\Console\Style\SymfonyStyle;
1112
use Transip\Api\CLI\Command\Setup\Setup;
1213
use Transip\Api\CLI\ConsoleOutput\Interfaces\OutputInterface as ConsoleOutputInterface;
1314
use Transip\Api\CLI\ConsoleOutput\OutputFactory;
@@ -31,6 +32,9 @@ abstract class AbstractCommand extends Command
3132
*/
3233
private $output;
3334

35+
/** @var SymfonyStyle */
36+
private $io;
37+
3438
public function __construct(string $name = null)
3539
{
3640
parent::__construct($name);
@@ -90,6 +94,8 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
9094
$formatter = $helperSet->get('formatter');
9195

9296
$settings->ensureConfigFileIsReadOnly($formatter, $output);
97+
98+
$this->io = new SymfonyStyle($input, $output);
9399
}
94100

95101
$this->input = $input;
@@ -114,6 +120,11 @@ protected function output($data): void
114120
$this->output->writeln($formattedOutput);
115121
}
116122

123+
protected function warning(string $message): void
124+
{
125+
$this->io->getErrorStyle()->warning($message);
126+
}
127+
117128
private function getFormatterFromInput(): ConsoleOutputInterface
118129
{
119130
$formatType = $this->input->getOption(Field::FORMAT);

src/Command/BigStorage/AttachVps.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ protected function configure(): void
2020
->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC)
2121
->addArgument(Field::VPS_NAME, InputArgument::REQUIRED, 'Name of the vps that the big storage should attach to.')
2222
->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC)
23-
->setHelp('This command will attach your big storage to your vps.');
23+
->setHelp('This command will attach your big storage to your vps. [deprecated] Use blockstorage:attachvps instead.');
2424
}
2525

2626
protected function execute(InputInterface $input, OutputInterface $output): int
2727
{
28+
$this->warning('Deprecated: use blockstorage:attachvps instead');
2829
$bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME);
2930
$bigStorageVpsName = $input->getArgument(Field::VPS_NAME);
3031
$waitForAction = $input->getOption(Field::ACTION_WAIT);

src/Command/BigStorage/Backup/GetByBigStorageName.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ protected function configure(): void
1616
$this->setName('bigstorage:backup:getbybigstoragename')
1717
->setDescription('Get a list of backups for a big storage')
1818
->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC)
19-
->setHelp('This command lists backups for any given big storage.');
19+
->setHelp('This command lists backups for any given big storage. [deprecated] Use blockstorage:backup:getbyblockstoragename instead.');
2020
}
2121

2222
protected function execute(InputInterface $input, OutputInterface $output): int
2323
{
24+
$this->warning('Deprecated: use blockstorage:backup:getbyblockstoragename instead');
2425
$bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME);
2526
$vps = $this->getTransipApi()->bigStorageBackups()->getByBigStorageName($bigStorageName);
2627
$this->output($vps);

src/Command/BigStorage/Backup/Revert.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ protected function configure(): void
2121
->addArgument(Field::BIGSTORAGE_BACKUP_DESTINATION_NAME, InputArgument::OPTIONAL, Field::BIGSTORAGE_BACKUP_DESTINATION_NAME__DESC . Field::OPTIONAL)
2222
->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC)
2323
->addOption(Field::ACTION_PROGRESS, 'p', InputOption::VALUE_NONE, Field::ACTION_PROGRESS_DESC)
24-
->setHelp('This command restores a big storage backup.');
24+
->setHelp('This command restores a big storage backup. [deprecated] Use blockstorage:backup:revert instead.');
2525
}
2626

2727
protected function execute(InputInterface $input, OutputInterface $output): int
2828
{
29+
$this->warning('Deprecated: use blockstorage:backup:revert instead');
2930
$bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME);
3031
$bigStorageBackupId = $input->getArgument(Field::BIGSTORAGE_BACKUPID);
3132
$destinationBigStorageName = $input->getArgument(Field::BIGSTORAGE_BACKUP_DESTINATION_NAME) ?? '';

src/Command/BigStorage/Cancel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ protected function configure(): void
1818
->setDescription('Terminate or cancel your big storage')
1919
->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC)
2020
->addArgument(Field::CANCELTIME, InputArgument::REQUIRED, Field::CANCELTIME__DESC)
21-
->setHelp('This command will terminate or cancel your big storage.');
21+
->setHelp('This command will terminate or cancel your big storage. [deprecated] Use blockstorage:cancel instead.');
2222
}
2323

2424
protected function execute(InputInterface $input, OutputInterface $output): int
2525
{
26+
$this->warning('Deprecated: use blockstorage:cancel instead');
2627
$bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME);
2728
if (strlen($bigStorageName) < 3) {
2829
throw new Exception('Invalid big storage name provided');

src/Command/BigStorage/DetachVps.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ protected function configure(): void
1919
->setDescription('Detach your big storage to your vps')
2020
->addArgument(Field::BIGSTORAGE_NAME, InputArgument::REQUIRED, Field::BIGSTORAGE_NAME__DESC)
2121
->addOption(Field::ACTION_WAIT, 'w', InputOption::VALUE_NONE, Field::ACTION_WAIT_DESC)
22-
->setHelp('This command will detach your big storage from your vps.');
22+
->setHelp('This command will detach your big storage from your vps. [deprecated] Use blockstorage:detachvps instead.');
2323
}
2424

2525
protected function execute(InputInterface $input, OutputInterface $output): int
2626
{
27+
$this->warning('Deprecated: use blockstorage:detachvps instead');
2728
$bigStorageName = $input->getArgument(Field::BIGSTORAGE_NAME);
2829
$waitForAction = $input->getOption(Field::ACTION_WAIT);
2930

src/Command/BigStorage/GetAll.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class GetAll extends AbstractCommand
1212
protected function configure(): void
1313
{
1414
$this->setName('bigstorage:getall')
15-
->setDescription('Get all of your big storages');
15+
->setDescription('Get all of your big storages')
16+
->setHelp('This command will return all your big storages. [deprecated] Use blockstorage:getall instead.');
1617
}
1718
protected function execute(InputInterface $input, OutputInterface $output): int
1819
{
20+
$this->warning('Deprecated: use blockstorage:getall instead');
1921
$bigStorages = $this->getTransipApi()->bigStorages()->getAll();
2022

2123
$this->output($bigStorages);

0 commit comments

Comments
 (0)