From 33bfc5e376dcf4fe8e3dfe758e87a5d59d07d07a Mon Sep 17 00:00:00 2001 From: Ankush Khanna Date: Mon, 7 Oct 2024 11:58:52 +0200 Subject: [PATCH] Adding enum for permission --- compass_sdk/rbac.py | 2 +- compass_sdk/types.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compass_sdk/rbac.py b/compass_sdk/rbac.py index b64514e..213a489 100644 --- a/compass_sdk/rbac.py +++ b/compass_sdk/rbac.py @@ -58,7 +58,7 @@ def create_entities(url: str, headers: Headers, entity_request: List[T], entity_ return [entity_response.model_validate(response) for response in response.json()] @staticmethod - def delete_entities(self, url: str, headers: Headers, names: List[str], entity_response: Type[U]) -> List[U]: + def delete_entities(url: str, headers: Headers, names: List[str], entity_response: Type[U]) -> List[U]: entities = ",".join(names) response = requests.delete(f"{url}/{entities}", headers=headers) CompassRootClient.raise_for_status(response) diff --git a/compass_sdk/types.py b/compass_sdk/types.py index cc8ac60..99a1abd 100644 --- a/compass_sdk/types.py +++ b/compass_sdk/types.py @@ -1,3 +1,4 @@ +from enum import Enum from typing import List from pydantic import BaseModel @@ -40,9 +41,16 @@ class GroupUserDeleteResponse(BaseModel): user_name: str +class Permission(Enum): + READ = "read" + WRITE = "write" + ADMIN = "admin" + ROOT = "root" + + class PolicyRequest(BaseModel): indexes: List[str] - permission: str + permission: Permission class PolicyResponse(BaseModel):