Record Class KvMetadata

java.lang.Object
java.lang.Record
codes.grow.packages.vault.KvMetadata
Record Components:
casRequired - whether writes need cas
createdTime - creation time
updatedTime - last update time
currentVersion - current version
oldestVersion - oldest kept version
maxVersions - maximum versions kept (0 = mount default)
deleteVersionAfter - automatic deletion delay (zero = never)
customMetadata - custom metadata
versions - metadata per version number

public record KvMetadata(boolean casRequired, Optional<Instant> createdTime, Optional<Instant> updatedTime, int currentVersion, int oldestVersion, int maxVersions, Duration deleteVersionAfter, Map<String,String> customMetadata, Map<Integer,KvVersionMetadata> versions) extends Record
Metadata of a KV v2 secret (GET <mount>/metadata/<path>).
  • Constructor Details

    • KvMetadata

      public KvMetadata(boolean casRequired, Optional<Instant> createdTime, Optional<Instant> updatedTime, int currentVersion, int oldestVersion, int maxVersions, Duration deleteVersionAfter, Map<String,String> customMetadata, Map<Integer,KvVersionMetadata> versions)
      Creates the record; maps are copied.
      Parameters:
      casRequired - cas flag
      createdTime - creation time
      updatedTime - update time
      currentVersion - current version
      oldestVersion - oldest version
      maxVersions - max versions
      deleteVersionAfter - deletion delay
      customMetadata - custom metadata
      versions - versions
  • Method Details

    • currentDeleted

      public boolean currentDeleted()
      Returns whether the current version is soft-deleted or destroyed.
      Returns:
      true when the latest data is gone
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • casRequired

      public boolean casRequired()
      Returns the value of the casRequired record component.
      Returns:
      the value of the casRequired record component
    • createdTime

      public Optional<Instant> createdTime()
      Returns the value of the createdTime record component.
      Returns:
      the value of the createdTime record component
    • updatedTime

      public Optional<Instant> updatedTime()
      Returns the value of the updatedTime record component.
      Returns:
      the value of the updatedTime record component
    • currentVersion

      public int currentVersion()
      Returns the value of the currentVersion record component.
      Returns:
      the value of the currentVersion record component
    • oldestVersion

      public int oldestVersion()
      Returns the value of the oldestVersion record component.
      Returns:
      the value of the oldestVersion record component
    • maxVersions

      public int maxVersions()
      Returns the value of the maxVersions record component.
      Returns:
      the value of the maxVersions record component
    • deleteVersionAfter

      public Duration deleteVersionAfter()
      Returns the value of the deleteVersionAfter record component.
      Returns:
      the value of the deleteVersionAfter record component
    • customMetadata

      public Map<String,String> customMetadata()
      Returns the value of the customMetadata record component.
      Returns:
      the value of the customMetadata record component
    • versions

      public Map<Integer,KvVersionMetadata> versions()
      Returns the value of the versions record component.
      Returns:
      the value of the versions record component