openapi_github/models/
alert_instance.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 AlertInstance {
16    /// Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name.
17    #[serde(rename = "analysis_key")]
18    pub analysis_key: String,
19    /// Identifies the configuration under which the analysis was executed.
20    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
21    pub category: Option<String>,
22    #[serde(rename = "classifications", skip_serializing_if = "Option::is_none")]
23    pub classifications: Option<Vec<String>>,
24    #[serde(rename = "commit_sha", skip_serializing_if = "Option::is_none")]
25    pub commit_sha: Option<String>,
26    /// Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed.
27    #[serde(rename = "environment")]
28    pub environment: String,
29    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
30    pub location: Option<Box<models::AlertInstanceLocation>>,
31    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
32    pub message: Option<Box<models::CodeScanningAlertInstanceMessage>>,
33    /// The full Git reference, formatted as `refs/heads/<branch name>`.
34    #[serde(rename = "ref")]
35    pub r#ref: String,
36    /// State of a code scanning alert.
37    #[serde(rename = "state")]
38    pub state: State,
39}
40
41impl AlertInstance {
42    pub fn new(analysis_key: String, environment: String, r#ref: String, state: State) -> AlertInstance {
43        AlertInstance {
44            analysis_key,
45            category: None,
46            classifications: None,
47            commit_sha: None,
48            environment,
49            location: None,
50            message: None,
51            r#ref,
52            state,
53        }
54    }
55}
56/// State of a code scanning alert.
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum State {
59    #[serde(rename = "open")]
60    Open,
61    #[serde(rename = "dismissed")]
62    Dismissed,
63    #[serde(rename = "fixed")]
64    Fixed,
65}
66
67impl Default for State {
68    fn default() -> State {
69        Self::Open
70    }
71}
72