增加grant的ds字段

This commit is contained in:
algotao
2025-11-19 12:32:36 +08:00
parent 25715910cb
commit 4575590faa
4 changed files with 32 additions and 2 deletions

View File

@@ -14,12 +14,14 @@ import (
type grantDeleteParams struct {
srtaAccountId uint32
grantIndex string
ds string
saasHttp *saashttp.SaasClient
}
func RunGrantDelete(args ...string) error {
fs := flag.NewFlagSet("delete", flag.ExitOnError)
cfgFile := paramConfig(fs)
ds := paramDataSpaceId(fs)
srtaAccountId := paramSrtaAccountId(fs)
grantIndex := paramGrantIndex(fs)
@@ -33,6 +35,12 @@ func RunGrantDelete(args ...string) error {
return nil
}
if len(*ds) == 0 {
fmt.Fprintln(os.Stderr, "Error: data space is required")
fs.PrintDefaults()
return fmt.Errorf("data space is required")
}
if *srtaAccountId == 0 {
fmt.Fprintln(os.Stderr, "Error: sRTA account ID is required")
fs.PrintDefaults()
@@ -54,6 +62,7 @@ func RunGrantDelete(args ...string) error {
grantDeleteParams := grantDeleteParams{
srtaAccountId: uint32(*srtaAccountId),
grantIndex: *grantIndex,
ds: *ds,
saasHttp: &saashttp.SaasClient{
Client: &http.Client{},
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
@@ -70,6 +79,7 @@ func doGrantDelete(params grantDeleteParams) error {
GrantDelete: &saasapi.Grant{
SrtaAccountId: params.srtaAccountId,
GrantIndex: params.grantIndex,
DataspaceId: params.ds,
},
},
}