From 6bf138ea7aacb058ec74c269f05b619299fe0a05 Mon Sep 17 00:00:00 2001 From: Dave the Dev Date: Tue, 14 Apr 2026 11:51:07 +0000 Subject: [PATCH] Hithomelabs/CFTunnels#114: Add JavaDoc to Tunnel entity --- .../hithomelabs/CFTunnels/Entity/Tunnel.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hithomelabs/CFTunnels/Entity/Tunnel.java b/src/main/java/com/hithomelabs/CFTunnels/Entity/Tunnel.java index 3457c9e..8892caf 100644 --- a/src/main/java/com/hithomelabs/CFTunnels/Entity/Tunnel.java +++ b/src/main/java/com/hithomelabs/CFTunnels/Entity/Tunnel.java @@ -8,21 +8,60 @@ import lombok.Setter; import java.util.UUID; +/** + * JPA Entity representing a Cloudflare Tunnel configuration. + * + *

This entity stores the locally cached configuration of a Cloudflare Tunnel, + * linking the tunnel's unique identifier from Cloudflare with its local + * environment name for easier reference and management.

+ * + *

The entity is uniquely constrained by tunnel ID and environment name, + * ensuring only one configuration exists per tunnel per environment.

+ * + *

Database Table: {@code tunnels}

+ * + *

Relationships:

+ * + * + * @see Mapping + * @see Request + */ @Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor -@Table(name="tunnels") +@Table(name = "tunnels") public class Tunnel { + /** + * Unique identifier for the tunnel (UUID). + * + *

This corresponds to the Cloudflare-assigned tunnel ID + * and serves as the primary key for this entity.

+ */ @Id @Column(columnDefinition = "uuid", insertable = false, updatable = false, nullable = false) private UUID id; + /** + * Environment name associated with this tunnel configuration. + * + *

Examples: "production", "staging", "development"

+ *

Each tunnel can be configured for multiple environments.

+ */ @Column(length = 10, unique = true, nullable = false) private String environment; + /** + * Display name of the tunnel as configured in Cloudflare. + * + *

This is the user-friendly name assigned to the tunnel + * when it was created in Cloudflare Zero Trust Dashboard + * or via the Cloudflare API.

+ */ @Column(length = 50, unique = true, nullable = false) private String name; -} +} \ No newline at end of file