Skip to main content

greentic_setup/engine/
types.rs

1//! Core types for the setup engine.
2//!
3//! Contains request/config types used across the engine.
4
5use std::collections::BTreeSet;
6use std::path::PathBuf;
7
8use serde_json::{Map as JsonMap, Value};
9
10use crate::plan::{
11    AccessChangeSelection, PackDefaultSelection, PackRemoveSelection, RemoveTarget,
12    TenantSelection, UpdateOp,
13};
14use crate::platform_setup::{PlatformSetupAnswers, StaticRoutesPolicy};
15
16/// Loaded answers from a JSON/YAML file.
17#[derive(Clone, Debug, Default)]
18pub struct LoadedAnswers {
19    pub tenant: Option<String>,
20    pub team: Option<String>,
21    pub env: Option<String>,
22    pub platform_setup: PlatformSetupAnswers,
23    pub setup_answers: JsonMap<String, Value>,
24}
25
26/// The request object that drives plan building.
27#[derive(Clone, Debug, Default)]
28pub struct SetupRequest {
29    pub bundle: PathBuf,
30    pub bundle_name: Option<String>,
31    pub pack_refs: Vec<String>,
32    pub tenants: Vec<TenantSelection>,
33    pub default_assignments: Vec<PackDefaultSelection>,
34    pub providers: Vec<String>,
35    pub update_ops: BTreeSet<UpdateOp>,
36    pub remove_targets: BTreeSet<RemoveTarget>,
37    pub packs_remove: Vec<PackRemoveSelection>,
38    pub providers_remove: Vec<String>,
39    pub tenants_remove: Vec<TenantSelection>,
40    pub access_changes: Vec<AccessChangeSelection>,
41    pub static_routes: StaticRoutesPolicy,
42    pub deployment_targets: Vec<crate::deployment_targets::DeploymentTargetRecord>,
43    pub setup_answers: serde_json::Map<String, serde_json::Value>,
44    /// Filter by provider domain (messaging, events, secrets, oauth).
45    pub domain_filter: Option<String>,
46    /// Number of parallel setup operations.
47    pub parallel: usize,
48    /// Backup existing config before setup.
49    pub backup: bool,
50    /// Skip secrets initialization.
51    pub skip_secrets_init: bool,
52    /// Continue on error (best effort).
53    pub best_effort: bool,
54}
55
56/// Configuration for the setup engine.
57pub struct SetupConfig {
58    pub tenant: String,
59    pub team: Option<String>,
60    pub env: String,
61    pub offline: bool,
62    pub verbose: bool,
63}