openapi_github/models/
repos_create_deployment_status_request.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ReposCreateDeploymentStatusRequest {
16    /// The state of the status. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub.
17    #[serde(rename = "state")]
18    pub state: State,
19    /// The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. **Note:** It's recommended to use the `log_url` parameter, which replaces `target_url`.
20    #[serde(rename = "target_url", skip_serializing_if = "Option::is_none")]
21    pub target_url: Option<String>,
22    /// The full URL of the deployment's output. This parameter replaces `target_url`. We will continue to accept `target_url` to support legacy uses, but we recommend replacing `target_url` with `log_url`. Setting `log_url` will automatically set `target_url` to the same value. Default: `\"\"`
23    #[serde(rename = "log_url", skip_serializing_if = "Option::is_none")]
24    pub log_url: Option<String>,
25    /// A short description of the status. The maximum description length is 140 characters.
26    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
27    pub description: Option<String>,
28    /// Name for the target deployment environment, which can be changed when setting a deploy status. For example, `production`, `staging`, or `qa`. If not defined, the environment of the previous status on the deployment will be used, if it exists. Otherwise, the environment of the deployment will be used.
29    #[serde(rename = "environment", skip_serializing_if = "Option::is_none")]
30    pub environment: Option<String>,
31    /// Sets the URL for accessing your environment. Default: `\"\"`
32    #[serde(rename = "environment_url", skip_serializing_if = "Option::is_none")]
33    pub environment_url: Option<String>,
34    /// Adds a new `inactive` status to all prior non-transient, non-production environment deployments with the same repository and `environment` name as the created status's deployment. An `inactive` status is only added to deployments that had a `success` state. Default: `true`
35    #[serde(rename = "auto_inactive", skip_serializing_if = "Option::is_none")]
36    pub auto_inactive: Option<bool>,
37}
38
39impl ReposCreateDeploymentStatusRequest {
40    pub fn new(state: State) -> ReposCreateDeploymentStatusRequest {
41        ReposCreateDeploymentStatusRequest {
42            state,
43            target_url: None,
44            log_url: None,
45            description: None,
46            environment: None,
47            environment_url: None,
48            auto_inactive: None,
49        }
50    }
51}
52/// The state of the status. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum State {
55    #[serde(rename = "error")]
56    Error,
57    #[serde(rename = "failure")]
58    Failure,
59    #[serde(rename = "inactive")]
60    Inactive,
61    #[serde(rename = "in_progress")]
62    InProgress,
63    #[serde(rename = "queued")]
64    Queued,
65    #[serde(rename = "pending")]
66    Pending,
67    #[serde(rename = "success")]
68    Success,
69}
70
71impl Default for State {
72    fn default() -> State {
73        Self::Error
74    }
75}
76