package com.hithomelabs.cftunnels.Models; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import java.util.List; import java.util.Map; /** * Model representing an ingress rule for a Cloudflare Tunnel. * *
Ingress rules define how incoming requests should be routed through * the tunnel to your internal services. Each rule specifies:
*Example JSON:
*
* {
* "hostname": "api.example.com",
* "service": "http://localhost:8080",
* "originRequest": {
* "noTLSVerify": true
* },
* "path": "/api"
* }
*
*
* @see Cloudflare Ingress Docs
*/
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class Ingress {
/**
* The target service URL.
*
* Format: {@code protocol://host:port}
*Example: {@code http://localhost:8080}
*/ private String service; /** * Hostname pattern to match for this ingress rule. * *Can be a full domain (api.example.com) or use wildcards * (*.example.com) to match subdomains.
*If null, this rule acts as a catch-all.
*/ private String hostname; /** * Optional settings for requests to the origin server. * *Supported options:
*Example: "/api" would only route requests with * paths starting with /api to this service.
*/ private String path; /** * Removes an ingress rule by hostname from a list. * *This utility method finds and removes the first ingress * matching the given hostname.
* * @param ingressList List of ingress rules to modify * @param toBeDeleted Hostname of the rule to remove * @return true if an ingress was removed, false otherwise */ public static boolean deleteByHostName(List