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.
109 lines
6.5 KiB
Swift
109 lines
6.5 KiB
Swift
//
|
||
// MachineView.swift
|
||
//
|
||
// Generated by openapi-generator
|
||
// https://openapi-generator.tech
|
||
//
|
||
|
||
import Foundation
|
||
|
||
public struct MachineView: Sendable, Codable, ParameterConvertible, Hashable {
|
||
|
||
/** Agent is the cloud Agent this machine runs, lifted out of the binding so a list reads without following one. Empty means nothing is bound — for a kind=bot machine that means it costs money and answers nothing. */
|
||
public var agent: String?
|
||
/** Binding is the record joining this machine to that agent, carrying vm's own reconciled status and its reason. Absent means no runtime is bound, which is also what a stopped bot looks like: stopping unbinds and leaves the machine running. */
|
||
public var binding: AgentBinding?
|
||
/** CreatedTime is when the machine came into being: the provider's own creation timestamp for a Visor machine, passed through in whatever form it states it, and for a BYO machine the RFC 3339 moment it first dialed in. */
|
||
public var createdTime: String?
|
||
/** GPU names the accelerators this machine holds (\"H100\", or \"2× NVIDIA GB10\" for a BYO machine reporting a matched pair). Empty means the machine is not a GPU machine — the size slug does not parse as one, or nvidia-smi found nothing. */
|
||
public var gpu: String?
|
||
/** ID addresses this machine on the /v1/compute/machines/:id routes: the org-scoped NAME Visor keys a machine by, falling back to the provider id for a machine that has no name. A BYO machine's is the id it dialed in under. */
|
||
public var id: String?
|
||
/** Image is the OS image the machine booted from, as the provider names it. */
|
||
public var image: String?
|
||
/** Mem is system RAM rendered for a human (\"8 GB\"), not a number to compute with. Empty when the provider's figure is ambiguous, or when the only figure available is a GPU slug's gb — that is VRAM, and reporting it as system RAM would be a fabrication. A BYO machine's RAM is on /v1/compute/fleet/workers. */
|
||
public var mem: String?
|
||
/** Name is the label to show a human — Visor's displayName, or the machine name when it carries none. A BYO machine's is its hostname. It is not an address: ID is what the routes take. */
|
||
public var name: String?
|
||
/** Os is the operating system on the machine — Visor's record for a provisioned one, the host's own report (linux, darwin, windows) for a BYO one. */
|
||
public var os: String?
|
||
/** PrivateIp is the address on the provider's own network, reachable from the org's other machines in the same region. Empty on the same terms as PublicIp. */
|
||
public var privateIp: String?
|
||
/** Provider is the cloud that runs the machine (\"digitalocean\"), or \"byo\" for one the operator dialed in with `hanzo link`. */
|
||
public var provider: String?
|
||
/** PublicIp is the internet-facing address the provider assigned. Empty while a machine is still provisioning, and empty for a BYO machine — it dials out from behind NAT, so no address is ever learned for it. */
|
||
public var publicIp: String?
|
||
/** Region is the provider region slug (\"sfo3\"), or the zone when the provider reports only that. \"on-prem\" for a BYO machine, which has no cloud region. */
|
||
public var region: String?
|
||
/** Status is the lifecycle state in the PROVIDER's own words (\"active\", \"running\", \"off\"), passed through rather than mapped onto a vocabulary of ours. A BYO machine's is \"online\" or \"offline\", decided by whether its last heartbeat is within 90s. */
|
||
public var status: String?
|
||
/** Type is the provider SIZE SLUG the machine runs at (\"s-2vcpu-4gb\", \"gpu-h100x8-640gb\") — the value a launch asks for, and what Vcpu/Mem/GPU are read out of when the provider states them no other way. \"byo-gpu\" for a dialed-in machine, which was never bought from a size catalog. */
|
||
public var type: String?
|
||
/** Vcpu is logical cores — the provider's own cpuSize when that is a clean integer, else the count read out of the size slug (4 from \"s-4vcpu-8gb\"). ABSENT, never 0, when neither says. A BYO machine leaves it absent here; its real core count is on GET /v1/compute/fleet/workers. */
|
||
public var vcpu: Int64?
|
||
|
||
public init(agent: String? = nil, binding: AgentBinding? = nil, createdTime: String? = nil, gpu: String? = nil, id: String? = nil, image: String? = nil, mem: String? = nil, name: String? = nil, os: String? = nil, privateIp: String? = nil, provider: String? = nil, publicIp: String? = nil, region: String? = nil, status: String? = nil, type: String? = nil, vcpu: Int64? = nil) {
|
||
self.agent = agent
|
||
self.binding = binding
|
||
self.createdTime = createdTime
|
||
self.gpu = gpu
|
||
self.id = id
|
||
self.image = image
|
||
self.mem = mem
|
||
self.name = name
|
||
self.os = os
|
||
self.privateIp = privateIp
|
||
self.provider = provider
|
||
self.publicIp = publicIp
|
||
self.region = region
|
||
self.status = status
|
||
self.type = type
|
||
self.vcpu = vcpu
|
||
}
|
||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||
case agent
|
||
case binding
|
||
case createdTime
|
||
case gpu
|
||
case id
|
||
case image
|
||
case mem
|
||
case name
|
||
case os
|
||
case privateIp
|
||
case provider
|
||
case publicIp
|
||
case region
|
||
case status
|
||
case type
|
||
case vcpu
|
||
}
|
||
|
||
// Encodable protocol methods
|
||
|
||
public func encode(to encoder: Encoder) throws {
|
||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||
try container.encodeIfPresent(agent, forKey: .agent)
|
||
try container.encodeIfPresent(binding, forKey: .binding)
|
||
try container.encodeIfPresent(createdTime, forKey: .createdTime)
|
||
try container.encodeIfPresent(gpu, forKey: .gpu)
|
||
try container.encodeIfPresent(id, forKey: .id)
|
||
try container.encodeIfPresent(image, forKey: .image)
|
||
try container.encodeIfPresent(mem, forKey: .mem)
|
||
try container.encodeIfPresent(name, forKey: .name)
|
||
try container.encodeIfPresent(os, forKey: .os)
|
||
try container.encodeIfPresent(privateIp, forKey: .privateIp)
|
||
try container.encodeIfPresent(provider, forKey: .provider)
|
||
try container.encodeIfPresent(publicIp, forKey: .publicIp)
|
||
try container.encodeIfPresent(region, forKey: .region)
|
||
try container.encodeIfPresent(status, forKey: .status)
|
||
try container.encodeIfPresent(type, forKey: .type)
|
||
try container.encodeIfPresent(vcpu, forKey: .vcpu)
|
||
}
|
||
}
|
||
|
||
|
||
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
||
extension MachineView: Identifiable {}
|