Skip to main content

windmill_api/models/
create_protection_rule_request.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 CreateProtectionRuleRequest {
16    /// Unique name for the protection rule
17    #[serde(rename = "name")]
18    pub name: String,
19    /// Configuration of protection restrictions
20    #[serde(rename = "rules")]
21    pub rules: Vec<models::ProtectionRuleKind>,
22    /// Groups that can bypass this ruleset
23    #[serde(rename = "bypass_groups")]
24    pub bypass_groups: Vec<String>,
25    /// Users that can bypass this ruleset
26    #[serde(rename = "bypass_users")]
27    pub bypass_users: Vec<String>,
28    /// 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.
29    #[serde(rename = "fork_role_mapping", skip_serializing_if = "Option::is_none")]
30    pub fork_role_mapping: Option<std::collections::HashMap<String, String>>,
31}
32
33impl CreateProtectionRuleRequest {
34    pub fn new(name: String, rules: Vec<models::ProtectionRuleKind>, bypass_groups: Vec<String>, bypass_users: Vec<String>) -> CreateProtectionRuleRequest {
35        CreateProtectionRuleRequest {
36            name,
37            rules,
38            bypass_groups,
39            bypass_users,
40            fork_role_mapping: None,
41        }
42    }
43}
44