Skip to main content

windmill_api/models/
protection_ruleset.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.858.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ProtectionRuleset : A workspace protection rule defining restrictions and bypass permissions
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ProtectionRuleset {
17    /// Unique name for the protection rule
18    #[serde(rename = "name")]
19    pub name: String,
20    #[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
21    pub workspace_id: Option<String>,
22    /// Configuration of protection restrictions
23    #[serde(rename = "rules")]
24    pub rules: Vec<models::ProtectionRuleKind>,
25    /// Groups that can bypass this ruleset
26    #[serde(rename = "bypass_groups")]
27    pub bypass_groups: Vec<String>,
28    /// Users that can bypass this ruleset
29    #[serde(rename = "bypass_users")]
30    pub bypass_users: Vec<String>,
31    /// Role a member of this workspace gets in a fork of it, keyed by the role it holds here. Unmapped roles carry over unchanged; where two rulesets map the same role, the first by name wins. On update, omitting it leaves the stored mapping unchanged.
32    #[serde(rename = "fork_role_mapping", skip_serializing_if = "Option::is_none")]
33    pub fork_role_mapping: Option<std::collections::HashMap<String, String>>,
34}
35
36impl ProtectionRuleset {
37    /// A workspace protection rule defining restrictions and bypass permissions
38    pub fn new(name: String, rules: Vec<models::ProtectionRuleKind>, bypass_groups: Vec<String>, bypass_users: Vec<String>) -> ProtectionRuleset {
39        ProtectionRuleset {
40            name,
41            workspace_id: None,
42            rules,
43            bypass_groups,
44            bypass_users,
45            fork_role_mapping: None,
46        }
47    }
48}
49