Skip to main content

ephemeris_forge_github/api/operations/
security.rs

1use ephemeris_forge::RepoRef;
2
3use crate::api::error::ForgeError;
4use crate::api::model::CodeScanning;
5use crate::api::request::{AnalysisPatch, CodeScanningPatch};
6
7/// The security operations of the GitHub API.
8pub trait SecurityApi {
9    /// Read whether Dependabot security updates are on. `None` means GitHub
10    /// does not answer.
11    fn automated_security_fixes(
12        &self,
13        repository: &RepoRef,
14    ) -> impl Future<Output = Result<Option<bool>, ForgeError>> + Send;
15
16    /// Read the code scanning default setup. `None` means GitHub does not
17    /// answer.
18    fn code_scanning_default_setup(
19        &self,
20        repository: &RepoRef,
21    ) -> impl Future<Output = Result<Option<CodeScanning>, ForgeError>> + Send;
22
23    /// Write only the changed code scanning default setup properties.
24    fn patch_code_scanning_default_setup(
25        &self,
26        repository: &RepoRef,
27        patch: &CodeScanningPatch,
28    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
29
30    /// Write only the changed `security_and_analysis` properties.
31    fn patch_security_analysis(
32        &self,
33        repository: &RepoRef,
34        patch: &AnalysisPatch,
35    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
36
37    /// Read whether private vulnerability reporting is on. `None` means
38    /// GitHub does not answer.
39    fn private_vulnerability_reporting(
40        &self,
41        repository: &RepoRef,
42    ) -> impl Future<Output = Result<Option<bool>, ForgeError>> + Send;
43
44    /// Turn Dependabot security updates on or off.
45    fn set_automated_security_fixes(
46        &self,
47        repository: &RepoRef,
48        enabled: bool,
49    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
50
51    /// Turn private vulnerability reporting on or off.
52    fn set_private_vulnerability_reporting(
53        &self,
54        repository: &RepoRef,
55        enabled: bool,
56    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
57
58    /// Turn Dependabot alerts on or off.
59    fn set_vulnerability_alerts(
60        &self,
61        repository: &RepoRef,
62        enabled: bool,
63    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
64
65    /// Read whether Dependabot alerts are on. `None` means GitHub does not
66    /// answer.
67    fn vulnerability_alerts(
68        &self,
69        repository: &RepoRef,
70    ) -> impl Future<Output = Result<Option<bool>, ForgeError>> + Send;
71}