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.
94 lines
5.5 KiB
Swift
94 lines
5.5 KiB
Swift
//
|
||
// TargetView.swift
|
||
//
|
||
// Generated by openapi-generator
|
||
// https://openapi-generator.tech
|
||
//
|
||
|
||
import Foundation
|
||
|
||
public struct TargetView: Sendable, Codable, ParameterConvertible, Hashable {
|
||
|
||
/** Capacity is a human summary of what the machine has (\"8 vCPU / 32G\", \"1× GB10\"), up to 256 characters. Prose for a card — Spec is the same thing in a form a scheduler can read, and nothing derives one from the other. */
|
||
public var capacity: String?
|
||
/** CreatedAt is when the machine was first registered, RFC 3339 in UTC. A re-link refreshes the row and leaves this alone, so it dates the machine and not the connection. */
|
||
public var createdAt: String?
|
||
/** Host is the hostname sessions on this machine report, and it is a JOIN KEY, not a label: a session naming this host counts against the load below even when it names no target id, and a re-link of the same (org, host, owner) refreshes this row instead of creating a second. Empty means the machine is addressable only by ID. */
|
||
public var host: String?
|
||
/** ID is the machine's handle, minted as \"tgt_\" + 32 hex characters. It is what a session records to say it ran here, and what every later patch, claim or delete addresses. */
|
||
public var id: String?
|
||
/** Kind is what sort of destination this is, from a closed five: laptop | cloud | gpu | cluster | machine. A register that named none is a `machine`. */
|
||
public var kind: String?
|
||
/** Label is the name a person gave the machine (\"workshop\"), up to 128 characters. Required at register, free text, and the only field here meant for reading rather than matching. */
|
||
public var label: String?
|
||
/** Metrics is what the machine was DOING at its last heartbeat — loadavg, memory, accelerator utilization. Absent when it has never beaten. It is a SNAPSHOT: the series over time lives in the fleet samples, not here. */
|
||
public var metrics: Metrics?
|
||
/** MetricsAt is when that heartbeat was recorded, RFC 3339 in UTC, and the SERVER stamps it — a client cannot backdate or forge the staleness clock. Absent means never beaten, which is exactly the case where Status is taken at its word. */
|
||
public var metricsAt: String?
|
||
/** Running is how many of those are in `running` right now — the number a dispatcher weighs against Capacity. paused sessions are in Sessions and not here. */
|
||
public var running: Int64?
|
||
/** Sessions is how many of the org's sessions are mapped to this machine, by target id OR by matching Host. All of them, whatever their status. */
|
||
public var sessions: Int64?
|
||
/** Spec is what the machine IS — os, arch, cores, RAM, accelerators — the static half, changed only when something reports it again. Absent when nothing has ever been reported, and a scheduler reads absence as \"cannot satisfy a floor\" rather than as \"no limits\". */
|
||
public var spec: Spec?
|
||
/** Status is the EFFECTIVE liveness — online | offline | draining — not the stored one. offline and draining are operator INTENT and are reported as they stand; `online` is checked against the heartbeat, and a machine that has beaten before but not in the last 90 seconds reports offline whatever its row says. A target that has NEVER beaten keeps its stored status, because a hand-registered destination has no fact to check. */
|
||
public var status: String?
|
||
/** UpdatedAt is the last write to the row, same format — which for a beating machine is its last heartbeat, since a heartbeat IS a write. */
|
||
public var updatedAt: String?
|
||
|
||
public init(capacity: String? = nil, createdAt: String? = nil, host: String? = nil, id: String? = nil, kind: String? = nil, label: String? = nil, metrics: Metrics? = nil, metricsAt: String? = nil, running: Int64? = nil, sessions: Int64? = nil, spec: Spec? = nil, status: String? = nil, updatedAt: String? = nil) {
|
||
self.capacity = capacity
|
||
self.createdAt = createdAt
|
||
self.host = host
|
||
self.id = id
|
||
self.kind = kind
|
||
self.label = label
|
||
self.metrics = metrics
|
||
self.metricsAt = metricsAt
|
||
self.running = running
|
||
self.sessions = sessions
|
||
self.spec = spec
|
||
self.status = status
|
||
self.updatedAt = updatedAt
|
||
}
|
||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||
case capacity
|
||
case createdAt
|
||
case host
|
||
case id
|
||
case kind
|
||
case label
|
||
case metrics
|
||
case metricsAt
|
||
case running
|
||
case sessions
|
||
case spec
|
||
case status
|
||
case updatedAt
|
||
}
|
||
|
||
// Encodable protocol methods
|
||
|
||
public func encode(to encoder: Encoder) throws {
|
||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||
try container.encodeIfPresent(capacity, forKey: .capacity)
|
||
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
||
try container.encodeIfPresent(host, forKey: .host)
|
||
try container.encodeIfPresent(id, forKey: .id)
|
||
try container.encodeIfPresent(kind, forKey: .kind)
|
||
try container.encodeIfPresent(label, forKey: .label)
|
||
try container.encodeIfPresent(metrics, forKey: .metrics)
|
||
try container.encodeIfPresent(metricsAt, forKey: .metricsAt)
|
||
try container.encodeIfPresent(running, forKey: .running)
|
||
try container.encodeIfPresent(sessions, forKey: .sessions)
|
||
try container.encodeIfPresent(spec, forKey: .spec)
|
||
try container.encodeIfPresent(status, forKey: .status)
|
||
try container.encodeIfPresent(updatedAt, forKey: .updatedAt)
|
||
}
|
||
}
|
||
|
||
|
||
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
||
extension TargetView: Identifiable {}
|