1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CodeRun {
/// Args become the PROGRAM's argv, never the compiler's. For the compiled languages the toolchain builds first and these are passed to the binary it produced.
#[serde(rename = "args", skip_serializing_if = "Option::is_none")]
pub args: Option<Vec<String>>,
/// Code is the WHOLE program, not a fragment: it is written to a single file and that file is what runs, so a compiled language needs its entry point and an interpreted one runs top to bottom.
#[serde(rename = "code")]
pub code: String,
/// Files are inputs the host already put in some session. Each names the session its bytes live in, which is usually — and ideally — the session this run wants.
#[serde(rename = "files", skip_serializing_if = "Option::is_none")]
pub files: Option<Vec<models::CodeFile>>,
/// Lang selects the toolchain, and with it the filename the code is written to and the line that runs it: py, js, ts, bash, r, php, go, rs, c, cpp, java, d, f90. Anything else is refused rather than guessed at — a run in the wrong language fails somewhere deep in a compiler, which reads as an outage.
#[serde(rename = "lang")]
pub lang: String,
/// RuntimeSessionHint is the stateful-session hint. It is carried so a client that sends it is not silently misread, and it selects nothing here: every session in this implementation is already a warm sandbox, so there is no second kind of runtime for a hint to choose between.
#[serde(rename = "runtime_session_hint", skip_serializing_if = "Option::is_none")]
pub runtime_session_hint: Option<String>,
/// SessionID continues an EXISTING sandbox, which is what makes runs stateful: the same filesystem, so one run's output file is the next run's input. Empty leases a fresh sandbox and the id it got comes back on the result.
#[serde(rename = "session_id", skip_serializing_if = "Option::is_none")]
pub session_id: Option<String>,
/// UserID attributes the run inside the caller's org. It is a label, never a tenant: the org is resolved from the validated principal and a value here cannot widen what the run may reach.
#[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
pub user_id: Option<String>,
}
impl CodeRun {
pub fn new(code: String, lang: String) -> CodeRun {
CodeRun {
args: None,
code,
files: None,
lang,
runtime_session_hint: None,
session_id: None,
user_id: None,
}
}
}