Skip to content

feat: On regional APIs, list from all locations by default#675

Open
avirtopeanu-ionos wants to merge 6 commits into
masterfrom
feat/regional-api-list-all
Open

feat: On regional APIs, list from all locations by default#675
avirtopeanu-ionos wants to merge 6 commits into
masterfrom
feat/regional-api-list-all

Conversation

@avirtopeanu-ionos
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 11:56
@avirtopeanu-ionos avirtopeanu-ionos changed the title feat: regional APIs list from all locations by default feat: On regional APIs, list from all locations by default May 21, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in core helper to make regional “list” commands query all locations by default (when --location is not explicitly set), merging results into a single table with a Location column, and updating shell completion + generated docs accordingly.

Changes:

  • Introduces CommandConfig.ListAllLocations to fan out concurrent per-location list calls and merge results for text/JSON output modes.
  • Adds a regional, per-location SDK config builder (client.NewRegionalConfig) to avoid mutating the global client singleton.
  • Updates multiple regional list commands (VPN, Monitoring, Logging Service, Kafka clusters, DNS, DBaaS, Cert Manager, CDN) + docs to reflect the new default behavior.

Reviewed changes

Copilot reviewed 192 out of 192 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/printer/table/table.go Adds helpers for table row/raw manipulation and exports query-filter application.
internal/core/regional_list.go Implements concurrent multi-location listing + output merging.
internal/core/regional_list_test.go Adds unit tests for resolving regional config via command annotations.
internal/core/flag-option.go Updates completion logic to query across all locations when --location isn’t explicitly set.
internal/core/config_integration.go Persists regional metadata in command annotations; updates --location help text.
internal/client/regional.go Adds helper to build per-location SDK configurations without mutating the singleton.
commands/vpn/wireguard/gateway/list.go Switches gateway list to ListAllLocations with per-location VPN client.
commands/vpn/ipsec/gateway/list.go Switches gateway list to ListAllLocations with per-location VPN client.
commands/monitoring/pipeline/list.go Switches pipeline list to ListAllLocations with per-location monitoring client.
commands/logging-service/pipeline/list.go Switches pipeline list to ListAllLocations with per-location logging client.
commands/kafka/cluster/list.go Switches cluster list to ListAllLocations with per-location Kafka client.
commands/kafka/topic/list.go Adjusts examples/required-flag behavior for topic listing.
commands/dns/zone/list.go Switches zone list to ListAllLocations with per-location DNS client.
commands/dns/secondary-zones/list.go Switches secondary-zone list to ListAllLocations with per-location DNS client.
commands/dns/reverse-record/list.go Switches reverse-record list to ListAllLocations with per-location DNS client.
commands/dbaas/postgres-v2/cluster/list.go Switches Postgres cluster list to ListAllLocations with per-location DBaaS client.
commands/dbaas/mariadb/cluster/list.go Switches MariaDB cluster list to ListAllLocations with per-location DBaaS client.
commands/dbaas/inmemorydb/snapshot/list.go Switches InMemoryDB snapshot list to ListAllLocations with per-location client.
commands/dbaas/inmemorydb/replicaset/list.go Switches InMemoryDB replicaset list to ListAllLocations with per-location client.
commands/cert/provider/list.go Switches provider list to ListAllLocations with per-location cert client.
commands/cert/certificate/list.go Switches certificate list to ListAllLocations with per-location cert client.
commands/cert/autocertificate/list.go Switches autocertificate list to ListAllLocations with per-location cert client.
commands/cdn/distribution/list.go Switches CDN distribution list to ListAllLocations with per-location CDN client.
docs/subcommands/VPN Gateway/wireguard/peer/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/peer/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/peer/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/peer/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/peer/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/gateway/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/gateway/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/gateway/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/gateway/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/wireguard/gateway/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/tunnel/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/tunnel/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/tunnel/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/tunnel/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/tunnel/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/gateway/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/gateway/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/gateway/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/gateway/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/VPN Gateway/ipsec/gateway/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/tagging/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/tagging/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/tagging/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/retention/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/retention/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/legal/hold/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/legal/hold/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/head.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/object/copy.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/versioning/set.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/versioning/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/tagging/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/tagging/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/tagging/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/public/access/block/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/public/access/block/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/public/access/block/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/policy/status.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/policy/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/policy/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/policy/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/object/lock/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/object/lock/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/lifecycle/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/lifecycle/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/lifecycle/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/head.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/encryption/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/encryption/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/encryption/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/cors/put.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/cors/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Object-Storage/bucket/cors/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/key.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/pipeline/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/logs/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/logs/remove.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/logs/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/logs/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/logs/add.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/central/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/central/enable.md Updates --location help text to mention multi-location list default.
docs/subcommands/Logging-Service/central/disable.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/user/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/user/get/access.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/topic/list.md Updates --location help text and examples for topic listing.
docs/subcommands/Kafka/topic/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/topic/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/topic/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/cluster/list.md Updates --location help text and examples for cluster listing.
docs/subcommands/Kafka/cluster/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/cluster/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Kafka/cluster/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/file/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/file/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/zone/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/transfer/start.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/transfer/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/secondary/zone/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/reverse/record/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/reverse/record/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/reverse/record/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/reverse/record/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/reverse/record/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/record/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/record/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/record/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/record/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/record/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/quota/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/dnssec/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/dnssec/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/DNS/dnssec/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/version/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/version/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/restore.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/cluster/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/backup/location/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/backup/location/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/backup/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/postgres/v2/backup/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/cluster/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/cluster/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/cluster/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/cluster/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/cluster/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/backup/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/mariadb/backup/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/snapshot/restore/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/snapshot/restore/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/snapshot/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/replicaset/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/replicaset/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/replicaset/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Database-as-a-Service/In-Memory-DB/replicaset/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/pipeline/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/pipeline/list.md Updates --location help text and examples for pipeline listing.
docs/subcommands/Compute Engine/monitoring/pipeline/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/pipeline/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/pipeline/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/key/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/central/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/central/enable.md Updates --location help text to mention multi-location list default.
docs/subcommands/Compute Engine/monitoring/central/disable.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/provider/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/provider/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/provider/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/provider/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/provider/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/certificate/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/certificate/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/certificate/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/certificate/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/certificate/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/autocertificate/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/autocertificate/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/autocertificate/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/autocertificate/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/Certificate-Manager/autocertificate/create.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/update.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/routingrules/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/list.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/get.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/delete.md Updates --location help text to mention multi-location list default.
docs/subcommands/CDN/distribution/create.md Updates --location help text to mention multi-location list default.
Comments suppressed due to low confidence (1)

