Skip to main content

RevokeRole

This operation removes a role from a user.

go
func (c *Client) RevokeRole(ctx context.Context, opt RevokeRoleOption, callOpts ...grpc.CallOption) error

Request Syntax​

Creates the request for RevokeRole().

go
option := milvusclient.NewRevokeRoleOption(userName, roleName)

err := client.RevokeRole(ctx, option)

PARAMETERS:

  • userName (string) -

    [REQUIRED]

    The name of the user.

  • roleName (string) -

    [REQUIRED]

    The name of the role.

BUILDER METHODS:

  • NewRevokeRoleOption(userName string, roleName string)

    Creates the request for RevokeRole().

RETURN TYPE:

error

RETURNS:

Returns nil on success, or an error describing what went wrong.

ERROR HANDLING:

  • error

    The operation fails. Check err != nil for failure details.

Example​

Demonstrates RevokeRole() usage.

go
import (
"context"

"github.com/milvus-io/milvus/client/v3/milvusclient"
)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_ENDPOINT",
})
if err != nil {
// handle error
}
defer cli.Close(ctx)

err = cli.RevokeRole(ctx, milvusclient.NewRevokeRoleOption("my_user", "my_role"))
if err != nil {
// handle error
}
Minimum SDK versionv3.0.x
Was this page helpful?