Skip to main content

UpdatePassword

This operation updates the password for an existing user.

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

Request Syntax​

Creates the request for UpdatePassword().

go
option := milvusclient.NewUpdatePasswordOption(userName, oldPassword, newPassword)

err := client.UpdatePassword(ctx, option)

PARAMETERS:

  • userName (string) -

    [REQUIRED]

    The name of the user.

  • oldPassword (string) -

    [REQUIRED]

    The current password for verification.

  • newPassword (string) -

    [REQUIRED]

    The new password to set.

BUILDER METHODS:

  • NewUpdatePasswordOption(userName string, oldPassword string, newPassword string)

    Creates the request for UpdatePassword().

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 UpdatePassword() 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.UpdatePassword(ctx, milvusclient.NewUpdatePasswordOption("my_user", "P@ssw0rd", "NewP@ssw0rd"))
if err != nil {
// handle error
}
Minimum SDK versionv3.0.x
Was this page helpful?