Class RecordEntity

java.lang.Object
codes.thischwa.cf.model.AbstractEntity
codes.thischwa.cf.model.RecordEntity
All Implemented Interfaces:
ResponseEntity

public class RecordEntity extends AbstractEntity
Represents a DNS record entity within a specific zone.

Attributes defined in this class include:

  • DNS record type such as "A" or "CNAME".
  • Name of the DNS record.
  • Content of the DNS record, such as an IP address.
  • Flags indicating whether the record is proxiable or proxied.
  • TTL (Time-To-Live) for the DNS record.
  • Priority, required for MX and URI records (for SRV records it's part of the data).
  • Structured data, required for e.g. SRV, CAA, LOC or TLSA records instead of content.
  • An optional comment and tags.
  • A locked status to indicate the immutability of the record.
  • Zone-specific metadata including zone ID and name.
  • Timestamps for creation and modification (UTC).

Provides a static factory method build for creating a DNS record with specific attributes.

  • Constructor Details

    • RecordEntity

      public RecordEntity()
      Initializes a new instance of the RecordEntity class and invokes the parent constructor from the AbstractEntity class. The RecordEntity class represents a DNS record entity within a specific zone, encapsulating attributes such as type, name, content, TTL, and other related metadata.
  • Method Details

    • build

      public static RecordEntity build(String name, RecordType type, Integer ttl, String content)
      Builds and returns a RecordEntity instance with the specified attributes.
      Parameters:
      name - the name of the DNS record
      type - the RecordType of the DNS record
      ttl - the time-to-live (TTL) value for the DNS record
      content - the content of the DNS record, typically an IP address
      Returns:
      a RecordEntity populated with the provided attributes
    • build

      public static RecordEntity build(String id, String content)
      Builds and returns a RecordEntity instance with the specified ID and content.
      Parameters:
      id - the unique identifier for the DNS record
      content - the content of the DNS record, typically an IP address or other record data
      Returns:
      a RecordEntity populated with the provided ID and content
    • build

      public static RecordEntity build(String id, String name, String type, Integer ttl, String content)
      Builds and returns a RecordEntity instance with the specified attributes.
      Parameters:
      id - the unique identifier for the DNS record
      name - the name of the DNS record
      type - the type of the DNS record, represented as a string (e.g., "A", "CNAME")
      ttl - the time-to-live (TTL) value for the DNS record
      content - the content of the DNS record, typically an IP address or other record data
      Returns:
      a RecordEntity populated with the provided attributes
      Throws:
      IllegalArgumentException - if the type string is not a valid RecordType
    • getSubdomain

      @Nullable public @Nullable String getSubdomain()
      Retrieves the subdomain of the DNS record, i.e. the record name relative to its zone.

      If the zone name is known, the zone name is stripped from the record name, e.g. my.sub.example.com results in my.sub. A record at the zone apex results in "@". If the zone name is unknown, only the substring before the first dot is returned.

      Returns:
      the short name of the DNS record, "@" for the zone apex, or the full name if no dot is present
    • getSld

      @Deprecated(since="0.6.0", forRemoval=true) @Nullable public @Nullable String getSld()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The name was misleading, use getSubdomain() instead.
      Retrieves the subdomain of the DNS record.
      Returns:
      the subdomain of the DNS record