Skip to main content

gitbundle_sdk/models/
rule_create_input.rs

1/*
2 * GitBundle API
3 *
4 * GitBundle API documentation.
5 *
6 * The version of the OpenAPI document: 3.4.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RuleCreateInput {
17    #[serde(
18        rename = "definition",
19        default,
20        with = "::serde_with::rust::double_option",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub definition: Option<Option<Box<models::ProtectionDefinition>>>,
24    #[serde(rename = "description")]
25    pub description: String,
26    #[serde(rename = "name")]
27    pub name: String,
28    #[serde(rename = "pattern")]
29    pub pattern: Box<models::ProtectionPattern>,
30    #[serde(rename = "state")]
31    pub state: models::RuleState,
32    #[serde(rename = "type")]
33    pub r#type: models::RuleType,
34}
35
36impl RuleCreateInput {
37    pub fn new(
38        description: String,
39        name: String,
40        pattern: models::ProtectionPattern,
41        state: models::RuleState,
42        r#type: models::RuleType,
43    ) -> RuleCreateInput {
44        RuleCreateInput {
45            definition: None,
46            description,
47            name,
48            pattern: Box::new(pattern),
49            state,
50            r#type,
51        }
52    }
53}