Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
exit_code_mapping.rs

1/// Maps a container exit code to a structured error, for extractors that cannot emit a
2/// structured /dev/termination-log document. Applied as a fallback error tier at ingest time.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct ExitCodeMapping {
18    #[serde(rename = "exitCode")]
19    exit_code: i32,
20    #[builder(into)]
21    #[serde(rename = "code")]
22    code: String,
23    #[builder(into)]
24    #[serde(rename = "message")]
25    message: String,
26    #[serde(rename = "retryable")]
27    retryable: bool,
28}
29impl ExitCodeMapping {
30    /// The container process exit code this mapping applies to.
31    #[inline]
32    pub fn exit_code(&self) -> i32 {
33        self.exit_code
34    }
35    /// Machine-readable error code. Extractor-defined codes must fall outside the reserved platform namespace.
36    #[inline]
37    pub fn code(&self) -> &str {
38        &*self.code
39    }
40    /// Human-readable error message.
41    #[inline]
42    pub fn message(&self) -> &str {
43        &*self.message
44    }
45    /// Whether the platform may retry the ingest for this failure.
46    #[inline]
47    pub fn retryable(&self) -> bool {
48        self.retryable
49    }
50}