Class RecordOperationsImpl

java.lang.Object
codes.thischwa.cf.fluent.RecordOperationsImpl
All Implemented Interfaces:
RecordOperations

public class RecordOperationsImpl extends Object implements RecordOperations
Implementation of RecordOperations for fluent API access to record-level operations.
  • Constructor Details

    • RecordOperationsImpl

      public RecordOperationsImpl(CfDnsClient client, ZoneEntity zone, String subdomain, @Nullable @Nullable RecordType[] types)
      Constructs a RecordOperationsImpl instance.
      Parameters:
      client - the CfDnsClient instance to use for operations
      zone - the ZoneEntity representing the DNS zone
      subdomain - the subdomain relative to the zone, or "@" for the zone apex
      types - optional array of RecordType to filter by
  • Method Details

    • get

      Description copied from interface: RecordOperations
      Retrieves DNS records for the selected subdomain.
      Specified by:
      get in interface RecordOperations
      Returns:
      a list of RecordEntity objects matching the criteria
      Throws:
      CloudflareApiException - if an error occurs while retrieving records
    • create

      public RecordEntity create(RecordType type, String content, int ttl) throws CloudflareApiException
      Description copied from interface: RecordOperations
      Creates a new DNS record with the specified parameters.
      Specified by:
      create in interface RecordOperations
      Parameters:
      type - the DNS record type (e.g., A, AAAA, CNAME)
      content - the content of the DNS record (e.g., IP address)
      ttl - the time-to-live value in seconds
      Returns:
      the created RecordEntity
      Throws:
      CloudflareApiException - if an error occurs while creating the record
    • update

      public RecordEntity update(String newContent) throws CloudflareApiException
      Description copied from interface: RecordOperations
      Updates an existing DNS record with new content.
      Specified by:
      update in interface RecordOperations
      Parameters:
      newContent - the new content for the DNS record
      Returns:
      the updated RecordEntity
      Throws:
      CloudflareApiException - if an error occurs while updating the record
    • delete

      public void delete(RecordType... types) throws CloudflareApiException
      Description copied from interface: RecordOperations
      Deletes DNS records of the specified types for the selected subdomain. The types passed here determine which records are deleted, independently of any type filter used to select the subdomain. If no types are specified, records of all types for that subdomain are selected for deletion. A CloudflareApiException from an individual deletion is logged and does not stop later attempts. No per-record result is returned, so returning normally does not guarantee that all selected records were deleted.
      Specified by:
      delete in interface RecordOperations
      Parameters:
      types - the DNS record types to delete
      Throws:
      CloudflareApiException - if an error occurs while retrieving records to delete