using System.Runtime.Serialization; using Newtonsoft.Json.Converters; namespace AMWD.Net.Api.Cloudflare { /// /// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. /// Source /// public class CloudflareTunnel { /// /// UUID of the tunnel. /// [JsonProperty("id")] public string? Id { get; set; } /// /// Cloudflare account ID. /// [JsonProperty("account_tag")] public string? AccountTag { get; set; } /// /// Active connections. /// [JsonProperty("connections")] [Obsolete("This field will start returning an empty array. To fetch the connections of a given tunnel, please use the dedicated endpoint '/accounts/{account_id}/{tunnel_type}/{tunnel_id}/connections'.")] public IReadOnlyCollection? Connections { get; set; } /// /// Timestamp of when the tunnel established at least one connection to Cloudflare's edge. /// If , the tunnel is inactive. /// [JsonProperty("conns_active_at")] public DateTime? ConnectionsActiveAt { get; set; } /// /// Timestamp of when the tunnel became inactive (no connections to Cloudflare's edge). /// If , the tunnel is active. /// [JsonProperty("conns_inactive_at")] public DateTime? ConnectionsInactiveAt { get; set; } /// /// Timestamp of when the resource was created. /// [JsonProperty("created_at")] public DateTime? CreatedAt { get; set; } /// /// Timestamp of when the resource was deleted. /// If , the resource has not been deleted. /// [JsonProperty("deleted_at")] public DateTime? DeletedAt { get; set; } /// /// Metadata associated with the tunnel. /// [JsonProperty("metadata")] public object? MetaData { get; set; } /// /// A user-friendly name for a tunnel. /// [JsonProperty("name")] public string? Name { get; set; } /// /// If , the tunnel can be configured remotely from the Zero Trust dashboard. /// If , the tunnel must be configured locally on the origin machine. /// [JsonProperty("remote_config")] public bool? RemoteConfiguration { get; set; } /// /// The status of the tunnel. /// [JsonProperty("status")] public CloudflareTunnelStatus? Status { get; set; } /// /// The type of tunnel. /// [JsonProperty("tun_type")] public CloudflareTunnelType? TunType { get; set; } } /// /// A connection to Cloudflare's edge. /// Source /// public class CloudflareTunnelConnection { /// /// UUID of the Cloudflare Tunnel connection. /// [JsonProperty("id")] public string? Id { get; set; } /// /// UUID of the Cloudflare Tunnel connector. /// [JsonProperty("client_id")] public string? ClientId { get; set; } /// /// The cloudflared version used to establish this connection. /// [JsonProperty("client_version")] public string? ClientVersion { get; set; } /// /// The Cloudflare data center used for this connection. /// [JsonProperty("colo_name")] public string? ColocationName { get; set; } /// /// Cloudflare continues to track connections for several minutes after they disconnect. /// This is an optimization to improve latency and reliability of reconnecting. ///
/// If , the connection has disconnected but is still being tracked. /// If , the connection is actively serving traffic. ///
[JsonProperty("is_pending_reconnect")] public bool? IsPendingReconnect { get; set; } /// /// Timestamp of when the connection was established. /// [JsonProperty("opened_at")] public DateTime? OpenedAt { get; set; } /// /// The public IP address of the host running cloudflared. /// [JsonProperty("origin_ip")] public string? OriginIp { get; set; } /// /// UUID of the Cloudflare Tunnel connection. /// [JsonProperty("uuid")] public string? UUID { get; set; } } /// /// The status of the tunnel. /// Source /// [JsonConverter(typeof(StringEnumConverter))] public enum CloudflareTunnelStatus { /// /// The tunnel has never been run. /// [EnumMember(Value = "inactive")] Inactive = 1, /// /// The tunnel is active and able to serve traffic but in an unhealthy state. /// [EnumMember(Value = "degraded")] Degraded = 2, /// /// The tunnel is active and able to serve traffic. /// [EnumMember(Value = "healthy")] Healthy = 3, /// /// The tunnel can not serve traffic as it has no connections to the Cloudflare Edge. /// [EnumMember(Value = "down")] Down = 4 } /// /// The type of tunnel. /// Source /// public enum CloudflareTunnelType { /// /// Cloudflared. /// [EnumMember(Value = "cfd_tunnel")] Cloudflared = 1, /// /// WARP Connector. /// [EnumMember(Value = "warp_connector")] WarpConnector = 2, /// /// WARP. /// [EnumMember(Value = "warp")] Warp = 3, /// /// Magic WAN. /// [EnumMember(Value = "magic")] MagicWAN = 4, /// /// IPsec. /// [EnumMember(Value = "ip_sec")] IpSec = 5, /// /// GRE. /// [EnumMember(Value = "gre")] Gre = 6, /// /// CNI. /// [EnumMember(Value = "cni")] Cni = 7 } }