mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
64 lines
2.6 KiB
Swift
64 lines
2.6 KiB
Swift
//
|
|
// Route.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Route: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Host is the exact hostname this route matches, lowercased with any trailing dot stripped. It is a GLOBALLY unique claim — one route across the whole edge may hold a host, so no tenant can hijack another's. */
|
|
public var host: String?
|
|
/** ID identifies the route within the org: [A-Za-z0-9-_.], at most 128 chars. A create that omits it gets a generated one. */
|
|
public var id: String?
|
|
/** Middlewares are the ids of the edge transforms to apply, in this order, before the request reaches the service. At most 16. */
|
|
public var middlewares: [String]?
|
|
/** PathPrefix narrows the match to requests under this path; it must start with \"/\". Empty matches every path on the host. */
|
|
public var pathPrefix: String?
|
|
/** Priority orders routes that share a host: higher wins, and equal priorities fall back to the longer PathPrefix. */
|
|
public var priority: Int64?
|
|
/** Service is the id of the backend pool this route dispatches to. A route naming a service that does not exist is skipped at compile, not served. */
|
|
public var service: String?
|
|
/** TLS asks the edge to terminate TLS for Host with an ACME-managed certificate. */
|
|
public var tls: Bool?
|
|
|
|
public init(host: String? = nil, id: String? = nil, middlewares: [String]? = nil, pathPrefix: String? = nil, priority: Int64? = nil, service: String? = nil, tls: Bool? = nil) {
|
|
self.host = host
|
|
self.id = id
|
|
self.middlewares = middlewares
|
|
self.pathPrefix = pathPrefix
|
|
self.priority = priority
|
|
self.service = service
|
|
self.tls = tls
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case host
|
|
case id
|
|
case middlewares
|
|
case pathPrefix
|
|
case priority
|
|
case service
|
|
case tls
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(host, forKey: .host)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(middlewares, forKey: .middlewares)
|
|
try container.encodeIfPresent(pathPrefix, forKey: .pathPrefix)
|
|
try container.encodeIfPresent(priority, forKey: .priority)
|
|
try container.encodeIfPresent(service, forKey: .service)
|
|
try container.encodeIfPresent(tls, forKey: .tls)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension Route: Identifiable {}
|