メインコンテンツまでスキップ

hasRole()

Addedv2.6.x

This operation checks if a role exists in the Milvus cluster.

await milvusClient.hasRole(data: HasRoleReq)

Request Syntax

await milvusClient.hasRole({
roleName: string,
timeout?: number,
})

PARAMETERS:

  • roleName (string) -

    [REQUIRED]

    The name of the role to check.

  • timeout (number) -

    RPC timeout in milliseconds. Optional.

RETURNS:

Promise<HasRoleResponse>

The response contains a hasRole boolean indicating whether the role exists.

EXCEPTIONS:

  • MilvusError

    This exception will be raised when any error occurs during this operation.

Example

import { MilvusClient } from '@zilliz/milvus2-sdk-node';

const client = new MilvusClient({
address: 'YOUR_CLUSTER_ENDPOINT',
token: 'YOUR_CLUSTER_TOKEN',
});
const res = await client.hasRole({ roleName: 'my_role' });
console.log(res.hasRole); // true or false