1use alloc::collections::BTreeMap;
8use alloc::string::String;
9use alloc::vec::Vec;
10
11#[cfg(feature = "schemars")]
12use schemars::JsonSchema;
13#[cfg(feature = "serde")]
14use serde::{Deserialize, Serialize};
15use serde_json::Value;
16
17#[derive(Clone, Debug, PartialEq, Eq)]
19#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
20#[cfg_attr(feature = "schemars", derive(JsonSchema))]
21pub struct RepoSkin {
22 pub tenant_id: String,
24 #[cfg_attr(
26 feature = "serde",
27 serde(default, skip_serializing_if = "Option::is_none")
28 )]
29 pub tenant_name: Option<String>,
30 #[cfg_attr(
32 feature = "serde",
33 serde(default, skip_serializing_if = "Option::is_none")
34 )]
35 pub product_name: Option<String>,
36 pub theme: RepoSkinTheme,
38 #[cfg_attr(
40 feature = "serde",
41 serde(default, skip_serializing_if = "Option::is_none")
42 )]
43 pub layout: Option<RepoSkinLayout>,
44 #[cfg_attr(
46 feature = "serde",
47 serde(default, skip_serializing_if = "Option::is_none")
48 )]
49 pub worker_panel: Option<RepoWorkerPanel>,
50 #[cfg_attr(
52 feature = "serde",
53 serde(default, skip_serializing_if = "Option::is_none")
54 )]
55 pub links: Option<RepoSkinLinks>,
56}
57
58#[derive(Clone, Debug, PartialEq, Eq)]
60#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
61#[cfg_attr(feature = "schemars", derive(JsonSchema))]
62pub struct RepoSkinTheme {
63 pub logo_url: String,
65 #[cfg_attr(
67 feature = "serde",
68 serde(default, skip_serializing_if = "Option::is_none")
69 )]
70 pub favicon_url: Option<String>,
71 #[cfg_attr(
73 feature = "serde",
74 serde(default, skip_serializing_if = "Option::is_none")
75 )]
76 pub hero_image_url: Option<String>,
77 pub primary_color: String,
79 pub accent_color: String,
81 #[cfg_attr(
83 feature = "serde",
84 serde(default, skip_serializing_if = "Option::is_none")
85 )]
86 pub background_color: Option<String>,
87 #[cfg_attr(
89 feature = "serde",
90 serde(default, skip_serializing_if = "Option::is_none")
91 )]
92 pub background_gradient: Option<String>,
93 #[cfg_attr(
95 feature = "serde",
96 serde(default, skip_serializing_if = "Option::is_none")
97 )]
98 pub font_family: Option<String>,
99 #[cfg_attr(
101 feature = "serde",
102 serde(default, skip_serializing_if = "Option::is_none")
103 )]
104 pub success_color: Option<String>,
105 #[cfg_attr(
107 feature = "serde",
108 serde(default, skip_serializing_if = "Option::is_none")
109 )]
110 pub warning_color: Option<String>,
111 #[cfg_attr(
113 feature = "serde",
114 serde(default, skip_serializing_if = "Option::is_none")
115 )]
116 pub danger_color: Option<String>,
117}
118
119#[derive(Clone, Debug, PartialEq, Eq, Default)]
121#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
122#[cfg_attr(feature = "serde", serde(default))]
123#[cfg_attr(feature = "schemars", derive(JsonSchema))]
124pub struct RepoSkinLayout {
125 pub show_dashboard: bool,
127 pub show_repositories: bool,
129 pub show_pipeline: bool,
131 pub show_packs: bool,
133 pub show_trust_access: bool,
135 pub show_audit_compliance: bool,
137 pub show_admin_config: Option<bool>,
139 pub show_hero_band: Option<bool>,
141 #[cfg_attr(
143 feature = "serde",
144 serde(default, skip_serializing_if = "Option::is_none")
145 )]
146 pub hero_title: Option<String>,
147 #[cfg_attr(
149 feature = "serde",
150 serde(default, skip_serializing_if = "Option::is_none")
151 )]
152 pub hero_subtitle: Option<String>,
153}
154
155#[derive(Clone, Debug, PartialEq, Eq)]
157#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
158#[cfg_attr(feature = "schemars", derive(JsonSchema))]
159pub struct RepoWorkerPanel {
160 pub enabled: bool,
162 #[cfg_attr(
164 feature = "serde",
165 serde(default, skip_serializing_if = "Option::is_none")
166 )]
167 pub title: Option<String>,
168 #[cfg_attr(
170 feature = "serde",
171 serde(default, skip_serializing_if = "Option::is_none")
172 )]
173 pub default_open: Option<bool>,
174 #[cfg_attr(
176 feature = "serde",
177 serde(default, skip_serializing_if = "Option::is_none")
178 )]
179 pub position: Option<String>,
180}
181
182#[derive(Clone, Debug, PartialEq, Eq, Default)]
184#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
185#[cfg_attr(feature = "serde", serde(default))]
186#[cfg_attr(feature = "schemars", derive(JsonSchema))]
187pub struct RepoSkinLinks {
188 pub docs_url: Option<String>,
190 pub support_url: Option<String>,
192 pub status_url: Option<String>,
194}
195
196#[derive(Clone, Debug, PartialEq, Eq)]
198#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
199#[cfg_attr(feature = "schemars", derive(JsonSchema))]
200pub struct RepoAuth {
201 pub tenant_id: String,
203 #[cfg_attr(
205 feature = "serde",
206 serde(default, skip_serializing_if = "Vec::is_empty")
207 )]
208 pub identity_providers: Vec<IdentityProviderOption>,
209}
210
211#[derive(Clone, Debug, PartialEq, Eq)]
213#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
214#[cfg_attr(feature = "schemars", derive(JsonSchema))]
215pub struct IdentityProviderOption {
216 pub id: String,
218 #[cfg_attr(
220 feature = "serde",
221 serde(default, skip_serializing_if = "Option::is_none")
222 )]
223 pub kind: Option<String>,
224 pub label: String,
226 #[cfg_attr(
228 feature = "serde",
229 serde(default, skip_serializing_if = "Option::is_none")
230 )]
231 pub icon: Option<String>,
232 #[cfg_attr(
234 feature = "serde",
235 serde(default, skip_serializing_if = "Option::is_none")
236 )]
237 pub button_style: Option<String>,
238 #[cfg_attr(
240 feature = "serde",
241 serde(default, skip_serializing_if = "Option::is_none")
242 )]
243 pub order: Option<i32>,
244 pub login_url: String,
246 #[cfg_attr(
248 feature = "serde",
249 serde(default, skip_serializing_if = "Option::is_none")
250 )]
251 pub description: Option<String>,
252 #[cfg_attr(
254 feature = "serde",
255 serde(default, skip_serializing_if = "Option::is_none")
256 )]
257 pub recommended: Option<bool>,
258}
259
260#[derive(Clone, Debug, PartialEq, Eq)]
262#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
263#[cfg_attr(feature = "schemars", derive(JsonSchema))]
264pub struct RepoTenantConfig {
265 pub tenant_id: String,
267 #[cfg_attr(
269 feature = "serde",
270 serde(default, skip_serializing_if = "Vec::is_empty")
271 )]
272 pub enabled_tabs: Vec<String>,
273 pub enabled_packs: EnabledPacks,
275 #[cfg_attr(
277 feature = "serde",
278 serde(default, skip_serializing_if = "Option::is_none")
279 )]
280 pub default_pipeline: Option<DefaultPipeline>,
281 #[cfg_attr(
283 feature = "serde",
284 serde(default, skip_serializing_if = "Option::is_none")
285 )]
286 pub stores: Option<Vec<StoreTarget>>,
287 #[cfg_attr(
289 feature = "serde",
290 serde(default, skip_serializing_if = "Option::is_none")
291 )]
292 pub distributors: Option<Vec<DistributorTarget>>,
293 #[cfg_attr(
295 feature = "serde",
296 serde(default, skip_serializing_if = "Option::is_none")
297 )]
298 pub features: Option<RepoConfigFeatures>,
299 #[cfg_attr(
301 feature = "serde",
302 serde(default, skip_serializing_if = "Option::is_none")
303 )]
304 pub page_handlers: Option<BTreeMap<String, String>>,
305}
306
307#[derive(Clone, Debug, PartialEq, Eq, Default)]
309#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
310#[cfg_attr(feature = "serde", serde(default))]
311#[cfg_attr(feature = "schemars", derive(JsonSchema))]
312pub struct EnabledPacks {
313 pub identity_providers: Option<Vec<String>>,
315 pub source_providers: Option<Vec<String>>,
317 pub scanners: Option<Vec<String>>,
319 pub signing: Option<Vec<String>>,
321 pub attestation: Option<Vec<String>>,
323 pub policy_engines: Option<Vec<String>>,
325 pub oci_providers: Option<Vec<String>>,
327}
328
329#[derive(Clone, Debug, PartialEq, Eq, Default)]
331#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
332#[cfg_attr(feature = "serde", serde(default))]
333#[cfg_attr(feature = "schemars", derive(JsonSchema))]
334pub struct DefaultPipeline {
335 pub scanners: Option<Vec<String>>,
337 pub signing: Option<String>,
339 pub attestation: Option<String>,
341 pub policy_engine: Option<String>,
343 pub oci_provider: Option<String>,
345}
346
347#[derive(Clone, Debug, PartialEq, Eq)]
349#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
350#[cfg_attr(feature = "schemars", derive(JsonSchema))]
351pub struct StoreTarget {
352 pub id: String,
354 pub label: String,
356 pub url: String,
358 #[cfg_attr(
360 feature = "serde",
361 serde(default, skip_serializing_if = "Option::is_none")
362 )]
363 pub description: Option<String>,
364}
365
366#[derive(Clone, Debug, PartialEq, Eq)]
368#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
369#[cfg_attr(feature = "schemars", derive(JsonSchema))]
370pub struct DistributorTarget {
371 pub id: String,
373 pub label: String,
375 pub url: String,
377 #[cfg_attr(
379 feature = "serde",
380 serde(default, skip_serializing_if = "Option::is_none")
381 )]
382 pub description: Option<String>,
383}
384
385#[derive(Clone, Debug, PartialEq, Eq, Default)]
387#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
388#[cfg_attr(feature = "serde", serde(default))]
389#[cfg_attr(feature = "schemars", derive(JsonSchema))]
390pub struct RepoConfigFeatures {
391 pub allow_manual_approve: Option<bool>,
393 pub show_advanced_scan_views: Option<bool>,
395 pub show_experimental_modules: Option<bool>,
397}
398
399#[derive(Clone, Debug, PartialEq)]
401#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
402#[cfg_attr(feature = "schemars", derive(JsonSchema))]
403pub struct TenantDidDocument {
404 #[cfg_attr(feature = "serde", serde(rename = "@context", default))]
406 pub raw_context: Option<DidContext>,
407 pub id: String,
409 #[cfg_attr(
411 feature = "serde",
412 serde(
413 rename = "verificationMethod",
414 default,
415 skip_serializing_if = "Option::is_none"
416 )
417 )]
418 pub verification_method: Option<Vec<VerificationMethod>>,
419 #[cfg_attr(
421 feature = "serde",
422 serde(default, skip_serializing_if = "Option::is_none")
423 )]
424 pub authentication: Option<Vec<String>>,
425 #[cfg_attr(
427 feature = "serde",
428 serde(default, skip_serializing_if = "Vec::is_empty")
429 )]
430 pub service: Vec<DidService>,
431}
432
433impl TenantDidDocument {
434 pub fn context(&self) -> Vec<String> {
436 match &self.raw_context {
437 Some(DidContext::Single(value)) => alloc::vec![value.clone()],
438 Some(DidContext::Multiple(values)) => values.clone(),
439 None => Vec::new(),
440 }
441 }
442}
443
444#[derive(Clone, Debug, PartialEq)]
446#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
447#[cfg_attr(feature = "serde", serde(untagged))]
448#[cfg_attr(feature = "schemars", derive(JsonSchema))]
449pub enum DidContext {
450 Single(String),
452 Multiple(Vec<String>),
454}
455
456#[derive(Clone, Debug, PartialEq)]
458#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
459#[cfg_attr(feature = "schemars", derive(JsonSchema))]
460pub struct VerificationMethod {
461 pub id: String,
463 #[cfg_attr(feature = "serde", serde(rename = "type"))]
465 pub r#type: String,
466 pub controller: String,
468 #[cfg_attr(
470 feature = "serde",
471 serde(
472 rename = "publicKeyJwk",
473 default,
474 skip_serializing_if = "Option::is_none"
475 )
476 )]
477 pub public_key_jwk: Option<Value>,
478 #[cfg_attr(
480 feature = "serde",
481 serde(
482 rename = "publicKeyMultibase",
483 default,
484 skip_serializing_if = "Option::is_none"
485 )
486 )]
487 pub public_key_multibase: Option<String>,
488}
489
490#[derive(Clone, Debug, PartialEq, Eq)]
492#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
493#[cfg_attr(feature = "schemars", derive(JsonSchema))]
494pub struct DidService {
495 pub id: String,
497 #[cfg_attr(feature = "serde", serde(rename = "type"))]
499 pub r#type: String,
500 #[cfg_attr(feature = "serde", serde(rename = "serviceEndpoint"))]
502 pub service_endpoint: String,
503}