openapi_github/models/
repos_create_repo_ruleset_request.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
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 ReposCreateRepoRulesetRequest {
16    /// The name of the ruleset.
17    #[serde(rename = "name")]
18    pub name: String,
19    /// The target of the ruleset  **Note**: The `push` target is in beta and is subject to change.
20    #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
21    pub target: Option<Target>,
22    #[serde(rename = "enforcement")]
23    pub enforcement: models::RepositoryRuleEnforcement,
24    /// The actors that can bypass the rules in this ruleset
25    #[serde(rename = "bypass_actors", skip_serializing_if = "Option::is_none")]
26    pub bypass_actors: Option<Vec<models::RepositoryRulesetBypassActor>>,
27    #[serde(rename = "conditions", skip_serializing_if = "Option::is_none")]
28    pub conditions: Option<Box<models::RepositoryRulesetConditions>>,
29    /// An array of rules within the ruleset.
30    #[serde(rename = "rules", skip_serializing_if = "Option::is_none")]
31    pub rules: Option<Vec<models::RepositoryRule>>,
32}
33
34impl ReposCreateRepoRulesetRequest {
35    pub fn new(name: String, enforcement: models::RepositoryRuleEnforcement) -> ReposCreateRepoRulesetRequest {
36        ReposCreateRepoRulesetRequest {
37            name,
38            target: None,
39            enforcement,
40            bypass_actors: None,
41            conditions: None,
42            rules: None,
43        }
44    }
45}
46/// The target of the ruleset  **Note**: The `push` target is in beta and is subject to change.
47#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
48pub enum Target {
49    #[serde(rename = "branch")]
50    Branch,
51    #[serde(rename = "tag")]
52    Tag,
53    #[serde(rename = "push")]
54    Push,
55}
56
57impl Default for Target {
58    fn default() -> Target {
59        Self::Branch
60    }
61}
62