agent_deploy_contract/
runtime_template.rs1use serde::{Deserialize, Serialize};
2
3use crate::CursorPage;
4
5pub type RuntimeTemplatePage = CursorPage<RuntimeTemplate>;
6
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
8#[serde(rename_all = "camelCase")]
9pub struct RuntimeTemplate {
10 pub id: String,
11 pub name: String,
12 pub repository_url: String,
13 pub git_ref: String,
14 pub subdirectory: Option<String>,
15 pub description: Option<String>,
16 pub enabled: bool,
17 pub version: i64,
18 pub created_at: String,
19 pub updated_at: String,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
23#[serde(rename_all = "camelCase")]
24pub struct CreateRuntimeTemplateRequest {
25 pub name: String,
26 pub repository_url: String,
27 #[serde(default = "default_git_ref")]
28 pub git_ref: String,
29 pub subdirectory: Option<String>,
30 pub description: Option<String>,
31 #[serde(default = "enabled_by_default")]
32 pub enabled: bool,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
36#[serde(rename_all = "camelCase")]
37pub struct UpdateRuntimeTemplateRequest {
38 pub name: String,
39 pub repository_url: String,
40 pub git_ref: String,
41 pub subdirectory: Option<String>,
42 pub description: Option<String>,
43 pub enabled: bool,
44 pub expected_version: i64,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
48#[serde(rename_all = "camelCase")]
49pub struct DeleteRuntimeTemplateRequest {
50 pub expected_version: i64,
51}
52
53#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
54#[serde(rename_all = "snake_case")]
55pub enum GitLabVisibility {
56 #[default]
57 Private,
58 Internal,
59 Public,
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
63#[serde(rename_all = "camelCase")]
64pub struct InitializeRuntimeTemplateRequest {
65 pub namespace: String,
66 pub project_name: String,
67 pub project_path: Option<String>,
68 pub description: Option<String>,
69 #[serde(default)]
70 pub visibility: GitLabVisibility,
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
74#[serde(rename_all = "camelCase")]
75pub struct RuntimeRepository {
76 pub project_id: u64,
77 pub path_with_namespace: String,
78 pub repository_url: String,
79 pub default_branch: Option<String>,
80}
81
82fn default_git_ref() -> String {
83 "main".to_string()
84}
85
86const fn enabled_by_default() -> bool {
87 true
88}