Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs #985

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Authentication

Methods related to implement role-based access control to your resources.

<DocCardList />
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# add_privileges_to_group()

This operation adds privileges to the specified privilege group.

## Request Syntax

```python
add_privileges_to_group(
self,
group_name: str,
privileges: List[str],
timeout: Optional[float] = None,
**kwargs,
)
```

**PARAMETERS:**

- **group_name** (*str*) -

The name of the target privilege group.

- **privileges** (*List[str]*) -

The privilages to add in a list.

- **timeout** (*Optional[float]*) -

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:**

*NoneType*

**RETURNS:**

*None*

**EXCEPTIONS:**

- **MilvusException**

This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

## Example

```python
from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="http://localhost:19530",
token="root:Milvus"
)

client.add_privileges_to_group(
group_name="my_privilege_group",
privileges=["ListDatabases", "DescribeDatabase"]
)
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# create_privilege_group()

This operation creates a privilege group.

## Request Syntax

```python
create_privilege_group(
self,
group_name: str,
timeout: Optional[float] = None,
**kwargs,
)
```

**PARAMETERS:**

- **group_name** (*str*) -

The name of the target privilege group.

- **timeout** (*Optional[float]*) -

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:**

*NoneType*

**RETURNS:**

*None*

**EXCEPTIONS:**

- **MilvusException**

This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

## Example

```python
from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="http://localhost:19530",
token="root:Milvus"
)

client.create_privilege_group(
group_name="my_privilege_group"
)
```

Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,3 @@ client = MilvusClient(
client.create_role(role_name="read_only")
```

## Related methods

- [describe_role()](describe_role.md)

- [drop_role()](drop_role.md)

- [grant_privilege()](grant_privilege.md)

- [grant_role()](grant_role.md)

- [list_roles()](list_roles.md)

- [revoke_privileges()](revoke_privileges.md)

- [revoke_role()](revoke_role.md)

Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,3 @@ client = MilvusClient(
client.create_user(user_name="user_1", password="P@ssw0rd")
```

## Related methods

- [describe_user()](describe_user.md)

- [drop_user()](drop_user.md)

- [list_users()](list_users.md)

- [update_password()](update_password.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# drop_privilege_group()

This operation drops the specified privilege group.

## Request Syntax

```python
drop_privilege_group(
self,
group_name: str,
timeout: Optional[float] = None,
**kwargs,
)
```

**PARAMETERS:**

- **group_name** (*str*) -

The name of the target privilege group.

- **timeout** (*Optional[float]*) -

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:**

*NoneType*

**RETURNS:**

*None*

**EXCEPTIONS:**

- **MilvusException**

This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

## Example

```python
from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="http://localhost:19530",
token="root:Milvus"
)

client.drop_privilege_group(
group_name="my_privilege_group"
)
```

Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,3 @@ client.create_role(role_name="read_only")
# 3. Drop a role
client.drop_role(role_name="read_only")
```

## Related methods

- [create_role()](create_role.md)

- [describe_role()](describe_role.md)

- [grant_privilege()](grant_privilege.md)

- [grant_role()](grant_role.md)

- [list_roles()](list_roles.md)

- [revoke_privileges()](revoke_privileges.md)

- [revoke_role()](revoke_role.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# grant_privilege_v2()

This operation grants the specified privilege or privilege group to the specified role.

## Request Syntax

```python
grant_privilege_v2(
self,
role_name: str,
privilege: str,
collection_name: str,
db_name: Optional[str] = None,
timeout: Optional[float] = None,
**kwargs,
)
```

**PARAMETERS:**

- **role_name** (*str*) -

**[REQUIRED]**

The name of the role to assign privileges to.

- **privilege** (*str*) -

**[REQUIRED]**

The name of the privilege to assign.

For details, refer to the **Privilege name** column in the table on page [Users and Roles](https://milvus.io/docs/users_and_roles.md).

- **collection_name** (*str*) -

**[REQUIRED]**

The name of a collection. To grant privileges regarding all collections in the current database, set this parameter to `*`.

- **db_name** (*str*) -

The name of a database.

This parameter is optional. Setting this parameter restricts the privilege assignment within the specified database.

- **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:**

*NoneType*

**RETURNS:**

None

**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

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# list_privilege_groups()

This operation lists all existing privilege groups.

## Request Syntax

```python
list_privilege_groups(
self,
timeout: Optional[float] = None,
**kwargs,
) -> List[Dict[str, str]]
```

**PARAMETERS:**

- **timeout** (*Optional[float]*) -

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[Dict[str, str]]*

**RETURNS:**

A list of privilege group names.

**EXCEPTIONS:**

- **MilvusException**

This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

## Example

```python
from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="http://localhost:19530",
token="root:Milvus"
)

res = client.list_privilege_groups()

# ['my_privilege_group']
```

Loading