package com.hithomelabs.cftunnels.Entity; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; 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") 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; }