Class Policy

java.lang.Object
org.springframework.vault.support.Policy

public class Policy extends Object
Value object representing a Vault policy associated with Policy.Rules. Instances of Policy support JSON serialization and deserialization using Jackson.
Since:
2.0
Author:
Mark Paluch
See Also:
  • Method Details

    • empty

      public static Policy empty()
      Create an empty Policy without rules.
      Returns:
      an empty Policy.
    • of

      public static Policy of(Policy.Rule... rules)
      Create a Policy from one or more rules.
      Parameters:
      rules - must not be null.
      Returns:
      the Policy object containing rules.
    • of

      public static Policy of(Set<Policy.Rule> rules)
      Create a Policy from one or more rules.
      Parameters:
      rules - must not be null.
      Returns:
      the Policy object containing rules.
    • with

      public Policy with(Policy.Rule rule)
      Create a new Policy object containing all configured rules and add the given Policy.Rule to the new policy object. If the given Policy.Rule matches an existing rule path, the exiting rule will be overridden by the new rule object.
      Parameters:
      rule - must not be null.
      Returns:
      the new Policy object containing all configured rules and the given Policy.Rule.
    • getRules

      public Set<Policy.Rule> getRules()
    • getRule

      @Nullable public Policy.Rule getRule(String path)
      Lookup a Policy.Rule by its path. Returns null if the rule was not found.
      Parameters:
      path - must not be null.
      Returns:
      the Policy.Rule or null, if not found.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object