Skip to content

Commit a0fdc38

Browse files
authored
feat(vks): add get-quota command (#11)
2 parents c8a9d6d + 184b776 commit a0fdc38

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "feature",
3+
"category": "vks",
4+
"description": "Add get-quota command to retrieve VKS quota limits and current usage"
5+
}

go/cmd/vks/get_quota.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

go/cmd/vks/vks.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)