Skip to main content

subspace_client_github/actions/model/
environment.rs

1use serde::Deserialize;
2
3#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
4pub struct Environment {
5    pub id: u64,
6    pub name: String,
7    #[serde(default)]
8    pub url: String,
9    #[serde(default)]
10    pub html_url: String,
11    #[serde(default)]
12    pub deployment_branch_policy: Option<DeploymentBranchPolicy>,
13    #[serde(default)]
14    pub protection_rules: Vec<ProtectionRule>,
15}
16
17#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
18pub struct DeploymentBranchPolicy {
19    pub protected_branches: bool,
20    pub custom_branch_policies: bool,
21}
22
23#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
24pub struct ProtectionRule {
25    pub id: u64,
26    #[serde(rename = "type")]
27    pub kind: String,
28    #[serde(default)]
29    pub wait_timer: Option<u64>,
30    #[serde(default)]
31    pub reviewers: Vec<Reviewer>,
32}
33
34#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
35pub struct ReviewerIdentity {
36    #[serde(default)]
37    pub login: Option<String>,
38    #[serde(default)]
39    pub name: Option<String>,
40    #[serde(default)]
41    pub slug: Option<String>,
42}
43
44#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
45pub struct Reviewer {
46    #[serde(rename = "type", default)]
47    pub kind: String,
48    #[serde(default)]
49    pub reviewer: Option<ReviewerIdentity>,
50}
51
52#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
53pub struct PendingDeployment {
54    pub environment: Environment,
55    #[serde(default)]
56    pub wait_timer: u64,
57    #[serde(default)]
58    pub wait_timer_started_at: Option<String>,
59    #[serde(default)]
60    pub reviewers: Vec<Reviewer>,
61    #[serde(default)]
62    pub current_user_can_approve: bool,
63}