tsungchih commented on code in PR #9242: URL: https://github.com/apache/gravitino/pull/9242#discussion_r2565587547
########## clients/client-python/gravitino/api/tag/tag_change.py: ########## @@ -0,0 +1,144 @@ +# 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 __future__ import annotations + +from abc import ABC +from dataclasses import dataclass, field + +from dataclasses_json import config + + +class TagChange(ABC): + """Interface for supporting tag changes. + This interface will be used to provide tag modification operations for each tag.""" + + @staticmethod + def rename(new_name: str) -> RenameTag: + """ + Create a tag change instance to rename the tag. + + Args: + new_name (str): The new name of the tag. + + Returns: + TagChange: A tag change instance to rename the tag. + """ + return TagChange.RenameTag(new_name) + + @staticmethod + def update_comment(new_comment: str) -> UpdateComment: + """ + Create a tag change instance to update the tag comment. + + Args: + new_comment (str): The new comment of the tag. + + Returns: + TagChange: A tag change instance to update the tag comment. + """ + return TagChange.UpdateComment(new_comment) + + @staticmethod + def set_property(tag_property: str, tag_value: str) -> SetProperty: + """ + Creates a new tag change instance to set the property and value for the tag. + + Args: + tag_property (str): The property to set. + tag_value (str): The value to set. + + Returns: + TagChange: The tag change instance to set the property and value for the tag. + """ + return TagChange.SetProperty(tag_property, tag_value) + + @staticmethod + def remove_property(tag_property: str) -> RemoveProperty: + """ + Creates a new tag change instance to remove a property from the tag. + + Args: + tag_property (str): The property to remove. + + Returns: + TagChange: The tag change instance to remove a property from the tag. + """ + return TagChange.RemoveProperty(tag_property) + + @dataclass(frozen=True, eq=True) + class RenameTag: + """A tag change to rename the tag.""" + + _new_name: str = field(metadata=config(field_name="newName")) + + @property + def new_name(self) -> str: Review Comment: I'm wondering if we would like to conform with the API in Java client. In Java client, this is a method `getNewName()` instead of a property. -- 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]
