UpdatePassword()
Addedv2.6.x
This operation updates the password for an existing user.
func (c *Client) UpdatePassword(ctx context.Context, opt UpdatePasswordOption, callOpts ...grpc.CallOption) error
Request Syntax
option := milvusclient.NewUpdatePasswordOption(userName, oldPassword, newPassword)
err := client.UpdatePassword(ctx, option)
PARAMETERS:
-
userName (string)
The name of the user.
-
oldPassword (string)
The current password for verification.
-
newPassword (string)
The new password to set.
RETURN TYPE:
error
RETURNS:
Returns nil on success, or an error describing what went wrong.
EXCEPTIONS:
-
error
Check
err != nilfor failure details.
Example
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: "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
}