1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>An ordered list of errors for each item in the request which caused the transaction to get cancelled. The values of the list are ordered according to the ordering of the <code>TransactWriteItems</code> request parameter. If no error occurred for the associated item an error with a Null code and Null message will be present.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CancellationReason {
    /// <p>Item in the request which caused the transaction to get cancelled.</p>
    pub item: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
    /// <p>Status code for the result of the cancelled transaction.</p>
    pub code: ::std::option::Option<::std::string::String>,
    /// <p>Cancellation reason message description.</p>
    pub message: ::std::option::Option<::std::string::String>,
}
impl CancellationReason {
    /// <p>Item in the request which caused the transaction to get cancelled.</p>
    pub fn item(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
        self.item.as_ref()
    }
    /// <p>Status code for the result of the cancelled transaction.</p>
    pub fn code(&self) -> ::std::option::Option<&str> {
        self.code.as_deref()
    }
    /// <p>Cancellation reason message description.</p>
    pub fn message(&self) -> ::std::option::Option<&str> {
        self.message.as_deref()
    }
}
impl CancellationReason {
    /// Creates a new builder-style object to manufacture [`CancellationReason`](crate::types::CancellationReason).
    pub fn builder() -> crate::types::builders::CancellationReasonBuilder {
        crate::types::builders::CancellationReasonBuilder::default()
    }
}

/// A builder for [`CancellationReason`](crate::types::CancellationReason).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CancellationReasonBuilder {
    pub(crate) item: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
    pub(crate) code: ::std::option::Option<::std::string::String>,
    pub(crate) message: ::std::option::Option<::std::string::String>,
}
impl CancellationReasonBuilder {
    /// Adds a key-value pair to `item`.
    ///
    /// To override the contents of this collection use [`set_item`](Self::set_item).
    ///
    /// <p>Item in the request which caused the transaction to get cancelled.</p>
    pub fn item(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
        let mut hash_map = self.item.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.item = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>Item in the request which caused the transaction to get cancelled.</p>
    pub fn set_item(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
    ) -> Self {
        self.item = input;
        self
    }
    /// <p>Item in the request which caused the transaction to get cancelled.</p>
    pub fn get_item(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
        &self.item
    }
    /// <p>Status code for the result of the cancelled transaction.</p>
    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.code = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Status code for the result of the cancelled transaction.</p>
    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.code = input;
        self
    }
    /// <p>Status code for the result of the cancelled transaction.</p>
    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
        &self.code
    }
    /// <p>Cancellation reason message description.</p>
    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.message = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Cancellation reason message description.</p>
    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.message = input;
        self
    }
    /// <p>Cancellation reason message description.</p>
    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
        &self.message
    }
    /// Consumes the builder and constructs a [`CancellationReason`](crate::types::CancellationReason).
    pub fn build(self) -> crate::types::CancellationReason {
        crate::types::CancellationReason {
            item: self.item,
            code: self.code,
            message: self.message,
        }
    }
}