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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* 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 Definition {
/// Code is the source to run, capped so one function cannot amplify the store.
#[serde(rename = "code", skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// EnvNames are the secret NAMES to mount. Values live in the secret store and are never carried here.
#[serde(rename = "envNames", skip_serializing_if = "Option::is_none")]
pub env_names: Option<Vec<String>>,
/// Environment is a second spelling of runtime, accepted so a console that says \"environment\" needs no translation.
#[serde(rename = "environment", skip_serializing_if = "Option::is_none")]
pub environment: Option<String>,
/// Handler is the entry point within the code.
#[serde(rename = "handler", skip_serializing_if = "Option::is_none")]
pub handler: Option<String>,
/// Image names a prebuilt image to run instead of source.
#[serde(rename = "image", skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
/// MemoryLimit is the memory the function runs with, defaulting to 256Mi. It is also the multiplier on the GB-seconds compute charge.
#[serde(rename = "memoryLimit", skip_serializing_if = "Option::is_none")]
pub memory_limit: Option<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.
#[serde(rename = "name")]
pub name: String,
/// Namespace groups functions for display. It is cosmetic — the org is the isolation key — and is normalised to a DNS-safe label.
#[serde(rename = "namespace", skip_serializing_if = "Option::is_none")]
pub namespace: Option<String>,
/// Runtime is the language the code runs under: node, python or deno.
#[serde(rename = "runtime", skip_serializing_if = "Option::is_none")]
pub runtime: Option<String>,
/// Target is where the function runs: sandbox (the default) or fleet, the org's own GPU fleet. fleet supports runtime=python only.
#[serde(rename = "target", skip_serializing_if = "Option::is_none")]
pub target: Option<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.
#[serde(rename = "timeoutSec", skip_serializing_if = "Option::is_none")]
pub timeout_sec: Option<i32>,
}
impl Definition {
pub fn new(name: String) -> Definition {
Definition {
code: None,
env_names: None,
environment: None,
handler: None,
image: None,
memory_limit: None,
name,
namespace: None,
runtime: None,
target: None,
timeout_sec: None,
}
}
}