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.631.1
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}
32
33impl ProtectionRuleset {
34    /// A workspace protection rule defining restrictions and bypass permissions
35    pub fn new(name: String, rules: Vec<models::ProtectionRuleKind>, bypass_groups: Vec<String>, bypass_users: Vec<String>) -> ProtectionRuleset {
36        ProtectionRuleset {
37            name,
38            workspace_id: None,
39            rules,
40            bypass_groups,
41            bypass_users,
42        }
43    }
44}
45