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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use serde::Serialize;

use crate::rpc::{ExecutionLocation, LauncherConfig};

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SpawnedCommandOptions<'a> {
    /// Will automatically terminate the command after this amount of time. Default: 3600.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeout_seconds: Option<u32>,
    /// Will automatically terminate the command if no output is received from the process for this amount of time.
    /// Default: 600.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeout_after_inactive_seconds: Option<u32>,
    /// LauncherConfig to use.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub launcher_config: Option<&'a LauncherConfig>,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SpawnCommandParams<'a, S: AsRef<str>> {
    /// Which launcher to use for running the command.
    pub execution_location: ExecutionLocation,
    /// Name of the command to run, without any arguments.
    pub command: &'a str,
    /// Arguments to pass to the command
    #[serde(serialize_with = "super::super::serialize_asref_str_seq")]
    pub args: &'a [S],
    #[serde(skip_serializing_if = "Option::is_none")]
    pub options: Option<SpawnedCommandOptions<'a>>,
    /// If true, immediately subscribes you to events "stdout", "stderr" and "exit" for the spawned command. Default:
    /// true.
    #[cfg(feature = "events")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribe_to_events: Option<bool>,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FilesystemAccess<'a> {
    pub model_id: &'a str,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
#[serde(bound(serialize = ""))]
pub struct SpawnCommandForModelParams<'a, S: AsRef<str>> {
    /// The model's id.
    pub model_id: &'a str,
    /// Which launcher to use for running the command.
    pub execution_location: ExecutionLocation,
    /// Name of the command to run, without any arguments.
    pub command: &'a str,
    /// Arguments to pass to the command
    #[serde(serialize_with = "super::super::serialize_asref_str_seq")]
    pub args: &'a [S],
    #[serde(skip_serializing_if = "Option::is_none")]
    pub options: Option<SpawnedCommandOptions<'a>>,
    /// If true, immediately subscribes you to events "stdout", "stderr" and "exit" for the spawned command. Default:
    /// true.
    #[cfg(feature = "events")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribe_to_events: Option<bool>,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TerminateSpawnedCommandParams<'a> {
    /// The spawned command's id.
    pub spawned_command_id: &'a str,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GetSpawnedCommandsParams<'a, S: AsRef<str>> {
    /// Which spawned commands to fetch. If unspecified, all running commands will be fetched.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spawned_command_ids: Option<&'a [S]>,
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WriteToSpawnedCommandParams<'a, T: AsRef<[u8]>> {
    /// The spawned command's id.
    pub spawned_command_id: &'a str,
    #[serde(skip_serializing)]
    pub data: T,
}

#[cfg(feature = "events")]
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SpawnedSubscribeToEventsParams<'a> {
    /// The spawned command's id.
    pub spawned_command_id: &'a str,
}

#[cfg(feature = "events")]
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SpawnedUnsubscribeFromEventsParams<'a> {
    /// The spawned command's id.
    pub spawned_command_id: &'a str,
}