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
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,45 @@ You can use it to set all projects of an organization to use a storage backend.
php ./cli.php manage:set-organization-storage-backend [--force/-f] <manage-token> <organization-id> <storage-backend-id> <hostname-suffix>
```

## List Storage Backends
Read-only inventory of a stack's storage backends with a cleanup verdict per backend. Nothing is modified.
Pairs with `manage:delete-backend` — the ID lists printed at the end are ready to paste into it.

- Run the command
```
php ./cli.php manage:list-backends <manage-token> <stack-url> [--format=table|csv] [--verdict=VERDICT] [--unsupported]
```
Arguments:
- manage-token (required) Manage API token for the stack.
- stack-url (required) Full stack URL, e.g. https://connection.keboola.com.

Options:
- --format Output format, `table` (default) or `csv`. In `csv` mode the summary goes to stderr so stdout stays parseable.
- --verdict Show only backends with the given verdict (validated against the list below).
- --unsupported Show only backends that are not snowflake/bigquery — i.e. both `DELETE_UNSUPPORTED_UNUSED` and `REVIEW_UNSUPPORTED_IN_USE` in one pass. Composable with `--verdict`.

With filters active, the summary and the paste-ready delete ID lists cover the shown rows only
(the header says `Backends shown: X of Y`), so what you see is exactly what you'd delete.

Verdicts (backends we keep are snowflake and bigquery; everything else is a decommissioned type
such as mysql/redshift/synapse/exasol/teradata, or a parked PoC such as supabase):
- `DELETE_UNSUPPORTED_UNUSED` — not snowflake/bigquery, 0 projects and 0 maintainers. Safe to delete.
- `DELETE_UNUSED` — snowflake/bigquery, 0 projects and 0 maintainers.
- `REVIEW_UNSUPPORTED_IN_USE` — not snowflake/bigquery, but still has projects or maintainers.
- `REVIEW_MAINTAINER_ONLY` — 0 projects, but a maintainer still points at it as its default backend.
- `KEEP` — has live projects.

Counts come from `assignedProjectsCount` / `assignedMaintainersCount` and cover live projects only.
A backend showing 0 can still be blocked by soft-deleted, not-yet-purged projects — the delete guard refuses those.

The command fetches the detail of every displayed backend (`Client::getStorageBackend()`, with the
client's built-in backoff) to add columns that are not in the list response: `loginType`, `keyRotated`
(= `keyPairLastRotatedAt`, date only), `dynBackends` (= `useDynamicBackends`), `useSso`, `ssoEnabled`,
`ssoConfigured`. Booleans render as 1/0, empty when the detail does not report the field (e.g. BigQuery
has no `loginType`). A failed detail call leaves the extra columns empty, keeps the row and reports the
affected backend IDs on stderr — verdicts and counts always come from the list response, so a failed
detail cannot change the delete lists.

## Delete Storage Backend
Delete one or more storage backends from a stack by their IDs. Dry-run by default.

Expand Down
2 changes: 2 additions & 0 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Keboola\Console\Command\DeleteOwnerlessWorkspaces;
use Keboola\Console\Command\DescribeOrganizationWorkspaces;
use Keboola\Console\Command\LineageEventsExport;
use Keboola\Console\Command\ListStorageBackends;
use Keboola\Console\Command\MassDeleteProjectWorkspaces;
use Keboola\Console\Command\MassProjectEnableDynamicBackends;
use Keboola\Console\Command\MassProjectExtendExpiration;
Expand Down Expand Up @@ -71,4 +72,5 @@
$application->add(new OrganizationsAddFeature());
$application->add(new DeleteProjects());
$application->add(new DeleteStorageBackend());
$application->add(new ListStorageBackends());
$application->run();
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"keboola/sandboxes-service-api-client": "^2.1.1",
"keboola/service-client": "^1.0",
"keboola/storage-api-client": "^18.5.0",
"keboola/kbc-manage-api-php-client": "^7",
"keboola/kbc-manage-api-php-client": "^10.3",
"symfony/event-dispatcher": "^7.4",
"keboola/job-queue-api-php-client": "^5.2.0",
"symfony/config": "^7.4",
"keboola/php-datatypes": "^8.0",
"symfony/http-client": "^7.4"
"symfony/http-client": "^7.4",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
Expand Down
29 changes: 10 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading