openapi_github/models/
rule_suite.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/// RuleSuite : Response
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RuleSuite {
17    /// The unique identifier of the rule insight.
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<i32>,
20    /// The number that identifies the user.
21    #[serde(rename = "actor_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub actor_id: Option<Option<i32>>,
23    /// The handle for the GitHub user account.
24    #[serde(rename = "actor_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub actor_name: Option<Option<String>>,
26    /// The first commit sha before the push evaluation.
27    #[serde(rename = "before_sha", skip_serializing_if = "Option::is_none")]
28    pub before_sha: Option<String>,
29    /// The last commit sha in the push evaluation.
30    #[serde(rename = "after_sha", skip_serializing_if = "Option::is_none")]
31    pub after_sha: Option<String>,
32    /// The ref name that the evaluation ran on.
33    #[serde(rename = "ref", skip_serializing_if = "Option::is_none")]
34    pub r#ref: Option<String>,
35    /// The ID of the repository associated with the rule evaluation.
36    #[serde(rename = "repository_id", skip_serializing_if = "Option::is_none")]
37    pub repository_id: Option<i32>,
38    /// The name of the repository without the `.git` extension.
39    #[serde(rename = "repository_name", skip_serializing_if = "Option::is_none")]
40    pub repository_name: Option<String>,
41    #[serde(rename = "pushed_at", skip_serializing_if = "Option::is_none")]
42    pub pushed_at: Option<String>,
43    /// The result of the rule evaluations for rules with the `active` enforcement status.
44    #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
45    pub result: Option<Result>,
46    /// The result of the rule evaluations for rules with the `active` and `evaluate` enforcement statuses, demonstrating whether rules would pass or fail if all rules in the rule suite were `active`.
47    #[serde(rename = "evaluation_result", skip_serializing_if = "Option::is_none")]
48    pub evaluation_result: Option<EvaluationResult>,
49    /// Details on the evaluated rules.
50    #[serde(rename = "rule_evaluations", skip_serializing_if = "Option::is_none")]
51    pub rule_evaluations: Option<Vec<models::RuleSuiteRuleEvaluationsInner>>,
52}
53
54impl RuleSuite {
55    /// Response
56    pub fn new() -> RuleSuite {
57        RuleSuite {
58            id: None,
59            actor_id: None,
60            actor_name: None,
61            before_sha: None,
62            after_sha: None,
63            r#ref: None,
64            repository_id: None,
65            repository_name: None,
66            pushed_at: None,
67            result: None,
68            evaluation_result: None,
69            rule_evaluations: None,
70        }
71    }
72}
73/// The result of the rule evaluations for rules with the `active` enforcement status.
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
75pub enum Result {
76    #[serde(rename = "pass")]
77    Pass,
78    #[serde(rename = "fail")]
79    Fail,
80    #[serde(rename = "bypass")]
81    Bypass,
82}
83
84impl Default for Result {
85    fn default() -> Result {
86        Self::Pass
87    }
88}
89/// The result of the rule evaluations for rules with the `active` and `evaluate` enforcement statuses, demonstrating whether rules would pass or fail if all rules in the rule suite were `active`.
90#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
91pub enum EvaluationResult {
92    #[serde(rename = "pass")]
93    Pass,
94    #[serde(rename = "fail")]
95    Fail,
96}
97
98impl Default for EvaluationResult {
99    fn default() -> EvaluationResult {
100        Self::Pass
101    }
102}
103