Skip to main content

RevokePrivilegeV2

This operation revokes a privilege from a role using the v2 API.

go
func (c *Client) RevokePrivilegeV2(ctx context.Context, option RevokePrivilegeV2Option, callOptions ...grpc.CallOption) error

Request Syntax​

Creates the request for RevokePrivilegeV2().

go
option := milvusclient.NewRevokePrivilegeV2Option(roleName, privilegeName, collectionName).
WithDbName(dbName)

err := client.RevokePrivilegeV2(ctx, option)

PARAMETERS:

  • roleName (string) -

    [REQUIRED]

    The name of the role.

  • privilegeName (string) -

    [REQUIRED]

    The name of the privilege.

  • collectionName (string) -

    [REQUIRED]

    The name of the target collection.

BUILDER METHODS:

  • NewRevokePrivilegeV2Option(roleName string, privilegeName string, collectionName string)

    Creates the request for RevokePrivilegeV2().

  • WithDbName(dbName string)

    Specifies the database to use for the operation.

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 RevokePrivilegeV2() 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.RevokePrivilegeV2(ctx, milvusclient.NewRevokePrivilegeV2Option("my_role", "Search", "quick_setup"))
if err != nil {
// handle error
}
Minimum SDK versionv3.0.x
Was this page helpful?