jerryshao commented on code in PR #12549:
URL: https://github.com/apache/gravitino/pull/12549#discussion_r3851130007


##########
api/src/main/java/org/apache/gravitino/tag/TagOperations.java:
##########
@@ -115,4 +119,69 @@ Tag alterTag(String name, TagChange... changes)
    * @return True if the tag is deleted, false if the tag does not exist.
    */
   boolean deleteTag(String name);
+
+  /**
+   * Lists policy names directly associated with a tag.
+   *
+   * @param tagName The tag name.
+   * @return The directly associated policy names.
+   * @throws UnsupportedOperationException If listing policy-to-tag 
associations is not supported.
+   */
+  default String[] listPoliciesForTag(String tagName) {
+    throw new UnsupportedOperationException("Listing policies for a tag is not 
supported");
+  }
+
+  /**
+   * Lists detailed policy associations for a tag.
+   *
+   * @param tagName The tag name.
+   * @return The policy associations including selectors.
+   * @throws UnsupportedOperationException If listing policy-to-tag 
associations is not supported.
+   */
+  default PolicyTagAssociation[] listPolicyAssociationsForTag(String tagName) {
+    throw new UnsupportedOperationException(
+        "Listing policy associations for a tag is not supported");
+  }
+
+  /**
+   * Adds one policy association for a tag using {@link AllValuesSelector}. It 
matches by tag
+   * presence regardless of assignment values and does not replace an existing 
association.
+   *
+   * @param tagName The tag name.
+   * @param policyName The policy name.
+   * @return The resulting association.
+   * @throws PolicyAlreadyAssociatedException If the policy is already 
associated with the tag.
+   * @throws UnsupportedOperationException If adding policy-to-tag 
associations is not supported.
+   */
+  default PolicyTagAssociation addPolicyForTag(String tagName, String 
policyName)
+      throws PolicyAlreadyAssociatedException {
+    return addPolicyForTag(tagName, policyName, AllValuesSelector.get());
+  }
+
+  /**
+   * Adds one policy association for a tag. It does not replace an existing 
association.
+   *
+   * @param tagName The tag name.
+   * @param policyName The policy name.
+   * @param selector The non-null policy association selector.
+   * @return The resulting association.
+   * @throws PolicyAlreadyAssociatedException If the policy is already 
associated with the tag.
+   * @throws UnsupportedOperationException If adding policy-to-tag 
associations is not supported.
+   */
+  default PolicyTagAssociation addPolicyForTag(
+      String tagName, String policyName, PolicyAssociationSelector selector)
+      throws PolicyAlreadyAssociatedException {
+    throw new UnsupportedOperationException("Adding a policy for a tag is not 
supported");
+  }
+
+  /**
+   * Removes one policy association from a tag.
+   *
+   * @param tagName The tag name.
+   * @param policyName The policy name.
+   * @throws UnsupportedOperationException If removing policy-to-tag 
associations is not supported.
+   */
+  default void removePolicyFromTag(String tagName, String policyName) {
+    throw new UnsupportedOperationException("Removing a policy from a tag is 
not supported");
+  }

Review Comment:
   Can we support tag + multiple selectors + policy?



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

Reply via email to