跳到主要内容
版本:v3.0.x

CreatePrivilegeGroup()

This operation creates a named group of privileges that can be granted together.

Go
func (c *Client) CreatePrivilegeGroup(ctx context.Context, option CreatePrivilegeGroupOption, callOptions ...grpc.CallOption) error

Request Syntax

Go
option := milvusclient.NewCreatePrivilegeGroupOption(groupName)

err := client.CreatePrivilegeGroup(ctx, option)

PARAMETERS:

  • groupName (string)

    The name of the privilege group.

RETURN TYPE:

error

RETURNS:

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

EXCEPTIONS:

  • error

    Check err != nil for failure details.

Example

Go
import (
"context"

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

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

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

err = cli.CreatePrivilegeGroup(ctx, milvusclient.NewCreatePrivilegeGroupOption("my_priv_group"))
if err != nil {
// handle error
}