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
5 changes: 5 additions & 0 deletions .changes/next-release/feature-vks-edyyr5ol.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "vks",
"description": "Add get-quota command to retrieve VKS quota limits and current usage"
}
29 changes: 29 additions & 0 deletions go/cmd/vks/get_quota.go
Original file line number Diff line number Diff line change
@@ -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)
}
3 changes: 3 additions & 0 deletions go/cmd/vks/vks.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ func init() {
// Auto-upgrade commands
VksCmd.AddCommand(setAutoUpgradeConfigCmd)
VksCmd.AddCommand(deleteAutoUpgradeConfigCmd)

// Quota commands
VksCmd.AddCommand(getQuotaCmd)
}
Loading