增加grant的ds字段
This commit is contained in:
13
cmd.pb.go
13
cmd.pb.go
@@ -2222,6 +2222,7 @@ type Grant struct {
|
|||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
SrtaAccountId uint32 `protobuf:"varint,1,opt,name=srta_account_id,json=srtaAccountId,proto3" json:"srta_account_id,omitempty"` // sRTA授权目标账号ID
|
SrtaAccountId uint32 `protobuf:"varint,1,opt,name=srta_account_id,json=srtaAccountId,proto3" json:"srta_account_id,omitempty"` // sRTA授权目标账号ID
|
||||||
GrantIndex string `protobuf:"bytes,2,opt,name=grant_index,json=grantIndex,proto3" json:"grant_index,omitempty"` // 授权索引。格式为 "index1, index2, index55-index64",例如 "1, 2, 55-64"
|
GrantIndex string `protobuf:"bytes,2,opt,name=grant_index,json=grantIndex,proto3" json:"grant_index,omitempty"` // 授权索引。格式为 "index1, index2, index55-index64",例如 "1, 2, 55-64"
|
||||||
|
DataspaceId string `protobuf:"bytes,3,opt,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 授权数据空间ID
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -2270,6 +2271,13 @@ func (x *Grant) GetGrantIndex() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Grant) GetDataspaceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DataspaceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// ScriptRun 运行脚本
|
// ScriptRun 运行脚本
|
||||||
type ScriptRun struct {
|
type ScriptRun struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@@ -4879,11 +4887,12 @@ const file_cmd_proto_rawDesc = "" +
|
|||||||
"\n" +
|
"\n" +
|
||||||
"BindDelete\x12#\n" +
|
"BindDelete\x12#\n" +
|
||||||
"\x05binds\x18\x02 \x03(\v2\r.saasapi.BindR\x05binds\"\v\n" +
|
"\x05binds\x18\x02 \x03(\v2\r.saasapi.BindR\x05binds\"\v\n" +
|
||||||
"\tGrantList\"P\n" +
|
"\tGrantList\"s\n" +
|
||||||
"\x05Grant\x12&\n" +
|
"\x05Grant\x12&\n" +
|
||||||
"\x0fsrta_account_id\x18\x01 \x01(\rR\rsrtaAccountId\x12\x1f\n" +
|
"\x0fsrta_account_id\x18\x01 \x01(\rR\rsrtaAccountId\x12\x1f\n" +
|
||||||
"\vgrant_index\x18\x02 \x01(\tR\n" +
|
"\vgrant_index\x18\x02 \x01(\tR\n" +
|
||||||
"grantIndex\"\xa1\x01\n" +
|
"grantIndex\x12!\n" +
|
||||||
|
"\fdataspace_id\x18\x03 \x01(\tR\vdataspaceId\"\xa1\x01\n" +
|
||||||
"\tScriptRun\x12\x1d\n" +
|
"\tScriptRun\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"lua_script\x18\x01 \x01(\tR\tluaScript\x12\x1d\n" +
|
"lua_script\x18\x01 \x01(\tR\tluaScript\x12\x1d\n" +
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ message GrantList {
|
|||||||
message Grant {
|
message Grant {
|
||||||
uint32 srta_account_id = 1; // sRTA授权目标账号ID
|
uint32 srta_account_id = 1; // sRTA授权目标账号ID
|
||||||
string grant_index = 2; // 授权索引。格式为 "index1, index2, index55-index64",例如 "1, 2, 55-64"
|
string grant_index = 2; // 授权索引。格式为 "index1, index2, index55-index64",例如 "1, 2, 55-64"
|
||||||
|
string dataspace_id = 3; // 授权数据空间ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import (
|
|||||||
type grantAddParams struct {
|
type grantAddParams struct {
|
||||||
srtaAccountId uint32
|
srtaAccountId uint32
|
||||||
grantIndex string
|
grantIndex string
|
||||||
|
ds string
|
||||||
saasHttp *saashttp.SaasClient
|
saasHttp *saashttp.SaasClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunGrantAdd(args ...string) error {
|
func RunGrantAdd(args ...string) error {
|
||||||
fs := flag.NewFlagSet("add", flag.ExitOnError)
|
fs := flag.NewFlagSet("add", flag.ExitOnError)
|
||||||
cfgFile := paramConfig(fs)
|
cfgFile := paramConfig(fs)
|
||||||
|
ds := paramDataSpaceId(fs)
|
||||||
srtaAccountId := paramSrtaAccountId(fs)
|
srtaAccountId := paramSrtaAccountId(fs)
|
||||||
grantIndex := paramGrantIndex(fs)
|
grantIndex := paramGrantIndex(fs)
|
||||||
|
|
||||||
@@ -33,6 +35,12 @@ func RunGrantAdd(args ...string) error {
|
|||||||
return nil
|
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 {
|
if *srtaAccountId == 0 {
|
||||||
fmt.Fprintln(os.Stderr, "Error: sRTA account ID is required")
|
fmt.Fprintln(os.Stderr, "Error: sRTA account ID is required")
|
||||||
fs.PrintDefaults()
|
fs.PrintDefaults()
|
||||||
@@ -54,6 +62,7 @@ func RunGrantAdd(args ...string) error {
|
|||||||
grantAddParams := grantAddParams{
|
grantAddParams := grantAddParams{
|
||||||
srtaAccountId: uint32(*srtaAccountId),
|
srtaAccountId: uint32(*srtaAccountId),
|
||||||
grantIndex: *grantIndex,
|
grantIndex: *grantIndex,
|
||||||
|
ds: *ds,
|
||||||
saasHttp: &saashttp.SaasClient{
|
saasHttp: &saashttp.SaasClient{
|
||||||
Client: &http.Client{},
|
Client: &http.Client{},
|
||||||
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
|
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
|
||||||
@@ -70,6 +79,7 @@ func doGrantAdd(params grantAddParams) error {
|
|||||||
GrantAdd: &saasapi.Grant{
|
GrantAdd: &saasapi.Grant{
|
||||||
SrtaAccountId: params.srtaAccountId,
|
SrtaAccountId: params.srtaAccountId,
|
||||||
GrantIndex: params.grantIndex,
|
GrantIndex: params.grantIndex,
|
||||||
|
DataspaceId: params.ds,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import (
|
|||||||
type grantDeleteParams struct {
|
type grantDeleteParams struct {
|
||||||
srtaAccountId uint32
|
srtaAccountId uint32
|
||||||
grantIndex string
|
grantIndex string
|
||||||
|
ds string
|
||||||
saasHttp *saashttp.SaasClient
|
saasHttp *saashttp.SaasClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunGrantDelete(args ...string) error {
|
func RunGrantDelete(args ...string) error {
|
||||||
fs := flag.NewFlagSet("delete", flag.ExitOnError)
|
fs := flag.NewFlagSet("delete", flag.ExitOnError)
|
||||||
cfgFile := paramConfig(fs)
|
cfgFile := paramConfig(fs)
|
||||||
|
ds := paramDataSpaceId(fs)
|
||||||
srtaAccountId := paramSrtaAccountId(fs)
|
srtaAccountId := paramSrtaAccountId(fs)
|
||||||
grantIndex := paramGrantIndex(fs)
|
grantIndex := paramGrantIndex(fs)
|
||||||
|
|
||||||
@@ -33,6 +35,12 @@ func RunGrantDelete(args ...string) error {
|
|||||||
return nil
|
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 {
|
if *srtaAccountId == 0 {
|
||||||
fmt.Fprintln(os.Stderr, "Error: sRTA account ID is required")
|
fmt.Fprintln(os.Stderr, "Error: sRTA account ID is required")
|
||||||
fs.PrintDefaults()
|
fs.PrintDefaults()
|
||||||
@@ -54,6 +62,7 @@ func RunGrantDelete(args ...string) error {
|
|||||||
grantDeleteParams := grantDeleteParams{
|
grantDeleteParams := grantDeleteParams{
|
||||||
srtaAccountId: uint32(*srtaAccountId),
|
srtaAccountId: uint32(*srtaAccountId),
|
||||||
grantIndex: *grantIndex,
|
grantIndex: *grantIndex,
|
||||||
|
ds: *ds,
|
||||||
saasHttp: &saashttp.SaasClient{
|
saasHttp: &saashttp.SaasClient{
|
||||||
Client: &http.Client{},
|
Client: &http.Client{},
|
||||||
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
|
ApiUrls: saashttp.InitAPIUrl(&cfg.ApiUrls),
|
||||||
@@ -70,6 +79,7 @@ func doGrantDelete(params grantDeleteParams) error {
|
|||||||
GrantDelete: &saasapi.Grant{
|
GrantDelete: &saasapi.Grant{
|
||||||
SrtaAccountId: params.srtaAccountId,
|
SrtaAccountId: params.srtaAccountId,
|
||||||
GrantIndex: params.grantIndex,
|
GrantIndex: params.grantIndex,
|
||||||
|
DataspaceId: params.ds,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user