Interface SupportsPolicies


@Evolving public interface SupportsPolicies
The interface for supporting getting or associating policies with a metadata object. This interface will be mixed with metadata objects to provide policy operations.
  • Method Details

    • listPolicies

      String[] listPolicies()
      Returns:
      List all the policy names for the specific object.
    • listPolicyInfos

      Policy[] listPolicyInfos()
      Returns:
      List all the policies with details for the specific object.
    • getPolicy

      Policy getPolicy(String name) throws NoSuchPolicyException
      Get a policy by its name for the specific object.
      Parameters:
      name - The name of the policy.
      Returns:
      The policy.
      Throws:
      NoSuchPolicyException - If the policy does not associate with the object.
    • associatePolicies

      String[] associatePolicies(String[] policiesToAdd, String[] policiesToRemove) throws PolicyAlreadyAssociatedException
      Associate policies to the specific object. The policiesToAdd will be applied to the object and the policiesToRemove will be removed from the object. Note that:
      1. Adding or removing policies that are not existed will be ignored.
      2. If the same name policy is in both policiesToAdd and policiesToRemove, it will be ignored.
      3. If the policy is already applied to the object, it will throw PolicyAlreadyAssociatedException
      Parameters:
      policiesToAdd - The policies to be added to the object.
      policiesToRemove - The policies to remove.
      Returns:
      The list of applied policies.
      Throws:
      PolicyAlreadyAssociatedException - If the policy is already applied to the object.