hanzo_client/models/definition.rs
1/*
2 * Hanzo Cloud API
3 *
4 * 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/.
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Definition {
16 /// Code is the source to run, capped so one function cannot amplify the store.
17 #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
18 pub code: Option<String>,
19 /// EnvNames are the secret NAMES to mount. Values live in the secret store and are never carried here.
20 #[serde(rename = "envNames", skip_serializing_if = "Option::is_none")]
21 pub env_names: Option<Vec<String>>,
22 /// Environment is a second spelling of runtime, accepted so a console that says \"environment\" needs no translation.
23 #[serde(rename = "environment", skip_serializing_if = "Option::is_none")]
24 pub environment: Option<String>,
25 /// Handler is the entry point within the code.
26 #[serde(rename = "handler", skip_serializing_if = "Option::is_none")]
27 pub handler: Option<String>,
28 /// Image names a prebuilt image to run instead of source.
29 #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
30 pub image: Option<String>,
31 /// MemoryLimit is the memory the function runs with, defaulting to 256Mi. It is also the multiplier on the GB-seconds compute charge.
32 #[serde(rename = "memoryLimit", skip_serializing_if = "Option::is_none")]
33 pub memory_limit: Option<String>,
34 /// 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.
35 #[serde(rename = "name")]
36 pub name: String,
37 /// Namespace groups functions for display. It is cosmetic — the org is the isolation key — and is normalised to a DNS-safe label.
38 #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")]
39 pub namespace: Option<String>,
40 /// Runtime is the language the code runs under: node, python or deno.
41 #[serde(rename = "runtime", skip_serializing_if = "Option::is_none")]
42 pub runtime: Option<String>,
43 /// Target is where the function runs: sandbox (the default) or fleet, the org's own GPU fleet. fleet supports runtime=python only.
44 #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
45 pub target: Option<String>,
46 /// TimeoutSec is the per-invocation deadline, defaulting to 30 and clamped at 900 — a larger value is capped rather than reset to the default.
47 #[serde(rename = "timeoutSec", skip_serializing_if = "Option::is_none")]
48 pub timeout_sec: Option<i32>,
49}
50
51impl Definition {
52 pub fn new(name: String) -> Definition {
53 Definition {
54 code: None,
55 env_names: None,
56 environment: None,
57 handler: None,
58 image: None,
59 memory_limit: None,
60 name,
61 namespace: None,
62 runtime: None,
63 target: None,
64 timeout_sec: None,
65 }
66 }
67}
68