Enhance code readability by improving comments, formatting, and aligning annotations across classes.
This commit is contained in:
@@ -106,6 +106,10 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
this.responseValidator = new ResponseValidator(emptyResultThrowsException);
|
||||
}
|
||||
|
||||
private static String buildFqdn(ZoneEntity zone, String sld) {
|
||||
return sld + "." + zone.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of all zones from the Cloudflare API.
|
||||
*
|
||||
@@ -376,10 +380,6 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
checkResponse(resp);
|
||||
}
|
||||
|
||||
private static String buildFqdn(ZoneEntity zone, String sld) {
|
||||
return sld + "." + zone.getName();
|
||||
}
|
||||
|
||||
private void checkResponse(AbstractResponse resp) throws CloudflareApiException {
|
||||
checkResponse(resp, false);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum CfRequest {
|
||||
|
||||
/** Represents the API endpoint path for retrieving the list of DNS zones. */
|
||||
/**
|
||||
* Represents the API endpoint path for retrieving the list of DNS zones.
|
||||
*/
|
||||
ZONE_LIST("/zones"),
|
||||
/**
|
||||
* Represents the API endpoint path for retrieving information about a specific DNS zone by its
|
||||
|
||||
@@ -7,7 +7,8 @@ import java.io.Serial;
|
||||
*/
|
||||
public class CloudflareApiException extends Exception {
|
||||
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructs a new CloudflareApiException with the specified detail message.
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package codes.thischwa.cf.model;
|
||||
|
||||
/**
|
||||
* Represents a response that contains a single {@link BatchEntry} as the result.
|
||||
*
|
||||
* <p>This class is used for API responses where the primary result is a batch entry,
|
||||
* which includes collections of operations such as patches, posts, puts, and deletes
|
||||
* performed on DNS record entities.
|
||||
*
|
||||
* <p>Extends {@code AbstractSingleResponse} with {@code BatchEntry} as the generic type,
|
||||
* ensuring that the response result is a batch of operations.
|
||||
*/
|
||||
public class BatchResponse extends AbstractSingleResponse<BatchEntry> {
|
||||
|
||||
BatchResponse() {
|
||||
|
||||
@@ -34,10 +34,14 @@ public class RecordEntity extends AbstractEntity {
|
||||
private Boolean proxied;
|
||||
private Integer ttl;
|
||||
private Boolean locked;
|
||||
@Nullable private String zoneId;
|
||||
@Nullable private String zoneName;
|
||||
@Nullable private LocalDateTime modifiedOn;
|
||||
@Nullable private LocalDateTime createdOn;
|
||||
@Nullable
|
||||
private String zoneId;
|
||||
@Nullable
|
||||
private String zoneName;
|
||||
@Nullable
|
||||
private LocalDateTime modifiedOn;
|
||||
@Nullable
|
||||
private LocalDateTime createdOn;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the RecordEntity class and invokes the parent constructor from
|
||||
@@ -81,6 +85,16 @@ public class RecordEntity extends AbstractEntity {
|
||||
return rec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns a {@link RecordEntity} instance with the specified attributes.
|
||||
*
|
||||
* @param id the unique identifier for the DNS record
|
||||
* @param name the name of the DNS record
|
||||
* @param type the type of the DNS record, represented as a string (e.g., "A", "CNAME")
|
||||
* @param ttl the time-to-live (TTL) value for the DNS record
|
||||
* @param content the content of the DNS record, typically an IP address or other record data
|
||||
* @return a {@link RecordEntity} populated with the provided attributes
|
||||
*/
|
||||
public static RecordEntity build(String id, String name, String type, Integer ttl, String content) {
|
||||
RecordEntity rec = build(name, RecordType.valueOf(type), ttl, content);
|
||||
rec.setId(id);
|
||||
|
||||
@@ -21,14 +21,34 @@ public class ResponseResultInfo {
|
||||
private List<Error> errors;
|
||||
private List<String> messages;
|
||||
|
||||
/**
|
||||
* Represents an error with a specific code and message.
|
||||
*
|
||||
* <p>This class is used to encapsulate error information, including a numerical error code
|
||||
* and a corresponding descriptive message. It is often used as part of a collection of errors
|
||||
* to provide detailed diagnostics for failed operations or processes.
|
||||
*/
|
||||
@Data
|
||||
public static class Error {
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Constructs a new instance of the {@code Error} class with default values for its properties.
|
||||
*
|
||||
* <p>This no-argument constructor initializes an {@code Error} object without setting
|
||||
* specific values for the error code or message. It is primarily used when an error needs to
|
||||
* be created and set up later, or when default values are acceptable.
|
||||
*/
|
||||
public Error() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance of the {@code Error} class with a specified error code and message.
|
||||
*
|
||||
* @param code the numerical code representing the error
|
||||
* @param message the descriptive message providing details about the error
|
||||
*/
|
||||
public Error(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package codes.thischwa.cf.model;
|
||||
|
||||
/** Represents a response model that contains multiple {@link ZoneEntity} instances. */
|
||||
/**
|
||||
* Represents a response model that contains multiple {@link ZoneEntity} instances.
|
||||
*/
|
||||
public class ZoneMultipleResponse extends AbstractMultipleResponse<ZoneEntity> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
/** The model of CloudflareDNS-java. */
|
||||
/**
|
||||
* The model of CloudflareDNS-java.
|
||||
*/
|
||||
|
||||
package codes.thischwa.cf.model;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
/** The base package of CloudflareDNS-java. */
|
||||
/**
|
||||
* The base package of CloudflareDNS-java.
|
||||
*/
|
||||
|
||||
package codes.thischwa.cf;
|
||||
Reference in New Issue
Block a user