增加grant的ds字段
This commit is contained in:
@@ -14,12 +14,14 @@ import (
|
||||
type grantAddParams struct {
|
||||
srtaAccountId uint32
|
||||
grantIndex string
|
||||
ds string
|
||||
saasHttp *saashttp.SaasClient
|
||||
}
|
||||
|
||||
func RunGrantAdd(args ...string) error {
|
||||
fs := flag.NewFlagSet("add", flag.ExitOnError)
|
||||
cfgFile := paramConfig(fs)
|
||||
ds := paramDataSpaceId(fs)
|
||||
srtaAccountId := paramSrtaAccountId(fs)
|
||||
grantIndex := paramGrantIndex(fs)
|
||||
|
||||
@@ -33,6 +35,12 @@ func RunGrantAdd(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 RunGrantAdd(args ...string) error {
|
||||
grantAddParams := grantAddParams{
|
||||
srtaAccountId: uint32(*srtaAccountId),
|
||||
grantIndex: *grantIndex,
|
||||
ds: *ds,
|
||||
saasHttp: &saashttp.SaasClient{
|
||||
Client: &http.Client{},
|
||||
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
|
||||
@@ -70,6 +79,7 @@ func doGrantAdd(params grantAddParams) error {
|
||||
GrantAdd: &saasapi.Grant{
|
||||
SrtaAccountId: params.srtaAccountId,
|
||||
GrantIndex: params.grantIndex,
|
||||
DataspaceId: params.ds,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user