docktor_api/
error.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Error type for the `HealthcheckOperation` operation.
3/// Each variant represents an error that can occur for the `HealthcheckOperation` operation.
4#[derive(std::fmt::Debug)]
5pub enum HealthcheckOperationError {
6    /// Error coming from Prometheus.
7    HealtcheckError(crate::error::HealtcheckError),
8}
9impl std::fmt::Display for HealthcheckOperationError {
10    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11        match &self {
12            HealthcheckOperationError::HealtcheckError(_inner) => _inner.fmt(f),
13        }
14    }
15}
16impl HealthcheckOperationError {
17    /// Returns `true` if the error kind is `HealthcheckOperationError::HealtcheckError`.
18    pub fn is_healtcheck_error(&self) -> bool {
19        matches!(&self, HealthcheckOperationError::HealtcheckError(_))
20    }
21    /// Returns the error name string by matching the correct variant.
22    pub fn name(&self) -> &'static str {
23        match &self {
24            HealthcheckOperationError::HealtcheckError(_inner) => _inner.name(),
25        }
26    }
27}
28impl std::error::Error for HealthcheckOperationError {
29    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
30        match &self {
31            HealthcheckOperationError::HealtcheckError(_inner) => Some(_inner),
32        }
33    }
34}
35
36/// Error type for the `PrometheusTargetOperation` operation.
37/// Each variant represents an error that can occur for the `PrometheusTargetOperation` operation.
38#[derive(std::fmt::Debug)]
39pub enum PrometheusTargetOperationError {
40    /// //////////////////////////////////// Errors //////////////////////////////////// Returned when something critical happened.
41    DocktorError(crate::error::DocktorError),
42    /// Error coming from Prometheus.
43    PrometheusError(crate::error::PrometheusError),
44}
45impl std::fmt::Display for PrometheusTargetOperationError {
46    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47        match &self {
48            PrometheusTargetOperationError::DocktorError(_inner) => _inner.fmt(f),
49            PrometheusTargetOperationError::PrometheusError(_inner) => _inner.fmt(f),
50        }
51    }
52}
53impl PrometheusTargetOperationError {
54    /// Returns `true` if the error kind is `PrometheusTargetOperationError::DocktorError`.
55    pub fn is_docktor_error(&self) -> bool {
56        matches!(&self, PrometheusTargetOperationError::DocktorError(_))
57    }
58    /// Returns `true` if the error kind is `PrometheusTargetOperationError::PrometheusError`.
59    pub fn is_prometheus_error(&self) -> bool {
60        matches!(&self, PrometheusTargetOperationError::PrometheusError(_))
61    }
62    /// Returns the error name string by matching the correct variant.
63    pub fn name(&self) -> &'static str {
64        match &self {
65            PrometheusTargetOperationError::DocktorError(_inner) => _inner.name(),
66            PrometheusTargetOperationError::PrometheusError(_inner) => _inner.name(),
67        }
68    }
69}
70impl std::error::Error for PrometheusTargetOperationError {
71    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
72        match &self {
73            PrometheusTargetOperationError::DocktorError(_inner) => Some(_inner),
74            PrometheusTargetOperationError::PrometheusError(_inner) => Some(_inner),
75        }
76    }
77}
78
79/// Error type for the `RestartOperation` operation.
80/// Each variant represents an error that can occur for the `RestartOperation` operation.
81#[derive(std::fmt::Debug)]
82pub enum RestartOperationError {
83    /// //////////////////////////////////// Errors //////////////////////////////////// Returned when something critical happened.
84    DocktorError(crate::error::DocktorError),
85    /// Error coming from Systemd.
86    SystemdError(crate::error::SystemdError),
87}
88impl std::fmt::Display for RestartOperationError {
89    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
90        match &self {
91            RestartOperationError::DocktorError(_inner) => _inner.fmt(f),
92            RestartOperationError::SystemdError(_inner) => _inner.fmt(f),
93        }
94    }
95}
96impl RestartOperationError {
97    /// Returns `true` if the error kind is `RestartOperationError::DocktorError`.
98    pub fn is_docktor_error(&self) -> bool {
99        matches!(&self, RestartOperationError::DocktorError(_))
100    }
101    /// Returns `true` if the error kind is `RestartOperationError::SystemdError`.
102    pub fn is_systemd_error(&self) -> bool {
103        matches!(&self, RestartOperationError::SystemdError(_))
104    }
105    /// Returns the error name string by matching the correct variant.
106    pub fn name(&self) -> &'static str {
107        match &self {
108            RestartOperationError::DocktorError(_inner) => _inner.name(),
109            RestartOperationError::SystemdError(_inner) => _inner.name(),
110        }
111    }
112}
113impl std::error::Error for RestartOperationError {
114    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
115        match &self {
116            RestartOperationError::DocktorError(_inner) => Some(_inner),
117            RestartOperationError::SystemdError(_inner) => Some(_inner),
118        }
119    }
120}
121
122/// Error type for the `StartOperation` operation.
123/// Each variant represents an error that can occur for the `StartOperation` operation.
124#[derive(std::fmt::Debug)]
125pub enum StartOperationError {
126    /// //////////////////////////////////// Errors //////////////////////////////////// Returned when something critical happened.
127    DocktorError(crate::error::DocktorError),
128    /// Error coming from Systemd.
129    SystemdError(crate::error::SystemdError),
130}
131impl std::fmt::Display for StartOperationError {
132    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
133        match &self {
134            StartOperationError::DocktorError(_inner) => _inner.fmt(f),
135            StartOperationError::SystemdError(_inner) => _inner.fmt(f),
136        }
137    }
138}
139impl StartOperationError {
140    /// Returns `true` if the error kind is `StartOperationError::DocktorError`.
141    pub fn is_docktor_error(&self) -> bool {
142        matches!(&self, StartOperationError::DocktorError(_))
143    }
144    /// Returns `true` if the error kind is `StartOperationError::SystemdError`.
145    pub fn is_systemd_error(&self) -> bool {
146        matches!(&self, StartOperationError::SystemdError(_))
147    }
148    /// Returns the error name string by matching the correct variant.
149    pub fn name(&self) -> &'static str {
150        match &self {
151            StartOperationError::DocktorError(_inner) => _inner.name(),
152            StartOperationError::SystemdError(_inner) => _inner.name(),
153        }
154    }
155}
156impl std::error::Error for StartOperationError {
157    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
158        match &self {
159            StartOperationError::DocktorError(_inner) => Some(_inner),
160            StartOperationError::SystemdError(_inner) => Some(_inner),
161        }
162    }
163}
164
165/// Error type for the `StopOperation` operation.
166/// Each variant represents an error that can occur for the `StopOperation` operation.
167#[derive(std::fmt::Debug)]
168pub enum StopOperationError {
169    /// //////////////////////////////////// Errors //////////////////////////////////// Returned when something critical happened.
170    DocktorError(crate::error::DocktorError),
171    /// Error coming from Systemd.
172    SystemdError(crate::error::SystemdError),
173}
174impl std::fmt::Display for StopOperationError {
175    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
176        match &self {
177            StopOperationError::DocktorError(_inner) => _inner.fmt(f),
178            StopOperationError::SystemdError(_inner) => _inner.fmt(f),
179        }
180    }
181}
182impl StopOperationError {
183    /// Returns `true` if the error kind is `StopOperationError::DocktorError`.
184    pub fn is_docktor_error(&self) -> bool {
185        matches!(&self, StopOperationError::DocktorError(_))
186    }
187    /// Returns `true` if the error kind is `StopOperationError::SystemdError`.
188    pub fn is_systemd_error(&self) -> bool {
189        matches!(&self, StopOperationError::SystemdError(_))
190    }
191    /// Returns the error name string by matching the correct variant.
192    pub fn name(&self) -> &'static str {
193        match &self {
194            StopOperationError::DocktorError(_inner) => _inner.name(),
195            StopOperationError::SystemdError(_inner) => _inner.name(),
196        }
197    }
198}
199impl std::error::Error for StopOperationError {
200    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
201        match &self {
202            StopOperationError::DocktorError(_inner) => Some(_inner),
203            StopOperationError::SystemdError(_inner) => Some(_inner),
204        }
205    }
206}
207
208/// Error coming from Prometheus.
209#[non_exhaustive]
210#[derive(std::clone::Clone, std::cmp::PartialEq)]
211pub struct PrometheusError {
212    #[allow(missing_docs)] // documentation missing in model
213    pub message: std::option::Option<std::string::String>,
214}
215impl std::fmt::Debug for PrometheusError {
216    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
217        let mut formatter = f.debug_struct("PrometheusError");
218        formatter.field("message", &self.message);
219        formatter.finish()
220    }
221}
222impl PrometheusError {
223    /// Returns the error message.
224    pub fn message(&self) -> Option<&str> {
225        self.message.as_deref()
226    }
227    #[doc(hidden)]
228    /// Returns the error name.
229    pub fn name(&self) -> &'static str {
230        "PrometheusError"
231    }
232}
233impl std::fmt::Display for PrometheusError {
234    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
235        write!(f, "PrometheusError")?;
236        if let Some(inner_1) = &self.message {
237            write!(f, ": {}", inner_1)?;
238        }
239        Ok(())
240    }
241}
242impl std::error::Error for PrometheusError {}
243/// See [`PrometheusError`](crate::error::PrometheusError)
244pub mod prometheus_error {
245    /// A builder for [`PrometheusError`](crate::error::PrometheusError)
246    #[non_exhaustive]
247    #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
248    pub struct Builder {
249        pub(crate) message: std::option::Option<std::string::String>,
250    }
251    impl Builder {
252        #[allow(missing_docs)] // documentation missing in model
253        pub fn message(mut self, input: impl Into<std::string::String>) -> Self {
254            self.message = Some(input.into());
255            self
256        }
257        #[allow(missing_docs)] // documentation missing in model
258        pub fn set_message(mut self, input: std::option::Option<std::string::String>) -> Self {
259            self.message = input;
260            self
261        }
262        /// Consumes the builder and constructs a [`PrometheusError`](crate::error::PrometheusError)
263        pub fn build(self) -> crate::error::PrometheusError {
264            crate::error::PrometheusError {
265                message: self.message,
266            }
267        }
268    }
269}
270impl PrometheusError {
271    /// Creates a new builder-style object to manufacture [`PrometheusError`](crate::error::PrometheusError)
272    pub fn builder() -> crate::error::prometheus_error::Builder {
273        crate::error::prometheus_error::Builder::default()
274    }
275}
276
277/// //////////////////////////////////// Errors //////////////////////////////////// Returned when something critical happened.
278#[non_exhaustive]
279#[derive(std::clone::Clone, std::cmp::PartialEq)]
280pub struct DocktorError {
281    #[allow(missing_docs)] // documentation missing in model
282    pub message: std::option::Option<std::string::String>,
283}
284impl std::fmt::Debug for DocktorError {
285    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
286        let mut formatter = f.debug_struct("DocktorError");
287        formatter.field("message", &self.message);
288        formatter.finish()
289    }
290}
291impl DocktorError {
292    /// Returns the error message.
293    pub fn message(&self) -> Option<&str> {
294        self.message.as_deref()
295    }
296    #[doc(hidden)]
297    /// Returns the error name.
298    pub fn name(&self) -> &'static str {
299        "DocktorError"
300    }
301}
302impl std::fmt::Display for DocktorError {
303    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
304        write!(f, "DocktorError")?;
305        if let Some(inner_2) = &self.message {
306            write!(f, ": {}", inner_2)?;
307        }
308        Ok(())
309    }
310}
311impl std::error::Error for DocktorError {}
312/// See [`DocktorError`](crate::error::DocktorError)
313pub mod docktor_error {
314    /// A builder for [`DocktorError`](crate::error::DocktorError)
315    #[non_exhaustive]
316    #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
317    pub struct Builder {
318        pub(crate) message: std::option::Option<std::string::String>,
319    }
320    impl Builder {
321        #[allow(missing_docs)] // documentation missing in model
322        pub fn message(mut self, input: impl Into<std::string::String>) -> Self {
323            self.message = Some(input.into());
324            self
325        }
326        #[allow(missing_docs)] // documentation missing in model
327        pub fn set_message(mut self, input: std::option::Option<std::string::String>) -> Self {
328            self.message = input;
329            self
330        }
331        /// Consumes the builder and constructs a [`DocktorError`](crate::error::DocktorError)
332        pub fn build(self) -> crate::error::DocktorError {
333            crate::error::DocktorError {
334                message: self.message,
335            }
336        }
337    }
338}
339impl DocktorError {
340    /// Creates a new builder-style object to manufacture [`DocktorError`](crate::error::DocktorError)
341    pub fn builder() -> crate::error::docktor_error::Builder {
342        crate::error::docktor_error::Builder::default()
343    }
344}
345
346/// Error coming from Systemd.
347#[non_exhaustive]
348#[derive(std::clone::Clone, std::cmp::PartialEq)]
349pub struct SystemdError {
350    #[allow(missing_docs)] // documentation missing in model
351    pub message: std::option::Option<std::string::String>,
352}
353impl std::fmt::Debug for SystemdError {
354    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
355        let mut formatter = f.debug_struct("SystemdError");
356        formatter.field("message", &self.message);
357        formatter.finish()
358    }
359}
360impl SystemdError {
361    /// Returns the error message.
362    pub fn message(&self) -> Option<&str> {
363        self.message.as_deref()
364    }
365    #[doc(hidden)]
366    /// Returns the error name.
367    pub fn name(&self) -> &'static str {
368        "SystemdError"
369    }
370}
371impl std::fmt::Display for SystemdError {
372    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
373        write!(f, "SystemdError")?;
374        if let Some(inner_3) = &self.message {
375            write!(f, ": {}", inner_3)?;
376        }
377        Ok(())
378    }
379}
380impl std::error::Error for SystemdError {}
381/// See [`SystemdError`](crate::error::SystemdError)
382pub mod systemd_error {
383    /// A builder for [`SystemdError`](crate::error::SystemdError)
384    #[non_exhaustive]
385    #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
386    pub struct Builder {
387        pub(crate) message: std::option::Option<std::string::String>,
388    }
389    impl Builder {
390        #[allow(missing_docs)] // documentation missing in model
391        pub fn message(mut self, input: impl Into<std::string::String>) -> Self {
392            self.message = Some(input.into());
393            self
394        }
395        #[allow(missing_docs)] // documentation missing in model
396        pub fn set_message(mut self, input: std::option::Option<std::string::String>) -> Self {
397            self.message = input;
398            self
399        }
400        /// Consumes the builder and constructs a [`SystemdError`](crate::error::SystemdError)
401        pub fn build(self) -> crate::error::SystemdError {
402            crate::error::SystemdError {
403                message: self.message,
404            }
405        }
406    }
407}
408impl SystemdError {
409    /// Creates a new builder-style object to manufacture [`SystemdError`](crate::error::SystemdError)
410    pub fn builder() -> crate::error::systemd_error::Builder {
411        crate::error::systemd_error::Builder::default()
412    }
413}
414
415/// Error coming from Prometheus.
416#[non_exhaustive]
417#[derive(std::clone::Clone, std::cmp::PartialEq)]
418pub struct HealtcheckError {
419    #[allow(missing_docs)] // documentation missing in model
420    pub message: std::option::Option<std::string::String>,
421}
422impl std::fmt::Debug for HealtcheckError {
423    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
424        let mut formatter = f.debug_struct("HealtcheckError");
425        formatter.field("message", &self.message);
426        formatter.finish()
427    }
428}
429impl HealtcheckError {
430    /// Returns the error message.
431    pub fn message(&self) -> Option<&str> {
432        self.message.as_deref()
433    }
434    #[doc(hidden)]
435    /// Returns the error name.
436    pub fn name(&self) -> &'static str {
437        "HealtcheckError"
438    }
439}
440impl std::fmt::Display for HealtcheckError {
441    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
442        write!(f, "HealtcheckError")?;
443        if let Some(inner_4) = &self.message {
444            write!(f, ": {}", inner_4)?;
445        }
446        Ok(())
447    }
448}
449impl std::error::Error for HealtcheckError {}
450/// See [`HealtcheckError`](crate::error::HealtcheckError)
451pub mod healtcheck_error {
452    /// A builder for [`HealtcheckError`](crate::error::HealtcheckError)
453    #[non_exhaustive]
454    #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
455    pub struct Builder {
456        pub(crate) message: std::option::Option<std::string::String>,
457    }
458    impl Builder {
459        #[allow(missing_docs)] // documentation missing in model
460        pub fn message(mut self, input: impl Into<std::string::String>) -> Self {
461            self.message = Some(input.into());
462            self
463        }
464        #[allow(missing_docs)] // documentation missing in model
465        pub fn set_message(mut self, input: std::option::Option<std::string::String>) -> Self {
466            self.message = input;
467            self
468        }
469        /// Consumes the builder and constructs a [`HealtcheckError`](crate::error::HealtcheckError)
470        pub fn build(self) -> crate::error::HealtcheckError {
471            crate::error::HealtcheckError {
472                message: self.message,
473            }
474        }
475    }
476}
477impl HealtcheckError {
478    /// Creates a new builder-style object to manufacture [`HealtcheckError`](crate::error::HealtcheckError)
479    pub fn builder() -> crate::error::healtcheck_error::Builder {
480        crate::error::healtcheck_error::Builder::default()
481    }
482}