From 184b7760137ca6a77442466f43081cccb6ef82d3 Mon Sep 17 00:00:00 2001 From: tytv2 Date: Thu, 16 Apr 2026 09:48:29 +0700 Subject: [PATCH] feat(vks): add get-quota command Add `grn vks get-quota` to retrieve VKS quota limits and current usage (maxClusters, maxNodeGroupsPerCluster, maxNodesPerNodeGroup, numClusters). Co-Authored-By: Claude Sonnet 4.6 --- .../next-release/feature-vks-edyyr5ol.json | 5 ++++ go/cmd/vks/get_quota.go | 29 +++++++++++++++++++ go/cmd/vks/vks.go | 3 ++ 3 files changed, 37 insertions(+) create mode 100644 .changes/next-release/feature-vks-edyyr5ol.json create mode 100644 go/cmd/vks/get_quota.go diff --git a/.changes/next-release/feature-vks-edyyr5ol.json b/.changes/next-release/feature-vks-edyyr5ol.json new file mode 100644 index 0000000..e99aa39 --- /dev/null +++ b/.changes/next-release/feature-vks-edyyr5ol.json @@ -0,0 +1,5 @@ +{ + "type": "feature", + "category": "vks", + "description": "Add get-quota command to retrieve VKS quota limits and current usage" +} diff --git a/go/cmd/vks/get_quota.go b/go/cmd/vks/get_quota.go new file mode 100644 index 0000000..78788a0 --- /dev/null +++ b/go/cmd/vks/get_quota.go @@ -0,0 +1,29 @@ +package vks + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var getQuotaCmd = &cobra.Command{ + Use: "get-quota", + Short: "Get VKS quota for the current user", + RunE: runGetQuota, +} + +func runGetQuota(cmd *cobra.Command, args []string) error { + apiClient, err := createClient(cmd) + if err != nil { + return err + } + + result, err := apiClient.Get("/v1/quota", nil) + if err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + + return outputResult(cmd, result) +} diff --git a/go/cmd/vks/vks.go b/go/cmd/vks/vks.go index 0198ada..b0f5101 100644 --- a/go/cmd/vks/vks.go +++ b/go/cmd/vks/vks.go @@ -35,4 +35,7 @@ func init() { // Auto-upgrade commands VksCmd.AddCommand(setAutoUpgradeConfigCmd) VksCmd.AddCommand(deleteAutoUpgradeConfigCmd) + + // Quota commands + VksCmd.AddCommand(getQuotaCmd) }