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.
81 lines
3.6 KiB
Swift
81 lines
3.6 KiB
Swift
//
|
|
// Definition.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Definition: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Code is the source to run, capped so one function cannot amplify the store. */
|
|
public var code: String?
|
|
/** EnvNames are the secret NAMES to mount. Values live in the secret store and are never carried here. */
|
|
public var envNames: [String]?
|
|
/** Environment is a second spelling of runtime, accepted so a console that says \"environment\" needs no translation. */
|
|
public var environment: String?
|
|
/** Handler is the entry point within the code. */
|
|
public var handler: String?
|
|
/** Image names a prebuilt image to run instead of source. */
|
|
public var image: String?
|
|
/** MemoryLimit is the memory the function runs with, defaulting to 256Mi. It is also the multiplier on the GB-seconds compute charge. */
|
|
public var memoryLimit: String?
|
|
/** Name is the function's org-unique handle and the segment that addresses it, matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. The names that would shadow a collection route are reserved. */
|
|
public var name: String
|
|
/** Namespace groups functions for display. It is cosmetic — the org is the isolation key — and is normalised to a DNS-safe label. */
|
|
public var namespace: String?
|
|
/** Runtime is the language the code runs under: node, python or deno. */
|
|
public var runtime: String?
|
|
/** Target is where the function runs: sandbox (the default) or fleet, the org's own GPU fleet. fleet supports runtime=python only. */
|
|
public var target: String?
|
|
/** TimeoutSec is the per-invocation deadline, defaulting to 30 and clamped at 900 — a larger value is capped rather than reset to the default. */
|
|
public var timeoutSec: Int64?
|
|
|
|
public init(code: String? = nil, envNames: [String]? = nil, environment: String? = nil, handler: String? = nil, image: String? = nil, memoryLimit: String? = nil, name: String, namespace: String? = nil, runtime: String? = nil, target: String? = nil, timeoutSec: Int64? = nil) {
|
|
self.code = code
|
|
self.envNames = envNames
|
|
self.environment = environment
|
|
self.handler = handler
|
|
self.image = image
|
|
self.memoryLimit = memoryLimit
|
|
self.name = name
|
|
self.namespace = namespace
|
|
self.runtime = runtime
|
|
self.target = target
|
|
self.timeoutSec = timeoutSec
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case code
|
|
case envNames
|
|
case environment
|
|
case handler
|
|
case image
|
|
case memoryLimit
|
|
case name
|
|
case namespace
|
|
case runtime
|
|
case target
|
|
case timeoutSec
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(code, forKey: .code)
|
|
try container.encodeIfPresent(envNames, forKey: .envNames)
|
|
try container.encodeIfPresent(environment, forKey: .environment)
|
|
try container.encodeIfPresent(handler, forKey: .handler)
|
|
try container.encodeIfPresent(image, forKey: .image)
|
|
try container.encodeIfPresent(memoryLimit, forKey: .memoryLimit)
|
|
try container.encode(name, forKey: .name)
|
|
try container.encodeIfPresent(namespace, forKey: .namespace)
|
|
try container.encodeIfPresent(runtime, forKey: .runtime)
|
|
try container.encodeIfPresent(target, forKey: .target)
|
|
try container.encodeIfPresent(timeoutSec, forKey: .timeoutSec)
|
|
}
|
|
}
|
|
|