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.
96 lines
5.2 KiB
Swift
96 lines
5.2 KiB
Swift
//
|
|
// TrafficView.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct TrafficView: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Blind is how many requests in the window carried no identity to attribute them to — no validated credential and no client address. Non-zero on a public plane means the client address is not reaching this process (a TCP load balancer with no PROXY protocol in front of it, typically), so this scope's callers cannot be told apart and nothing can be held against them. */
|
|
public var blind: Int64?
|
|
/** Callers is the scope's busiest callers this window. A credentialed caller appears as a FINGERPRINT — a per-process one-way digest: enough to recognise the same caller across requests, never enough to reconstruct the credential. */
|
|
public var callers: [TrafficCaller]?
|
|
/** Ceiling is the most callers this scope may hold at once. */
|
|
public var ceiling: Int64?
|
|
/** Denied is how many of them the gate refused. */
|
|
public var denied: Int64?
|
|
/** Lanes is the request count per lane — agent, human, bot, unknown. This is the split that separates a customer's automation from a scraper. */
|
|
public var lanes: [String: Int64]?
|
|
/** Mode is the abuse gate's posture for this scope: \"shadow\" records the scorer's action without enforcing it, \"live\" enforces it. */
|
|
public var mode: String?
|
|
/** Org is the scope this view was taken for — the validated principal's own, never a value the caller supplied. Empty names the anonymous lane, the one scope that has no tenant. */
|
|
public var org: String?
|
|
/** Refused is how many callers this scope's ceilings turned away in the window. */
|
|
public var refused: Int64?
|
|
/** Requests is how many requests this scope made in the window. */
|
|
public var requests: Int64?
|
|
/** Screens is how many of them were put to the scorer — the billable unit of the risk product. Counted from the first request, whatever the SKU costs. */
|
|
public var screens: Int64?
|
|
/** Strain is what this scope's ceilings are doing: \"clear\" below them, \"full\" at them, \"refuse\" once a caller has been turned away inside this window — which means that caller is UNMEASURED and the numbers here are a sample rather than a census. It is reported rather than logged because the alternative — a bound that degrades a scope silently — is the failure this design exists to rule out. No other scope can move it. */
|
|
public var strain: String?
|
|
/** Tracked is how many callers this scope holds state for right now, and Ceiling is the most it may hold. Tracked == Ceiling is the fact a bound that binds cannot hide. */
|
|
public var tracked: Int64?
|
|
/** Unscored is how many of those screens got NO answer — the scorer was absent, stuck, slow, erroring or silent. An unanswered screen allows ordinary traffic, so this is the number that separates \"a quiet day\" from \"the judge stopped answering and nothing said so\". */
|
|
public var unscored: Int64?
|
|
/** WindowSec is the span the counts cover, in seconds. */
|
|
public var windowSec: Int64?
|
|
|
|
public init(blind: Int64? = nil, callers: [TrafficCaller]? = nil, ceiling: Int64? = nil, denied: Int64? = nil, lanes: [String: Int64]? = nil, mode: String? = nil, org: String? = nil, refused: Int64? = nil, requests: Int64? = nil, screens: Int64? = nil, strain: String? = nil, tracked: Int64? = nil, unscored: Int64? = nil, windowSec: Int64? = nil) {
|
|
self.blind = blind
|
|
self.callers = callers
|
|
self.ceiling = ceiling
|
|
self.denied = denied
|
|
self.lanes = lanes
|
|
self.mode = mode
|
|
self.org = org
|
|
self.refused = refused
|
|
self.requests = requests
|
|
self.screens = screens
|
|
self.strain = strain
|
|
self.tracked = tracked
|
|
self.unscored = unscored
|
|
self.windowSec = windowSec
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case blind
|
|
case callers
|
|
case ceiling
|
|
case denied
|
|
case lanes
|
|
case mode
|
|
case org
|
|
case refused
|
|
case requests
|
|
case screens
|
|
case strain
|
|
case tracked
|
|
case unscored
|
|
case windowSec = "window_sec"
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(blind, forKey: .blind)
|
|
try container.encodeIfPresent(callers, forKey: .callers)
|
|
try container.encodeIfPresent(ceiling, forKey: .ceiling)
|
|
try container.encodeIfPresent(denied, forKey: .denied)
|
|
try container.encodeIfPresent(lanes, forKey: .lanes)
|
|
try container.encodeIfPresent(mode, forKey: .mode)
|
|
try container.encodeIfPresent(org, forKey: .org)
|
|
try container.encodeIfPresent(refused, forKey: .refused)
|
|
try container.encodeIfPresent(requests, forKey: .requests)
|
|
try container.encodeIfPresent(screens, forKey: .screens)
|
|
try container.encodeIfPresent(strain, forKey: .strain)
|
|
try container.encodeIfPresent(tracked, forKey: .tracked)
|
|
try container.encodeIfPresent(unscored, forKey: .unscored)
|
|
try container.encodeIfPresent(windowSec, forKey: .windowSec)
|
|
}
|
|
}
|
|
|