Skip to main content

canic_core/api/
component_deployment.rs

1//! Module: api::component_deployment
2//!
3//! Responsibility: expose the current runtime's protected Component deployment context.
4//! Does not own: context validation, persistence, authorization, or deployment planning.
5//! Boundary: application policy reads the exact value retained during managed initialization.
6
7use crate::{
8    InternalError,
9    dto::{component_deployment::ProtectedComponentDeployment, error::Error},
10    ops::storage::{StorageOpsError, fleet_activation::FleetActivationOps},
11};
12
13///
14/// ComponentDeploymentApi
15///
16/// Local read-only access to immutable Component deployment policy.
17///
18
19pub struct ComponentDeploymentApi;
20
21impl ComponentDeploymentApi {
22    /// Return this Component tree's protected deployment context.
23    pub fn current() -> Result<ProtectedComponentDeployment, Error> {
24        FleetActivationOps::component_deployment()
25            .map_err(StorageOpsError::from)
26            .map_err(InternalError::from)
27            .map_err(Into::into)
28    }
29}