windmill_api/models/create_variable.rs
1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.864.0
7 * Contact: contact@windmill.dev
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 CreateVariable {
16 /// The path to the variable
17 #[serde(rename = "path")]
18 pub path: String,
19 /// The value of the variable. For a secret, `$external:vault://<path>#<key>` stores a reference to an existing secret in the instance's external HashiCorp Vault (path as `vault kv get` takes it) instead of a value; without `#<key>` it reads the whole secret as a JSON object of its fields. It is resolved on each read, only under the path prefixes a superadmin allowed for the workspace, and is returned as-is when the secret is not decrypted.
20 #[serde(rename = "value")]
21 pub value: String,
22 /// Whether the variable is a secret
23 #[serde(rename = "is_secret")]
24 pub is_secret: bool,
25 /// The description of the variable
26 #[serde(rename = "description")]
27 pub description: String,
28 /// Ignored. A variable is linked to an OAuth account only when `createAccount` creates both.
29 #[serde(rename = "account", skip_serializing_if = "Option::is_none")]
30 pub account: Option<i32>,
31 /// Whether the variable is an OAuth variable
32 #[serde(rename = "is_oauth", skip_serializing_if = "Option::is_none")]
33 pub is_oauth: Option<bool>,
34 /// When to garbage-collect the variable. Used for ephemeral secrets; the variable is deleted once this is reached. Not the value's expiry — see value_valid_until.
35 #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
36 pub expires_at: Option<String>,
37 /// When the value stored in this variable stops working. Triggers the workspace's variable expiration handler ahead of it, by the handler's `notify_before_secs` (1 day by default); never causes the variable to be deleted.
38 #[serde(rename = "value_valid_until", skip_serializing_if = "Option::is_none")]
39 pub value_valid_until: Option<String>,
40 #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
41 pub labels: Option<Vec<String>>,
42 #[serde(rename = "ws_specific", skip_serializing_if = "Option::is_none")]
43 pub ws_specific: Option<bool>,
44}
45
46impl CreateVariable {
47 pub fn new(path: String, value: String, is_secret: bool, description: String) -> CreateVariable {
48 CreateVariable {
49 path,
50 value,
51 is_secret,
52 description,
53 account: None,
54 is_oauth: None,
55 expires_at: None,
56 value_valid_until: None,
57 labels: None,
58 ws_specific: None,
59 }
60 }
61}
62