Class License

java.lang.Object
org.elasticsearch.license.License
All Implemented Interfaces:
org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class License extends Object implements org.elasticsearch.xcontent.ToXContentObject
Data structure for license. Use License.Builder to build a license. Provides serialization/deserialization & validation methods for license object
  • Field Details

    • VERSION_START

      public static final int VERSION_START
      See Also:
    • VERSION_NO_FEATURE_TYPE

      public static final int VERSION_NO_FEATURE_TYPE
      See Also:
    • VERSION_START_DATE

      public static final int VERSION_START_DATE
      See Also:
    • VERSION_CRYPTO_ALGORITHMS

      public static final int VERSION_CRYPTO_ALGORITHMS
      See Also:
    • VERSION_ENTERPRISE

      public static final int VERSION_ENTERPRISE
      See Also:
    • VERSION_CURRENT

      public static final int VERSION_CURRENT
      See Also:
    • REST_VIEW_MODE

      public static final String REST_VIEW_MODE
      XContent param name to deserialize license(s) with an additional status field, indicating whether a particular license is 'active' or 'expired' and no signature and in a human readable format
      See Also:
    • LICENSE_SPEC_VIEW_MODE

      public static final String LICENSE_SPEC_VIEW_MODE
      XContent param name to deserialize license(s) with no signature
      See Also:
    • LICENSE_VERSION_MODE

      public static final String LICENSE_VERSION_MODE
      XContent param name to deserialize licenses according to a specific license version
      See Also:
    • LATEST_ISSUE_DATE_FIRST

      public static final Comparator<License> LATEST_ISSUE_DATE_FIRST
  • Method Details

    • version

      public int version()
      Returns:
      version of the license
    • uid

      public String uid()
      Returns:
      a unique identifier for a license
    • type

      public String type()
      Returns:
      type of the license [trial, subscription, internal]
    • issueDate

      public long issueDate()
      Returns:
      the issueDate in milliseconds
    • startDate

      public long startDate()
      Returns:
      the startDate in milliseconds
    • expiryDate

      public long expiryDate()
      The expiration date as it appears in the license. For most uses, prefer LicenseUtils.getExpiryDate(License), as in rare cases the effective expiration date may differ from the expiration date specified in the license.
      Returns:
      the expiry date in milliseconds
    • maxNodes

      public int maxNodes()
      Returns:
      the maximum number of nodes this license has been issued for, or -1 if this license is not node based.
    • maxResourceUnits

      public int maxResourceUnits()
      Returns:
      the maximum number of "resource units" this license has been issued for, or -1 if this license is not resource based. A "resource unit" is a measure of computing power (RAM/CPU), the definition of which is maintained outside of the license format, or this class.
    • issuedTo

      public String issuedTo()
      Returns:
      a string representing the entity this licenses has been issued to
    • issuer

      public String issuer()
      Returns:
      a string representing the entity responsible for issuing this license (internal)
    • signature

      public String signature()
      Returns:
      a string representing the signature of the license used for license verification
    • operationMode

      public License.OperationMode operationMode()
      Returns:
      the operation mode of the license as computed from the license type
    • verified

      public boolean verified()
    • readLicense

      public static License readLicense(StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • toInnerXContent

      public org.elasticsearch.xcontent.XContentBuilder toInnerXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Throws:
      IOException
    • fromXContent

      public static License fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • isAutoGeneratedLicense

      public static boolean isAutoGeneratedLicense(String signature)
      Returns true if the license was auto-generated (by license plugin), false otherwise
    • fromSource

      public static License fromSource(BytesReference bytes, org.elasticsearch.xcontent.XContentType xContentType) throws IOException
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • builder

      public static License.Builder builder()