greentic_types/context.rs
1//! Shared deployment context primitives for Greentic runtimes.
2
3use alloc::string::String;
4#[cfg(feature = "serde")]
5use serde::{Deserialize, Serialize};
6
7pub use crate::TenantCtx;
8
9/// Cloud provider locations supported by Greentic deployments.
10#[derive(Debug, Clone, PartialEq, Eq)]
11#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
12pub enum Cloud {
13 /// Amazon Web Services.
14 Aws,
15 /// Google Cloud Platform.
16 Gcp,
17 /// Microsoft Azure.
18 Azure,
19 /// Hetzner Cloud.
20 Hetzner,
21 /// Local/self-hosted environments.
22 Local,
23 /// Any other cloud provider not covered above.
24 Other,
25}
26
27/// Platform-level schedulers supported by Greentic deployments.
28#[derive(Debug, Clone, PartialEq, Eq)]
29#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
30pub enum Platform {
31 /// Kubernetes workloads.
32 K8s,
33 /// Nomad workloads.
34 Nomad,
35 /// Systemd services.
36 Systemd,
37 /// Cloudflare Workers.
38 CfWorkers,
39 /// AWS Lambda functions.
40 Lambda,
41 /// Bare-metal deployments.
42 Baremetal,
43 /// Any other platform not captured above.
44 Other,
45}
46
47/// Deployment metadata propagated to Greentic surfaces.
48#[derive(Debug, Clone, PartialEq, Eq)]
49#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
50pub struct DeploymentCtx {
51 /// Cloud provider.
52 pub cloud: Cloud,
53 /// Optional region identifier (for example `us-east-1`).
54 #[cfg_attr(feature = "serde", serde(default))]
55 pub region: Option<String>,
56 /// Platform or scheduler running the deployment.
57 pub platform: Platform,
58 /// Optional runtime engine backing the deployment (for example `wasmtime`).
59 #[cfg_attr(feature = "serde", serde(default))]
60 pub runtime: Option<String>,
61}