File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "type" : " feature" ,
3+ "category" : " vks" ,
4+ "description" : " Add get-quota command to retrieve VKS quota limits and current usage"
5+ }
Original file line number Diff line number Diff line change 1+ package vks
2+
3+ import (
4+ "fmt"
5+ "os"
6+
7+ "github.com/spf13/cobra"
8+ )
9+
10+ var getQuotaCmd = & cobra.Command {
11+ Use : "get-quota" ,
12+ Short : "Get VKS quota for the current user" ,
13+ RunE : runGetQuota ,
14+ }
15+
16+ func runGetQuota (cmd * cobra.Command , args []string ) error {
17+ apiClient , err := createClient (cmd )
18+ if err != nil {
19+ return err
20+ }
21+
22+ result , err := apiClient .Get ("/v1/quota" , nil )
23+ if err != nil {
24+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
25+ os .Exit (1 )
26+ }
27+
28+ return outputResult (cmd , result )
29+ }
Original file line number Diff line number Diff line change @@ -35,4 +35,7 @@ func init() {
3535 // Auto-upgrade commands
3636 VksCmd .AddCommand (setAutoUpgradeConfigCmd )
3737 VksCmd .AddCommand (deleteAutoUpgradeConfigCmd )
38+
39+ // Quota commands
40+ VksCmd .AddCommand (getQuotaCmd )
3841}
You can’t perform that action at this time.
0 commit comments