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.
104 lines
6.8 KiB
Swift
104 lines
6.8 KiB
Swift
//
|
|
// Sandbox.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Sandbox: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Class is what the sandbox is FOR, and it decides the image, the working directory and the isolation: \"exec\" for a code-interpreter call (workdir /mnt/data, no project, bounded per org), \"dev\" for a workspace bound to a project (workdir /work, single-attach), \"desktop\" for one with a screen. */
|
|
public var _class: String?
|
|
/** Cluster is the attached cluster this sandbox runs on — the fleet-local name the lease named — or empty for the home cluster. Immutable for the life of the lease, like the pod it locates: every later call into the sandbox reads it to reach the right apiserver. */
|
|
public var cluster: String?
|
|
/** ConnectedAt is when somebody was last known to have this sandbox's project OPEN, Unix seconds. It is a fact with an EXPIRY rather than a flag: a watcher restamps it every beat of its stream, and it goes stale on its own when the stream dies, so nothing has to be turned off by a process that may not be there any more. The reaper reads it to choose WHICH idle allowance applies — see lifecycle.go. Zero means nobody has said so, which puts the sandbox on the short clock. */
|
|
public var connectedAt: Int64?
|
|
/** CreatedAt is when the lease was first taken, Unix seconds. */
|
|
public var createdAt: Int64?
|
|
/** Error is why the sandbox could not come up, in plain words. Present only with status \"error\", and it is the field to read rather than inferring a cause from the absence of a pod. */
|
|
public var error: String?
|
|
/** ExpiresAt is when the lease ends, Unix seconds. Past it the reaper may take the sandbox at any time; it is a deadline, not a guarantee of survival until then, since an idle sandbox goes sooner. */
|
|
public var expiresAt: Int64?
|
|
/** ID is the sandbox's server-minted handle and what every operation addresses it by. The caller does not choose it. */
|
|
public var id: String?
|
|
/** Image is the container image this sandbox is actually running — the one the class chose, or an override the policy admitted. It is what ran, not what was asked for. */
|
|
public var image: String?
|
|
/** Kind is the resource family this row belongs to. Always \"sandbox\" here; it exists because the store this shares is keyed across kinds. */
|
|
public var kind: String?
|
|
/** LastUsedAt is when the sandbox last did work, Unix seconds. The reaper reads it: a sandbox idle past the idle window is reclaimed even inside its TTL, because an idle lease is capacity nobody is using. */
|
|
public var lastUsedAt: Int64?
|
|
/** Org is the org that holds the lease — the validated caller's, never a value a request supplied. It is also the store's key, so a sandbox is not merely filtered out of another org's answers; it is unreachable from them. */
|
|
public var org: String?
|
|
/** Project is the project this sandbox is bound to. A dev or desktop sandbox has one and is SINGLE-ATTACH under it, so asking twice resumes rather than leasing a second; an exec sandbox has none. */
|
|
public var project: String?
|
|
/** Runtime is the isolation boundary this sandbox GOT, which is not always the one it asked for: a caller states a preference and runtimeFor answers with what the sandbox can actually have. Reported so a person comparing two runtimes is comparing the runtimes they got rather than the ones they typed — the difference between those two is the whole reason to record it. Empty means the node's default runtime, which is a real answer and not a missing one. This is not a copy that can go stale. runtimeClassName is IMMUTABLE on a pod, a sandbox's pod is created once and never recreated (restartPolicy Never, no pool), and its name is never reused — so for as long as the pod this row names exists, it is running this runtime. The alternative, asking the apiserver on every read, buys nothing and costs a round trip per row. */
|
|
public var runtime: String?
|
|
/** Status is where the sandbox is in its life: \"pending\" while the pod is coming up, \"running\" once it can take work, \"error\" when it cannot. Only a running sandbox takes an exec or mints an interactive ticket. */
|
|
public var status: String?
|
|
/** Volume is the persistent volume attached to the sandbox, when it has one. A dev sandbox keeps its work across leases through it; an exec sandbox has none and loses everything outside /mnt/data when the lease ends. */
|
|
public var volume: String?
|
|
|
|
public init(_class: String? = nil, cluster: String? = nil, connectedAt: Int64? = nil, createdAt: Int64? = nil, error: String? = nil, expiresAt: Int64? = nil, id: String? = nil, image: String? = nil, kind: String? = nil, lastUsedAt: Int64? = nil, org: String? = nil, project: String? = nil, runtime: String? = nil, status: String? = nil, volume: String? = nil) {
|
|
self._class = _class
|
|
self.cluster = cluster
|
|
self.connectedAt = connectedAt
|
|
self.createdAt = createdAt
|
|
self.error = error
|
|
self.expiresAt = expiresAt
|
|
self.id = id
|
|
self.image = image
|
|
self.kind = kind
|
|
self.lastUsedAt = lastUsedAt
|
|
self.org = org
|
|
self.project = project
|
|
self.runtime = runtime
|
|
self.status = status
|
|
self.volume = volume
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case _class = "class"
|
|
case cluster
|
|
case connectedAt
|
|
case createdAt
|
|
case error
|
|
case expiresAt
|
|
case id
|
|
case image
|
|
case kind
|
|
case lastUsedAt
|
|
case org
|
|
case project
|
|
case runtime
|
|
case status
|
|
case volume
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(_class, forKey: ._class)
|
|
try container.encodeIfPresent(cluster, forKey: .cluster)
|
|
try container.encodeIfPresent(connectedAt, forKey: .connectedAt)
|
|
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
|
try container.encodeIfPresent(error, forKey: .error)
|
|
try container.encodeIfPresent(expiresAt, forKey: .expiresAt)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(image, forKey: .image)
|
|
try container.encodeIfPresent(kind, forKey: .kind)
|
|
try container.encodeIfPresent(lastUsedAt, forKey: .lastUsedAt)
|
|
try container.encodeIfPresent(org, forKey: .org)
|
|
try container.encodeIfPresent(project, forKey: .project)
|
|
try container.encodeIfPresent(runtime, forKey: .runtime)
|
|
try container.encodeIfPresent(status, forKey: .status)
|
|
try container.encodeIfPresent(volume, forKey: .volume)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension Sandbox: Identifiable {}
|