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 tunnel: Option<crate::platform_setup::TunnelAnswers>,
44    pub setup_answers: serde_json::Map<String, serde_json::Value>,
45    /// Filter by provider domain (messaging, events, secrets, oauth).
46    pub domain_filter: Option<String>,
47    /// Number of parallel setup operations.
48    pub parallel: usize,
49    /// Backup existing config before setup.
50    pub backup: bool,
51    /// Skip secrets initialization.
52    pub skip_secrets_init: bool,
53    /// Continue on error (best effort).
54    pub best_effort: bool,
55}
56
57/// Configuration for the setup engine.
58pub struct SetupConfig {
59    pub tenant: String,
60    pub team: Option<String>,
61    pub env: String,
62    pub offline: bool,
63    pub verbose: bool,
64}