commands/kafka/topic/list.go:40

  • This list command no longer requires --location, but it still uses client.Must().Kafka with the single server-url selected by WithRegionalConfigOverride (defaulting to the first location when the flag isn’t explicitly changed). That means it does NOT “list from all locations by default”, unlike other updated list commands using CommandConfig.ListAllLocations. Consider refactoring this command to use ListAllLocations (and creating per-location clients) so it matches the new regional list default behavior described by the PR.
			Example: `ionosctl kafka topic list --cluster-id CLUSTER_ID
ionosctl kafka topic list --location LOCATION --cluster-id CLUSTER_ID`,
			PreCmdRun: func(cmd *core.PreCommandConfig) error {
				return nil
			},
			CmdRun: func(cmd *core.CommandConfig) error {
				if !cmd.Command.Command.Flags().Changed(constants.FlagClusterId) {
					return listAll(cmd)
				}

				clusterID, _ := cmd.Command.Command.Flags().GetString(constants.FlagClusterId)
				topics, _, err := client.Must().Kafka.TopicsApi.ClustersTopicsGet(
					context.Background(), clusterID,
				).Execute()
				if err != nil {
					return err
				}

				return cmd.Printer(allCols).Prefix("items").Print(topics)
			},

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/core/regional_list.go Outdated
Comment thread internal/core/regional_list.go Outdated
Comment thread internal/client/regional.go Outdated
Comment thread internal/core/flag-option.go
Comment thread internal/printer/table/table.go Outdated
@avirtopeanu-ionos avirtopeanu-ionos force-pushed the feat/regional-api-list-all branch from 8419aeb to a039ec5 Compare May 22, 2026 09:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 193 out of 193 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

commands/kafka/topic/list.go:29

  • The example and PreCmdRun no longer require --location, but this command still builds the Kafka client from the (default) location set by WithRegionalConfigOverride and does not use ListAllLocations. As a result, ionosctl kafka topic list --cluster-id ... will only work for clusters in the default location, and IDs from other locations will fail unless the user manually sets --location—which now contradicts the example. Either restore the required --location check when operating on a specific --cluster-id, or update the implementation to resolve/query the correct location when --location is not explicitly set.
			Example: `ionosctl kafka topic list --cluster-id CLUSTER_ID
ionosctl kafka topic list --location LOCATION --cluster-id CLUSTER_ID`,
			PreCmdRun: func(cmd *core.PreCommandConfig) error {
				return nil
			},
			CmdRun: func(cmd *core.CommandConfig) error {
				if !cmd.Command.Command.Flags().Changed(constants.FlagClusterId) {
					return listAll(cmd)
				}

Comment thread internal/core/flag-option.go
Comment thread internal/core/regional_list.go
Comment thread internal/core/regional_list.go
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants