Skip to main content

nominal_api/conjure/errors/scout/integrations/api/
invalid_delivery_config.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct InvalidDeliveryConfig {
16    #[builder(into)]
17    #[serde(rename = "fieldName")]
18    field_name: String,
19    #[builder(default, into)]
20    #[serde(rename = "providedValue", skip_serializing_if = "Option::is_none", default)]
21    provided_value: Option<i32>,
22    #[builder(into)]
23    #[serde(rename = "constraint")]
24    constraint: String,
25}
26impl InvalidDeliveryConfig {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(field_name: impl Into<String>, constraint: impl Into<String>) -> Self {
30        Self::builder().field_name(field_name).constraint(constraint).build()
31    }
32    #[inline]
33    pub fn field_name(&self) -> &str {
34        &*self.field_name
35    }
36    #[inline]
37    pub fn provided_value(&self) -> Option<i32> {
38        self.provided_value.as_ref().map(|o| *o)
39    }
40    #[inline]
41    pub fn constraint(&self) -> &str {
42        &*self.constraint
43    }
44}
45impl conjure_error::ErrorType for InvalidDeliveryConfig {
46    #[inline]
47    fn code() -> conjure_error::ErrorCode {
48        conjure_error::ErrorCode::InvalidArgument
49    }
50    #[inline]
51    fn name() -> &'static str {
52        "Scout:InvalidDeliveryConfig"
53    }
54    #[inline]
55    fn safe_args() -> &'static [&'static str] {
56        &["constraint", "fieldName", "providedValue"]
57    }
58}