openapi_github/models/
deployment_status.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/// DeploymentStatus : The status of a deployment.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DeploymentStatus {
17    #[serde(rename = "url")]
18    pub url: String,
19    #[serde(rename = "id")]
20    pub id: i32,
21    #[serde(rename = "node_id")]
22    pub node_id: String,
23    /// The state of the status.
24    #[serde(rename = "state")]
25    pub state: State,
26    #[serde(rename = "creator", deserialize_with = "Option::deserialize")]
27    pub creator: Option<Box<models::NullableSimpleUser>>,
28    /// A short description of the status.
29    #[serde(rename = "description")]
30    pub description: String,
31    /// The environment of the deployment that the status is for.
32    #[serde(rename = "environment", skip_serializing_if = "Option::is_none")]
33    pub environment: Option<String>,
34    /// Deprecated: the URL to associate with this status.
35    #[serde(rename = "target_url")]
36    pub target_url: String,
37    #[serde(rename = "created_at")]
38    pub created_at: String,
39    #[serde(rename = "updated_at")]
40    pub updated_at: String,
41    #[serde(rename = "deployment_url")]
42    pub deployment_url: String,
43    #[serde(rename = "repository_url")]
44    pub repository_url: String,
45    /// The URL for accessing your environment.
46    #[serde(rename = "environment_url", skip_serializing_if = "Option::is_none")]
47    pub environment_url: Option<String>,
48    /// The URL to associate with this status.
49    #[serde(rename = "log_url", skip_serializing_if = "Option::is_none")]
50    pub log_url: Option<String>,
51    #[serde(rename = "performed_via_github_app", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
52    pub performed_via_github_app: Option<Option<Box<models::NullableIntegration>>>,
53}
54
55impl DeploymentStatus {
56    /// The status of a deployment.
57    pub fn new(url: String, id: i32, node_id: String, state: State, creator: Option<models::NullableSimpleUser>, description: String, target_url: String, created_at: String, updated_at: String, deployment_url: String, repository_url: String) -> DeploymentStatus {
58        DeploymentStatus {
59            url,
60            id,
61            node_id,
62            state,
63            creator: creator.map(Box::new),
64            description,
65            environment: None,
66            target_url,
67            created_at,
68            updated_at,
69            deployment_url,
70            repository_url,
71            environment_url: None,
72            log_url: None,
73            performed_via_github_app: None,
74        }
75    }
76}
77/// The state of the status.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum State {
80    #[serde(rename = "error")]
81    Error,
82    #[serde(rename = "failure")]
83    Failure,
84    #[serde(rename = "inactive")]
85    Inactive,
86    #[serde(rename = "pending")]
87    Pending,
88    #[serde(rename = "success")]
89    Success,
90    #[serde(rename = "queued")]
91    Queued,
92    #[serde(rename = "in_progress")]
93    InProgress,
94}
95
96impl Default for State {
97    fn default() -> State {
98        Self::Error
99    }
100}
101