openapi_github/models/
repository_advisory_create.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 RepositoryAdvisoryCreate {
16    /// A short summary of the advisory.
17    #[serde(rename = "summary")]
18    pub summary: String,
19    /// A detailed description of what the advisory impacts.
20    #[serde(rename = "description")]
21    pub description: String,
22    /// The Common Vulnerabilities and Exposures (CVE) ID.
23    #[serde(rename = "cve_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub cve_id: Option<Option<String>>,
25    /// A product affected by the vulnerability detailed in a repository security advisory.
26    #[serde(rename = "vulnerabilities")]
27    pub vulnerabilities: Vec<models::RepositoryAdvisoryCreateVulnerabilitiesInner>,
28    /// A list of Common Weakness Enumeration (CWE) IDs.
29    #[serde(rename = "cwe_ids", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub cwe_ids: Option<Option<Vec<String>>>,
31    /// A list of users receiving credit for their participation in the security advisory.
32    #[serde(rename = "credits", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub credits: Option<Option<Vec<models::RepositoryAdvisoryCreateCreditsInner>>>,
34    /// The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.
35    #[serde(rename = "severity", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub severity: Option<Option<Severity>>,
37    /// The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.
38    #[serde(rename = "cvss_vector_string", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub cvss_vector_string: Option<Option<String>>,
40    /// Whether to create a temporary private fork of the repository to collaborate on a fix.
41    #[serde(rename = "start_private_fork", skip_serializing_if = "Option::is_none")]
42    pub start_private_fork: Option<bool>,
43}
44
45impl RepositoryAdvisoryCreate {
46    pub fn new(summary: String, description: String, vulnerabilities: Vec<models::RepositoryAdvisoryCreateVulnerabilitiesInner>) -> RepositoryAdvisoryCreate {
47        RepositoryAdvisoryCreate {
48            summary,
49            description,
50            cve_id: None,
51            vulnerabilities,
52            cwe_ids: None,
53            credits: None,
54            severity: None,
55            cvss_vector_string: None,
56            start_private_fork: None,
57        }
58    }
59}
60/// The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum Severity {
63    #[serde(rename = "critical")]
64    Critical,
65    #[serde(rename = "high")]
66    High,
67    #[serde(rename = "medium")]
68    Medium,
69    #[serde(rename = "low")]
70    Low,
71}
72
73impl Default for Severity {
74    fn default() -> Severity {
75        Self::Critical
76    }
77}
78