use crate::{
config::{ComponentDeploymentLabel, ComponentDeploymentLimits, ComponentDeploymentPurpose},
dto::fleet_registry::FleetRegistryVersion,
ids::{
ComponentDeploymentConfigurationDigest, ComponentGroupDeploymentId,
ComponentGroupMemberPath, ComponentGroupPlacementId, ComponentGroupSpecId, ComponentSpecId,
FleetBinding, FleetSubnetRootBinding, FleetSubnetRootReleaseSet,
},
};
use candid::{CandidType, Principal};
use serde::{Deserialize, Serialize};
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct FleetComponentProvisioningPlan {
pub fleet: FleetBinding,
pub fleet_registry: FleetRegistryVersion,
pub configuration_digest: ComponentDeploymentConfigurationDigest,
pub operation: FleetComponentProvisioningOperation,
pub directory_confirmation_roots: Vec<Principal>,
pub batches: Vec<FleetSubnetRootProvisioningBatch>,
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub enum FleetComponentProvisioningOperation {
FreshInstall,
ScaleOut {
deployment: ComponentGroupDeploymentId,
previous_placements: u32,
requested_placements: u32,
},
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct FleetSubnetRootProvisioningBatch {
pub root: FleetSubnetRootBinding,
pub active_release_set: FleetSubnetRootReleaseSet,
pub placements: Vec<ComponentGroupPlacementPlan>,
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ComponentGroupPlacementPlan {
pub group_placement: ComponentGroupPlacementId,
pub component_group: ComponentGroupSpecId,
pub entries: Vec<ComponentGroupPlanEntry>,
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ComponentGroupPlanEntry {
pub member_path: ComponentGroupMemberPath,
pub component_spec: ComponentSpecId,
pub spec_hash: [u8; 32],
pub purpose: ComponentDeploymentPurpose,
pub labels: Vec<ComponentDeploymentLabel>,
pub limits: ComponentDeploymentLimits,
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RootComponentProvisioningAcceptanceRequest {
pub fleet_registry: FleetRegistryVersion,
pub configuration_digest: ComponentDeploymentConfigurationDigest,
pub operation_id: [u8; 32],
pub plan_hash: [u8; 32],
pub batch: FleetSubnetRootProvisioningBatch,
}
#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RootComponentProvisioningStatusRequest {
pub operation_id: [u8; 32],
pub plan_hash: [u8; 32],
}
#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum RootComponentProvisioningPhase {
Accepted,
Provisioned,
Published,
RuntimesActive,
}
#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RootComponentProvisioningStatusResponse {
pub operation_id: [u8; 32],
pub plan_hash: [u8; 32],
pub fleet_registry: FleetRegistryVersion,
pub configuration_digest: ComponentDeploymentConfigurationDigest,
pub fleet_subnet_root: Principal,
pub phase: RootComponentProvisioningPhase,
pub placement_count: u32,
pub component_count: u32,
pub accepted_at_ns: u64,
pub receipt_content_hash: [u8; 32],
}