alittle splitted mstorectl code; etc

This commit is contained in:
2026-03-05 12:26:14 +02:00
parent 80d6a244cf
commit 223ae2e96e
24 changed files with 631 additions and 104 deletions
+15 -15
View File
@@ -14,8 +14,8 @@ import (
"encoding/json"
"fmt"
"mstore/app/accoper"
"mstore/app/handler"
"mstore/app/operator"
"mstore/pkg/descr"
)
@@ -27,7 +27,7 @@ func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, a
if err != nil {
return res, err
}
operParams := operator.CreateGrantParams{
operParams := accoper.CreateGrantParams{
AccountID: accountID,
Right: right,
Pattern: pattern,
@@ -41,7 +41,7 @@ func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, a
return res, err
}
operRes := handler.NewResponse[operator.CreateGrantResult]()
operRes := handler.NewResponse[accoper.CreateGrantResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return res, err
@@ -62,7 +62,7 @@ func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username
if err != nil {
return res, err
}
operParams := operator.CreateGrantParams{
operParams := accoper.CreateGrantParams{
Username: username,
Right: right,
Pattern: pattern,
@@ -76,7 +76,7 @@ func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username
return res, err
}
operRes := handler.NewResponse[operator.CreateGrantResult]()
operRes := handler.NewResponse[accoper.CreateGrantResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return res, err
@@ -97,7 +97,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi, grantID string) (*desc
if err != nil {
return res, err
}
operParams := operator.GetGrantParams{
operParams := accoper.GetGrantParams{
GrantID: grantID,
}
paramsJson, err := json.Marshal(operParams)
@@ -109,7 +109,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi, grantID string) (*desc
return res, err
}
operRes := handler.NewResponse[operator.GetGrantResult]()
operRes := handler.NewResponse[accoper.GetGrantResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return res, err
@@ -129,7 +129,7 @@ func (cli *Client) UpdateGrant(ctx context.Context, hosturi, grantID, newPattern
if err != nil {
return err
}
operParams := operator.UpdateGrantParams{
operParams := accoper.UpdateGrantParams{
GrantID: grantID,
NewPattern: newPattern,
}
@@ -141,7 +141,7 @@ func (cli *Client) UpdateGrant(ctx context.Context, hosturi, grantID, newPattern
if err != nil {
return err
}
operRes := handler.NewResponse[operator.UpdateGrantResult]()
operRes := handler.NewResponse[accoper.UpdateGrantResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return err
@@ -160,7 +160,7 @@ func (cli *Client) DeleteGrant(ctx context.Context, hosturi, grantID string) err
if err != nil {
return err
}
operParams := operator.DeleteGrantParams{
operParams := accoper.DeleteGrantParams{
GrantID: grantID,
}
paramsJson, err := json.Marshal(operParams)
@@ -172,7 +172,7 @@ func (cli *Client) DeleteGrant(ctx context.Context, hosturi, grantID string) err
return err
}
operRes := handler.NewResponse[operator.DeleteGrantResult]()
operRes := handler.NewResponse[accoper.DeleteGrantResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return err
@@ -192,7 +192,7 @@ func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi, accountID
if err != nil {
return res, err
}
operParams := operator.ListGrantsParams{
operParams := accoper.ListGrantsParams{
AccountID: accountID,
}
paramsJson, err := json.Marshal(operParams)
@@ -204,7 +204,7 @@ func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi, accountID
return res, err
}
operRes := handler.NewResponse[operator.ListGrantsResult]()
operRes := handler.NewResponse[accoper.ListGrantsResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return res, err
@@ -225,7 +225,7 @@ func (cli *Client) ListGrantsByUsername(ctx context.Context, hosturi, username s
if err != nil {
return res, err
}
operParams := operator.ListGrantsParams{
operParams := accoper.ListGrantsParams{
Username: username,
}
paramsJson, err := json.Marshal(operParams)
@@ -237,7 +237,7 @@ func (cli *Client) ListGrantsByUsername(ctx context.Context, hosturi, username s
return res, err
}
operRes := handler.NewResponse[operator.ListGrantsResult]()
operRes := handler.NewResponse[accoper.ListGrantsResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return res, err