Skip to main content

bucketwarden_server/console_api/
mod.rs

1use super::*;
2
3mod admin;
4mod audit_evidence;
5mod auth;
6mod dispatch;
7mod governance;
8mod paging;
9mod preferences;
10mod reports;
11mod state;
12
13pub use dispatch::*;
14pub(crate) use paging::*;
15
16#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
17pub struct ConsoleApiLoginRequest {
18    pub principal_id: String,
19    pub shared_secret: String,
20}
21
22pub type ConsoleApiSession = BrowserUiSession;
23
24#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
25pub struct ConsoleApiIdentityProvider {
26    pub provider_id: String,
27    pub label: String,
28    pub method: String,
29    pub enabled: bool,
30    pub description: String,
31}
32
33#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
34pub struct ConsoleApiIdentityProviderList {
35    pub default_provider_id: String,
36    pub providers: Vec<ConsoleApiIdentityProvider>,
37}
38
39#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
40pub struct ConsoleApiListQuery {
41    pub limit: Option<usize>,
42    pub offset: Option<usize>,
43    pub prefix: Option<String>,
44    pub q: Option<String>,
45    pub sort: Option<String>,
46}
47
48#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
49pub struct ConsoleApiPage {
50    pub limit: usize,
51    pub offset: usize,
52    pub total: usize,
53    pub returned: usize,
54    pub sort: String,
55}
56
57#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
58pub struct ConsoleApiErrorEnvelope {
59    pub code: String,
60    pub message: String,
61    pub retryable: bool,
62    pub status: u16,
63    pub request_id: String,
64}
65
66#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
67pub struct ConsoleApiOverviewReport {
68    pub generated_at_epoch_seconds: u64,
69    pub session: ConsoleApiSession,
70    pub health: OpsHealthReport,
71    pub metrics: ConsoleMetricSummary,
72    pub retention_bucket_count: usize,
73    pub retained_version_count: usize,
74    pub lifecycle_bucket_count: usize,
75    pub lifecycle_rule_count: usize,
76    pub security_governance_findings: Vec<String>,
77    pub failure_modes: Vec<String>,
78}
79
80#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
81pub struct ConsoleApiReportSummary {
82    pub id: String,
83    pub title: String,
84    pub category: String,
85    pub status: String,
86    pub endpoint: String,
87    pub export_endpoint: Option<String>,
88    pub generated_at_epoch_seconds: u64,
89}
90
91#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
92pub struct ConsoleApiReportsDashboard {
93    pub generated_at_epoch_seconds: u64,
94    pub reports: Vec<ConsoleApiReportSummary>,
95}
96
97#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
98pub struct ConsoleApiBucketList {
99    pub page: ConsoleApiPage,
100    pub buckets: Vec<ConsoleBucketRow>,
101}
102
103#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
104pub struct ConsoleApiBucketDetail {
105    pub bucket: ConsoleBucketRow,
106    pub policies: Vec<ConsolePolicyRow>,
107    pub findings: Vec<String>,
108}
109
110#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
111pub struct ConsoleApiObjectList {
112    pub page: ConsoleApiPage,
113    pub objects: Vec<ConsoleObjectRow>,
114}
115
116#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
117pub struct ConsoleApiObjectVersionRow {
118    pub bucket: String,
119    pub key: String,
120    pub version_id: String,
121    pub version_ordinal: u64,
122    pub version_label: String,
123    pub is_latest: bool,
124    pub delete_marker: bool,
125    pub content_length: usize,
126    pub etag: String,
127    pub last_modified_epoch_seconds: u64,
128    pub owner: String,
129    pub legal_hold: bool,
130    pub retention_mode: Option<String>,
131    pub retain_until_epoch_seconds: Option<u64>,
132    pub replication_status: Option<String>,
133}
134
135#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
136pub struct ConsoleApiObjectVersionHistory {
137    pub page: ConsoleApiPage,
138    pub versions: Vec<ConsoleApiObjectVersionRow>,
139}
140
141#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
142pub struct ConsoleApiObjectGovernanceSummary {
143    pub bucket: String,
144    pub key: String,
145    pub version_id: String,
146    pub legal_hold: bool,
147    pub retention_mode: Option<String>,
148    pub retain_until_epoch_seconds: Option<u64>,
149    pub retention_active: bool,
150    pub delete_allowed_without_bypass: bool,
151    pub effective_constraints: Vec<String>,
152    pub delete_marker: bool,
153}
154
155#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
156pub struct ConsoleApiAuditQuery {
157    pub limit: Option<usize>,
158    pub offset: Option<usize>,
159    pub q: Option<String>,
160    pub sort: Option<String>,
161    pub subject: Option<String>,
162    pub action: Option<String>,
163    pub resource: Option<String>,
164    pub outcome: Option<String>,
165    pub min_sequence: Option<u64>,
166    pub max_sequence: Option<u64>,
167}
168
169#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
170pub struct ConsoleApiAuditEvents {
171    pub page: ConsoleApiPage,
172    pub events: Vec<AuditEvent>,
173}
174
175#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
176pub struct ConsoleApiEvidenceItem {
177    pub name: String,
178    pub content_type: String,
179    pub bytes: usize,
180    pub record_count: usize,
181}
182
183#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
184pub struct ConsoleApiEvidenceList {
185    pub page: ConsoleApiPage,
186    pub evidence: Vec<ConsoleApiEvidenceItem>,
187}
188
189#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
190pub struct ConsoleApiEvidenceExport {
191    pub filename: String,
192    pub content_type: String,
193    pub report: OpsEvidenceExportReport,
194}
195
196#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
197pub struct ConsoleApiTenantScope {
198    pub selected_tenant_id: String,
199    pub tenant_ids: Vec<String>,
200    pub scoped_request_header: String,
201}
202
203#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
204pub struct ConsoleApiRoleAssignmentRow {
205    pub principal_id: String,
206    pub role: String,
207    pub scope: String,
208}
209
210#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
211pub struct ConsoleApiRoleRow {
212    pub role: String,
213    pub assignment_count: usize,
214    pub actions: Vec<String>,
215}
216
217#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
218pub struct ConsoleApiUserDetail {
219    pub principal_id: String,
220    pub tenant_id: String,
221    pub kind: String,
222    pub enabled: bool,
223    pub assignments: Vec<ConsoleApiRoleAssignmentRow>,
224    pub effective_permissions: Vec<String>,
225}
226
227#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
228pub struct ConsoleApiAdminSummary {
229    pub tenant_scope: ConsoleApiTenantScope,
230    pub users: Vec<ConsoleUserRow>,
231    pub roles: Vec<ConsoleApiRoleRow>,
232    pub assignments: Vec<ConsoleApiRoleAssignmentRow>,
233    pub effective_permissions: Vec<String>,
234}
235
236#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
237pub struct ConsoleApiPreferences {
238    pub values: BTreeMap<String, String>,
239}