FANNG1 commented on code in PR #8151: URL: https://github.com/apache/gravitino/pull/8151#discussion_r2289733126
########## mcp-server/mcp_server/client/policy_operation.py: ########## @@ -0,0 +1,116 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from abc import ABC, abstractmethod + + +class PolicyOperation(ABC): + """ + Abstract base class for Gravitino policy operations. + """ + + @abstractmethod + async def get_list_of_policies(self) -> str: + """ + Retrieve the list of policies. + + Returns: + str: JSON-formatted string containing policy list information + """ + pass + + @abstractmethod + async def load_policy(self, policy_name: str) -> str: + """ + Load detailed information of a specific policy. + + Args: + policy_name: Name of the policy + + Returns: + str: JSON-formatted string containing full policy metadata + """ + pass + + @abstractmethod + async def associate_policy_with_metadata( + self, + metadata_full_name: str, + metadata_type: str, + policies_to_associate: list, + policies_to_disassociate: list, + ) -> str: + """ + Associate policies with metadata. + + Args: + metadata_full_name: Full name of the metadata item (e.g., table, column) + metadata_type: Type of the metadata (e.g., "table", "column") + policies_to_associate: List of policy names to associate with the metadata + policies_to_disassociate: List of policy names to disassociate from the metadata + + Returns: + str: JSON formatted string containing list of policy names that were + successfully associated with the metadata + """ + pass + + @abstractmethod + async def get_policy_for_metadata( + self, metadata_full_name: str, metadata_type: str, policy_name: str + ) -> str: + """ + Get the policy with are associated with a specific metadata item. + + Args: + metadata_full_name: Full name of the metadata item (e.g., table, column) + metadata_type: Type of the metadata (e.g., "table", "column") + policy_name: Name of the policy + + Returns: + str: JSON formatted string containing policy metadata + """ + pass + + @abstractmethod + async def list_policies_for_metadata( + self, metadata_full_name: str, metadata_type: str + ) -> str: + """ + List all policies associated with a specific metadata item. + + Args: + metadata_full_name: Full name of the metadata item (e.g., table, column) Review Comment: Oh, got it, update with the sentence -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
