openapi_github/models/
dependabot_alert_security_vulnerability.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/// DependabotAlertSecurityVulnerability : Details pertaining to one vulnerable version range for the advisory.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DependabotAlertSecurityVulnerability {
17    #[serde(rename = "package")]
18    pub package: Box<models::DependabotAlertPackage>,
19    /// The severity of the vulnerability.
20    #[serde(rename = "severity")]
21    pub severity: Severity,
22    /// Conditions that identify vulnerable versions of this vulnerability's package.
23    #[serde(rename = "vulnerable_version_range")]
24    pub vulnerable_version_range: String,
25    #[serde(rename = "first_patched_version", deserialize_with = "Option::deserialize")]
26    pub first_patched_version: Option<Box<models::DependabotAlertSecurityVulnerabilityFirstPatchedVersion>>,
27}
28
29impl DependabotAlertSecurityVulnerability {
30    /// Details pertaining to one vulnerable version range for the advisory.
31    pub fn new(package: models::DependabotAlertPackage, severity: Severity, vulnerable_version_range: String, first_patched_version: Option<models::DependabotAlertSecurityVulnerabilityFirstPatchedVersion>) -> DependabotAlertSecurityVulnerability {
32        DependabotAlertSecurityVulnerability {
33            package: Box::new(package),
34            severity,
35            vulnerable_version_range,
36            first_patched_version: first_patched_version.map(Box::new),
37        }
38    }
39}
40/// The severity of the vulnerability.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
42pub enum Severity {
43    #[serde(rename = "low")]
44    Low,
45    #[serde(rename = "medium")]
46    Medium,
47    #[serde(rename = "high")]
48    High,
49    #[serde(rename = "critical")]
50    Critical,
51}
52
53impl Default for Severity {
54    fn default() -> Severity {
55        Self::Low
56    }
57}
58