pulumi_gestalt_core/
model.rs1use serde_json::Value;
2use std::fmt;
3use uuid::Uuid;
4
5#[derive(Debug, PartialEq, Clone)]
6pub(crate) enum MaybeNodeValue {
7 NotYetCalculated,
8 Set(NodeValue),
9}
10
11impl MaybeNodeValue {
12 #[cfg(test)]
13 pub(crate) fn set_value(value: Value, secret: bool) -> Self {
14 Self::Set(NodeValue::exists(value, secret))
15 }
16}
17
18#[derive(Debug, PartialEq, Clone)]
19pub(crate) enum NodeValue {
20 Nothing, Exists { value: Value, secret: bool },
22}
23
24impl NodeValue {
25 pub(crate) fn exists(value: Value, secret: bool) -> Self {
26 Self::Exists { value, secret }
27 }
28}
29
30#[derive(Clone, Debug, PartialEq, Eq, Hash)]
31pub struct FunctionName(String);
32
33impl From<FunctionName> for String {
34 fn from(val: FunctionName) -> Self {
35 val.0
36 }
37}
38
39impl From<String> for FunctionName {
40 fn from(value: String) -> Self {
41 Self(value)
42 }
43}
44
45impl From<&str> for FunctionName {
46 fn from(value: &str) -> Self {
47 Self(value.to_string())
48 }
49}
50
51#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
52pub struct OutputId(Uuid);
53
54impl From<String> for OutputId {
55 fn from(value: String) -> Self {
56 Self(Uuid::parse_str(&value).unwrap())
57 }
58}
59
60impl fmt::Display for OutputId {
61 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
62 write!(f, "{}", self.0)
63 }
64}
65
66impl From<Uuid> for OutputId {
67 fn from(value: Uuid) -> Self {
68 Self(value)
69 }
70}
71
72#[derive(Clone, Debug, PartialEq, Eq, Hash)]
73pub struct FieldName(String);
74
75impl FieldName {
76 pub fn as_string(&self) -> &String {
77 &self.0
78 }
79}
80
81impl From<String> for FieldName {
82 fn from(value: String) -> Self {
83 Self(value)
84 }
85}
86
87impl From<&str> for FieldName {
88 fn from(value: &str) -> Self {
89 Self(value.to_string())
90 }
91}
92
93impl From<&String> for FieldName {
94 fn from(value: &String) -> Self {
95 Self(value.to_string())
96 }
97}