41 lines
869 B
Go
41 lines
869 B
Go
/*
|
|
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
|
|
*/
|
|
package grant
|
|
|
|
import (
|
|
"context"
|
|
|
|
"mbase/pkg/mbctl"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func (util *Util) DeleteGrant(cmd *cobra.Command, args []string) {
|
|
util.deleteGrantParams.Username = args[0]
|
|
util.deleteGrantParams.Grantname = args[1]
|
|
res, err := util.deleteGrant(&util.deleteGrantParams)
|
|
printResponse(res, err)
|
|
}
|
|
|
|
type DeleteGrantParams struct {
|
|
Username string
|
|
Grantname string
|
|
}
|
|
type DeleteGrantResult struct{}
|
|
|
|
func (util *Util) deleteGrant(params *DeleteGrantParams) (*DeleteGrantResult, error) {
|
|
var err error
|
|
res := &DeleteGrantResult{}
|
|
ctx := context.Background()
|
|
operParams := &mbctl.DeleteGrantParams{
|
|
Username: params.Username,
|
|
Grantname: params.Grantname,
|
|
}
|
|
_, err = util.oper.DeleteGrant(ctx, util.operID, operParams)
|
|
if err != nil {
|
|
return res, err
|
|
}
|
|
return res, err
|
|
}
|