openapi_github/models/
codespace.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/// Codespace : A codespace.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Codespace {
17    #[serde(rename = "id")]
18    pub id: i32,
19    /// Automatically generated name of this codespace.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// Display name for this codespace.
23    #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub display_name: Option<Option<String>>,
25    /// UUID identifying this codespace's environment.
26    #[serde(rename = "environment_id", deserialize_with = "Option::deserialize")]
27    pub environment_id: Option<String>,
28    #[serde(rename = "owner")]
29    pub owner: Box<models::SimpleUser>,
30    #[serde(rename = "billable_owner")]
31    pub billable_owner: Box<models::SimpleUser>,
32    #[serde(rename = "repository")]
33    pub repository: Box<models::MinimalRepository>,
34    #[serde(rename = "machine", deserialize_with = "Option::deserialize")]
35    pub machine: Option<Box<models::NullableCodespaceMachine>>,
36    /// Path to devcontainer.json from repo root used to create Codespace.
37    #[serde(rename = "devcontainer_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub devcontainer_path: Option<Option<String>>,
39    /// Whether the codespace was created from a prebuild.
40    #[serde(rename = "prebuild", deserialize_with = "Option::deserialize")]
41    pub prebuild: Option<bool>,
42    #[serde(rename = "created_at")]
43    pub created_at: String,
44    #[serde(rename = "updated_at")]
45    pub updated_at: String,
46    /// Last known time this codespace was started.
47    #[serde(rename = "last_used_at")]
48    pub last_used_at: String,
49    /// State of this codespace.
50    #[serde(rename = "state")]
51    pub state: State,
52    /// API URL for this codespace.
53    #[serde(rename = "url")]
54    pub url: String,
55    #[serde(rename = "git_status")]
56    pub git_status: Box<models::CodespaceGitStatus>,
57    /// The initally assigned location of a new codespace.
58    #[serde(rename = "location")]
59    pub location: Location,
60    /// The number of minutes of inactivity after which this codespace will be automatically stopped.
61    #[serde(rename = "idle_timeout_minutes", deserialize_with = "Option::deserialize")]
62    pub idle_timeout_minutes: Option<i32>,
63    /// URL to access this codespace on the web.
64    #[serde(rename = "web_url")]
65    pub web_url: String,
66    /// API URL to access available alternate machine types for this codespace.
67    #[serde(rename = "machines_url")]
68    pub machines_url: String,
69    /// API URL to start this codespace.
70    #[serde(rename = "start_url")]
71    pub start_url: String,
72    /// API URL to stop this codespace.
73    #[serde(rename = "stop_url")]
74    pub stop_url: String,
75    /// API URL to publish this codespace to a new repository.
76    #[serde(rename = "publish_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
77    pub publish_url: Option<Option<String>>,
78    /// API URL for the Pull Request associated with this codespace, if any.
79    #[serde(rename = "pulls_url", deserialize_with = "Option::deserialize")]
80    pub pulls_url: Option<String>,
81    #[serde(rename = "recent_folders")]
82    pub recent_folders: Vec<String>,
83    #[serde(rename = "runtime_constraints", skip_serializing_if = "Option::is_none")]
84    pub runtime_constraints: Option<Box<models::CodespaceRuntimeConstraints>>,
85    /// Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.
86    #[serde(rename = "pending_operation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
87    pub pending_operation: Option<Option<bool>>,
88    /// Text to show user when codespace is disabled by a pending operation
89    #[serde(rename = "pending_operation_disabled_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
90    pub pending_operation_disabled_reason: Option<Option<String>>,
91    /// Text to show user when codespace idle timeout minutes has been overriden by an organization policy
92    #[serde(rename = "idle_timeout_notice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
93    pub idle_timeout_notice: Option<Option<String>>,
94    /// Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).
95    #[serde(rename = "retention_period_minutes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
96    pub retention_period_minutes: Option<Option<i32>>,
97    /// When a codespace will be auto-deleted based on the \"retention_period_minutes\" and \"last_used_at\"
98    #[serde(rename = "retention_expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
99    pub retention_expires_at: Option<Option<String>>,
100    /// The text to display to a user when a codespace has been stopped for a potentially actionable reason.
101    #[serde(rename = "last_known_stop_notice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
102    pub last_known_stop_notice: Option<Option<String>>,
103}
104
105impl Codespace {
106    /// A codespace.
107    pub fn new(id: i32, name: String, environment_id: Option<String>, owner: models::SimpleUser, billable_owner: models::SimpleUser, repository: models::MinimalRepository, machine: Option<models::NullableCodespaceMachine>, prebuild: Option<bool>, created_at: String, updated_at: String, last_used_at: String, state: State, url: String, git_status: models::CodespaceGitStatus, location: Location, idle_timeout_minutes: Option<i32>, web_url: String, machines_url: String, start_url: String, stop_url: String, pulls_url: Option<String>, recent_folders: Vec<String>) -> Codespace {
108        Codespace {
109            id,
110            name,
111            display_name: None,
112            environment_id,
113            owner: Box::new(owner),
114            billable_owner: Box::new(billable_owner),
115            repository: Box::new(repository),
116            machine: machine.map(Box::new),
117            devcontainer_path: None,
118            prebuild,
119            created_at,
120            updated_at,
121            last_used_at,
122            state,
123            url,
124            git_status: Box::new(git_status),
125            location,
126            idle_timeout_minutes,
127            web_url,
128            machines_url,
129            start_url,
130            stop_url,
131            publish_url: None,
132            pulls_url,
133            recent_folders,
134            runtime_constraints: None,
135            pending_operation: None,
136            pending_operation_disabled_reason: None,
137            idle_timeout_notice: None,
138            retention_period_minutes: None,
139            retention_expires_at: None,
140            last_known_stop_notice: None,
141        }
142    }
143}
144/// State of this codespace.
145#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
146pub enum State {
147    #[serde(rename = "Unknown")]
148    Unknown,
149    #[serde(rename = "Created")]
150    Created,
151    #[serde(rename = "Queued")]
152    Queued,
153    #[serde(rename = "Provisioning")]
154    Provisioning,
155    #[serde(rename = "Available")]
156    Available,
157    #[serde(rename = "Awaiting")]
158    Awaiting,
159    #[serde(rename = "Unavailable")]
160    Unavailable,
161    #[serde(rename = "Deleted")]
162    Deleted,
163    #[serde(rename = "Moved")]
164    Moved,
165    #[serde(rename = "Shutdown")]
166    Shutdown,
167    #[serde(rename = "Archived")]
168    Archived,
169    #[serde(rename = "Starting")]
170    Starting,
171    #[serde(rename = "ShuttingDown")]
172    ShuttingDown,
173    #[serde(rename = "Failed")]
174    Failed,
175    #[serde(rename = "Exporting")]
176    Exporting,
177    #[serde(rename = "Updating")]
178    Updating,
179    #[serde(rename = "Rebuilding")]
180    Rebuilding,
181}
182
183impl Default for State {
184    fn default() -> State {
185        Self::Unknown
186    }
187}
188/// The initally assigned location of a new codespace.
189#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
190pub enum Location {
191    #[serde(rename = "EastUs")]
192    EastUs,
193    #[serde(rename = "SouthEastAsia")]
194    SouthEastAsia,
195    #[serde(rename = "WestEurope")]
196    WestEurope,
197    #[serde(rename = "WestUs2")]
198    WestUs2,
199}
200
201impl Default for Location {
202    fn default() -> Location {
203        Self::EastUs
204    }
205}
206