openapi_github/models/
environment.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/// Environment : Details of a deployment environment
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Environment {
17    /// The id of the environment.
18    #[serde(rename = "id")]
19    pub id: i32,
20    #[serde(rename = "node_id")]
21    pub node_id: String,
22    /// The name of the environment.
23    #[serde(rename = "name")]
24    pub name: String,
25    #[serde(rename = "url")]
26    pub url: String,
27    #[serde(rename = "html_url")]
28    pub html_url: String,
29    /// The time that the environment was created, in ISO 8601 format.
30    #[serde(rename = "created_at")]
31    pub created_at: String,
32    /// The time that the environment was last updated, in ISO 8601 format.
33    #[serde(rename = "updated_at")]
34    pub updated_at: String,
35    /// Built-in deployment protection rules for the environment.
36    #[serde(rename = "protection_rules", skip_serializing_if = "Option::is_none")]
37    pub protection_rules: Option<Vec<models::EnvironmentProtectionRulesInner>>,
38    #[serde(rename = "deployment_branch_policy", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub deployment_branch_policy: Option<Option<Box<models::DeploymentBranchPolicySettings>>>,
40}
41
42impl Environment {
43    /// Details of a deployment environment
44    pub fn new(id: i32, node_id: String, name: String, url: String, html_url: String, created_at: String, updated_at: String) -> Environment {
45        Environment {
46            id,
47            node_id,
48            name,
49            url,
50            html_url,
51            created_at,
52            updated_at,
53            protection_rules: None,
54            deployment_branch_policy: None,
55        }
56    }
57}
58