updateCredential()
A MilvusClient interface. This method updates the password corresponding to a given username. The original username and password must be provided to check if the update operation is valid.
R<RpcStatus> updateCredential(UpdateCredentialParam requestParam);
UpdateCredentialParam
Use the UpdateCredentialParam.Builder
to construct an UpdateCredentialParam
object.
import io.milvus.param.UpdateCredentialParam;
UpdateCredentialParam.Builder builder = UpdateCredentialParam.newBuilder();
Methods of UpdateCredentialParam.Builder
:
withUsername(String username) | Sets the username. Username cannot be empty or null. | username: The user name. |
---|---|---|
withUsername(String username) | Sets the username. Username cannot be empty or null. | username: The user name. |
withOldPassword(String password) | Sets the old password. Old password cannot be empty or null. | password: The old password. |
withNewPassword(String password) | Sets the new password. New password cannot be empty or null. | password: The new password. |
build() | Constructs a UpdateCredentialParam object. | N/A |
The UpdateCredentialParam.Builder.build()
can throw the following exceptions:
- ParamException: error if the parameter is invalid.
Returns
This method catches all the exceptions and returns an R<RpcStatus>
object.
-
If the API fails on the server side, it returns the error code and message from the server.
-
If the API fails by RPC exception, it returns
R.Status.Unknown
and the error message of the exception. -
If the API succeeds, it returns
R.Status.Success
.
Example
import io.milvus.param.*;
UpdateCredentialParam param = UpdateCredentialParam.newBuilder()
.withUsername("user")
.withOldPassword("old_password")
.withNewPassword("new_password")
.build();
R<RpcStatus> response = client.updateCredential(param)
if (response.getStatus() != R.Status.Success.getCode()) {
System.out.println(response.getMessage());
}