openapi_github/models/
dependabot_alert_security_advisory.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/// DependabotAlertSecurityAdvisory : Details for the GitHub Security Advisory.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DependabotAlertSecurityAdvisory {
17    /// The unique GitHub Security Advisory ID assigned to the advisory.
18    #[serde(rename = "ghsa_id")]
19    pub ghsa_id: String,
20    /// The unique CVE ID assigned to the advisory.
21    #[serde(rename = "cve_id", deserialize_with = "Option::deserialize")]
22    pub cve_id: Option<String>,
23    /// A short, plain text summary of the advisory.
24    #[serde(rename = "summary")]
25    pub summary: String,
26    /// A long-form Markdown-supported description of the advisory.
27    #[serde(rename = "description")]
28    pub description: String,
29    /// Vulnerable version range information for the advisory.
30    #[serde(rename = "vulnerabilities")]
31    pub vulnerabilities: Vec<models::DependabotAlertSecurityVulnerability>,
32    /// The severity of the advisory.
33    #[serde(rename = "severity")]
34    pub severity: Severity,
35    #[serde(rename = "cvss")]
36    pub cvss: Box<models::DependabotAlertSecurityAdvisoryCvss>,
37    /// Details for the advisory pertaining to Common Weakness Enumeration.
38    #[serde(rename = "cwes")]
39    pub cwes: Vec<models::DependabotAlertSecurityAdvisoryCwesInner>,
40    /// Values that identify this advisory among security information sources.
41    #[serde(rename = "identifiers")]
42    pub identifiers: Vec<models::DependabotAlertSecurityAdvisoryIdentifiersInner>,
43    /// Links to additional advisory information.
44    #[serde(rename = "references")]
45    pub references: Vec<models::DependabotAlertSecurityAdvisoryReferencesInner>,
46    /// The time that the advisory was published in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
47    #[serde(rename = "published_at")]
48    pub published_at: String,
49    /// The time that the advisory was last modified in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
50    #[serde(rename = "updated_at")]
51    pub updated_at: String,
52    /// The time that the advisory was withdrawn in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
53    #[serde(rename = "withdrawn_at", deserialize_with = "Option::deserialize")]
54    pub withdrawn_at: Option<String>,
55}
56
57impl DependabotAlertSecurityAdvisory {
58    /// Details for the GitHub Security Advisory.
59    pub fn new(ghsa_id: String, cve_id: Option<String>, summary: String, description: String, vulnerabilities: Vec<models::DependabotAlertSecurityVulnerability>, severity: Severity, cvss: models::DependabotAlertSecurityAdvisoryCvss, cwes: Vec<models::DependabotAlertSecurityAdvisoryCwesInner>, identifiers: Vec<models::DependabotAlertSecurityAdvisoryIdentifiersInner>, references: Vec<models::DependabotAlertSecurityAdvisoryReferencesInner>, published_at: String, updated_at: String, withdrawn_at: Option<String>) -> DependabotAlertSecurityAdvisory {
60        DependabotAlertSecurityAdvisory {
61            ghsa_id,
62            cve_id,
63            summary,
64            description,
65            vulnerabilities,
66            severity,
67            cvss: Box::new(cvss),
68            cwes,
69            identifiers,
70            references,
71            published_at,
72            updated_at,
73            withdrawn_at,
74        }
75    }
76}
77/// The severity of the advisory.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum Severity {
80    #[serde(rename = "low")]
81    Low,
82    #[serde(rename = "medium")]
83    Medium,
84    #[serde(rename = "high")]
85    High,
86    #[serde(rename = "critical")]
87    Critical,
88}
89
90impl Default for Severity {
91    fn default() -> Severity {
92        Self::Low
93    }
94}
95