working commit
This commit is contained in:
@@ -22,22 +22,19 @@ type DeleteGrantParams struct {
|
||||
Username string
|
||||
Operation string
|
||||
}
|
||||
type DeleteGrantResult struct {
|
||||
GrantID string `json:"grantId"`
|
||||
}
|
||||
type DeleteGrantResult struct{}
|
||||
|
||||
func (util *Util) deleteGrant(params *DeleteGrantParams) (*DeleteGrantResult, error) {
|
||||
var err error
|
||||
res := &DeleteGrantResult{}
|
||||
ctx := context.Background()
|
||||
operParams := &mbctl.SetGrantParams{
|
||||
operParams := &mbctl.DeleteGrantParams{
|
||||
Username: params.Username,
|
||||
Operation: params.Operation,
|
||||
}
|
||||
operRes, err := util.oper.SetGrant(ctx, util.operID, operParams)
|
||||
_, err = util.oper.DeleteGrant(ctx, util.operID, operParams)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res.GrantID = operRes.GrantID
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (util *Util) BuildCmds() *cobra.Command {
|
||||
util.commonParams.Password = vi.GetString("pass")
|
||||
|
||||
var setGrantCmd = &cobra.Command{
|
||||
Use: "set name|id password",
|
||||
Use: "set username grant",
|
||||
Short: "Set grant for account",
|
||||
Args: cobra.ExactArgs(2),
|
||||
Run: util.SetGrant,
|
||||
@@ -65,9 +65,9 @@ func (util *Util) BuildCmds() *cobra.Command {
|
||||
subCmd.AddCommand(setGrantCmd)
|
||||
|
||||
var deleteGrantCmd = &cobra.Command{
|
||||
Use: "delete name|id grant",
|
||||
Use: "delete username|id grant",
|
||||
Short: "Delete grant for account",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Args: cobra.ExactArgs(2),
|
||||
Run: util.DeleteGrant,
|
||||
}
|
||||
subCmd.AddCommand(deleteGrantCmd)
|
||||
|
||||
Reference in New Issue
Block a user