跳到主要内容

list_roles()

This operation lists all custom roles.

Request syntax

list_roles(
timeout: Optional[float] = None
) -> dict

PARAMETERS:

  • timeout (float | None)

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURN TYPE:

list

RETURNS:

A list of role names.

EXCEPTIONS:

  • MilvusException

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

  • BaseException

    This exception will be raised when this operation fails.

Example

from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password"
)

# 2. List all roles
client.list_roles()

# ['db_admin', 'db_ro', 'db_rw']
📘Notes

Each Zilliz Cloud cluster has three built-in roles, namely, db_ro, db_rw, and db_admin. For details, refer to Cluster Built-in Roles.