openapi_github/models/
repository_ruleset_bypass_actor.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/// RepositoryRulesetBypassActor : An actor that can bypass rules in a ruleset
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RepositoryRulesetBypassActor {
17    /// The ID of the actor that can bypass a ruleset. If `actor_type` is `OrganizationAdmin`, this should be `1`. If `actor_type` is `DeployKey`, this should be null. `OrganizationAdmin` is not applicable for personal repositories. 
18    #[serde(rename = "actor_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub actor_id: Option<Option<i32>>,
20    /// The type of actor that can bypass a ruleset. 
21    #[serde(rename = "actor_type")]
22    pub actor_type: ActorType,
23    /// When the specified actor can bypass the ruleset. `pull_request` means that an actor can only bypass rules on pull requests. `pull_request` is not applicable for the `DeployKey` actor type. 
24    #[serde(rename = "bypass_mode")]
25    pub bypass_mode: BypassMode,
26}
27
28impl RepositoryRulesetBypassActor {
29    /// An actor that can bypass rules in a ruleset
30    pub fn new(actor_type: ActorType, bypass_mode: BypassMode) -> RepositoryRulesetBypassActor {
31        RepositoryRulesetBypassActor {
32            actor_id: None,
33            actor_type,
34            bypass_mode,
35        }
36    }
37}
38/// The type of actor that can bypass a ruleset. 
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum ActorType {
41    #[serde(rename = "Integration")]
42    Integration,
43    #[serde(rename = "OrganizationAdmin")]
44    OrganizationAdmin,
45    #[serde(rename = "RepositoryRole")]
46    RepositoryRole,
47    #[serde(rename = "Team")]
48    Team,
49    #[serde(rename = "DeployKey")]
50    DeployKey,
51}
52
53impl Default for ActorType {
54    fn default() -> ActorType {
55        Self::Integration
56    }
57}
58/// When the specified actor can bypass the ruleset. `pull_request` means that an actor can only bypass rules on pull requests. `pull_request` is not applicable for the `DeployKey` actor type. 
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum BypassMode {
61    #[serde(rename = "always")]
62    Always,
63    #[serde(rename = "pull_request")]
64    PullRequest,
65}
66
67impl Default for BypassMode {
68    fn default() -> BypassMode {
69        Self::Always
70    }
71}
72