Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "keboola/cli-utils",
"require": {
"php": "^8.3",
"symfony/console": "^3.1",
"symfony/console": "^7.4",
"keboola/sandboxes-api-php-client": "6.32.0",
"keboola/storage-api-client": "^18.5.0",
"keboola/kbc-manage-api-php-client": "^7",
"symfony/event-dispatcher": "6.4.*",
"symfony/event-dispatcher": "^7.4",
"keboola/job-queue-api-php-client": "^5.2.0",
"psr/log": "^2.0|^3.0",
"symfony/config": "^6.0|^7.0",
"symfony/config": "^7.4",
"keboola/php-datatypes": "^8.0"
},
"require-dev": {
Expand Down
1,530 changes: 980 additions & 550 deletions composer.lock

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions src/Keboola/Console/Command/AddFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,23 @@ protected function createFeature(Client $client, string $featureName, string $fe
}
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getArguments();
$force = (bool) $input->getOption(self::OPT_FORCE);
$url = $input->getArgument(self::ARG_URL);
assert(is_string($url));
$token = $input->getArgument(self::ARG_TOKEN);
assert(is_string($token));
$featureName = $input->getArgument(self::ARG_FEATURE_NAME);
assert(is_string($featureName));
$featureTitle = $input->getArgument(self::ARG_FEATURE_TITLE);
assert(is_string($featureTitle));
$featureDesc = $input->getArgument(self::ARG_FEATURE_DESC);
assert(is_string($featureDesc));

$client = $this->createClient($args[self::ARG_URL], $args[self::ARG_TOKEN]);
$this->createFeature($client, $args[self::ARG_FEATURE_NAME], $args[self::ARG_FEATURE_TITLE], $args[self::ARG_FEATURE_DESC], $force, $output);
$this->addFeature($client, $args[self::ARG_FEATURE_NAME], $force, $output);
$client = $this->createClient($url, $token);
$this->createFeature($client, $featureName, $featureTitle, $featureDesc, $force, $output);
$this->addFeature($client, $featureName, $force, $output);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Keboola/Console/Command/AllStacksIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function configure(): void
->addArgument(self::ARG_PARAMS, InputArgument::REQUIRED, 'params');
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$commandName = $input->getArgument(self::ARG_COMMAND);
assert(is_string($commandName));
Expand Down
15 changes: 10 additions & 5 deletions src/Keboola/Console/Command/OrganizationsAddFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ protected function configure(): void
->addOption(self::OPT_FORCE, 'f', InputOption::VALUE_NONE, 'Will actually do the work, otherwise it\'s dry run');
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getArguments();
$force = (bool) $input->getOption(self::OPT_FORCE);
$featureName = $args[self::ARG_FEATURE];
$orgIDsArg = $args[self::ARG_ORGANIZATIONS];
$client = $this->createClient($args[self::ARG_URL], $args[self::ARG_TOKEN]);
$featureName = $input->getArgument(self::ARG_FEATURE);
assert(is_string($featureName));
$orgIDsArg = $input->getArgument(self::ARG_ORGANIZATIONS);
assert(is_string($orgIDsArg));
$url = $input->getArgument(self::ARG_URL);
assert(is_string($url));
$token = $input->getArgument(self::ARG_TOKEN);
assert(is_string($token));
$client = $this->createClient($url, $token);

if (!$this->checkIfFeatureExists($client, $featureName)) {
$output->writeln(sprintf('Feature %s does NOT exist', $featureName));
Expand Down
15 changes: 10 additions & 5 deletions src/Keboola/Console/Command/ProjectsAddFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,19 @@ protected function checkIfFeatureExists(Client $client, string $featureName): bo
return false;
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getArguments();
$force = (bool) $input->getOption(self::OPT_FORCE);
$featureName = $args[self::ARG_FEATURE];
$projectsOption = $args[self::ARG_PROJECTS];
$featureName = $input->getArgument(self::ARG_FEATURE);
assert(is_string($featureName));
$projectsOption = $input->getArgument(self::ARG_PROJECTS);
assert(is_string($projectsOption));
$url = $input->getArgument(self::ARG_URL);
assert(is_string($url));
$token = $input->getArgument(self::ARG_TOKEN);
assert(is_string($token));
$checkAllProjects = strtolower($projectsOption) === 'all';
$client = $this->createClient($args[self::ARG_URL], $args[self::ARG_TOKEN]);
$client = $this->createClient($url, $token);

if (!$this->checkIfFeatureExists($client, $featureName)) {
$output->writeln(sprintf('Feature %s does NOT exist', $featureName));
Expand Down
2 changes: 1 addition & 1 deletion src/Keboola/Console/Command/ProjectsRemoveFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function configure(): void
;
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$apiToken = $input->getArgument('token');
assert(is_string($apiToken));
Expand Down
4 changes: 2 additions & 2 deletions src/Keboola/Console/Command/QueueMassTerminateJobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
use Keboola\JobQueueClient\JobStatuses;
use Keboola\JobQueueClient\ListJobsOptions;
use Keboola\StorageApi\Client as StorageClient;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'queue:terminate-project-jobs')]
class QueueMassTerminateJobs extends Command
{
protected static $defaultName = 'queue:terminate-project-jobs';

const ARGUMENT_STORAGE_TOKEN = 'storage-token';
const ARGUMENT_CONNECTION_URL = 'connection-url';
const ARGUMENT_JOB_STATUS = 'job-status';
Expand Down
13 changes: 9 additions & 4 deletions src/Keboola/Console/Command/UpdateDataRetention.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,17 @@ protected function updateAllProjects(
}
}

public function execute(InputInterface $input, OutputInterface $output): ?int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$args = $input->getArguments();
$force = (bool) $input->getOption(self::OPT_FORCE);
$dataRetentionTimeInDays = (int) $args[self::ARG_DATA_RETENTION];
$client = $this->createClient($args[self::ARG_URL], $args[self::ARG_TOKEN]);
$url = $input->getArgument(self::ARG_URL);
assert(is_string($url));
$token = $input->getArgument(self::ARG_TOKEN);
assert(is_string($token));
$dataRetention = $input->getArgument(self::ARG_DATA_RETENTION);
assert(is_string($dataRetention));
$dataRetentionTimeInDays = (int) $dataRetention;
$client = $this->createClient($url, $token);

if ($force) {
$output->writeln('Force mode enabled. Projects will be updated.');
Expand Down
Loading