aws_sdk_dynamodb/operation/execute_transaction/
_execute_transaction_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ExecuteTransactionOutput {
6    /// <p>The response to a PartiQL transaction.</p>
7    pub responses: ::std::option::Option<::std::vec::Vec<crate::types::ItemResponse>>,
8    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
9    pub consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
10    _request_id: Option<String>,
11}
12impl ExecuteTransactionOutput {
13    /// <p>The response to a PartiQL transaction.</p>
14    ///
15    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.responses.is_none()`.
16    pub fn responses(&self) -> &[crate::types::ItemResponse] {
17        self.responses.as_deref().unwrap_or_default()
18    }
19    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
20    ///
21    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.consumed_capacity.is_none()`.
22    pub fn consumed_capacity(&self) -> &[crate::types::ConsumedCapacity] {
23        self.consumed_capacity.as_deref().unwrap_or_default()
24    }
25}
26impl ::aws_types::request_id::RequestId for ExecuteTransactionOutput {
27    fn request_id(&self) -> Option<&str> {
28        self._request_id.as_deref()
29    }
30}
31impl ExecuteTransactionOutput {
32    /// Creates a new builder-style object to manufacture [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
33    pub fn builder() -> crate::operation::execute_transaction::builders::ExecuteTransactionOutputBuilder {
34        crate::operation::execute_transaction::builders::ExecuteTransactionOutputBuilder::default()
35    }
36}
37
38/// A builder for [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
39#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
40#[non_exhaustive]
41pub struct ExecuteTransactionOutputBuilder {
42    pub(crate) responses: ::std::option::Option<::std::vec::Vec<crate::types::ItemResponse>>,
43    pub(crate) consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
44    _request_id: Option<String>,
45}
46impl ExecuteTransactionOutputBuilder {
47    /// Appends an item to `responses`.
48    ///
49    /// To override the contents of this collection use [`set_responses`](Self::set_responses).
50    ///
51    /// <p>The response to a PartiQL transaction.</p>
52    pub fn responses(mut self, input: crate::types::ItemResponse) -> Self {
53        let mut v = self.responses.unwrap_or_default();
54        v.push(input);
55        self.responses = ::std::option::Option::Some(v);
56        self
57    }
58    /// <p>The response to a PartiQL transaction.</p>
59    pub fn set_responses(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ItemResponse>>) -> Self {
60        self.responses = input;
61        self
62    }
63    /// <p>The response to a PartiQL transaction.</p>
64    pub fn get_responses(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ItemResponse>> {
65        &self.responses
66    }
67    /// Appends an item to `consumed_capacity`.
68    ///
69    /// To override the contents of this collection use [`set_consumed_capacity`](Self::set_consumed_capacity).
70    ///
71    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
72    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
73        let mut v = self.consumed_capacity.unwrap_or_default();
74        v.push(input);
75        self.consumed_capacity = ::std::option::Option::Some(v);
76        self
77    }
78    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
79    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>) -> Self {
80        self.consumed_capacity = input;
81        self
82    }
83    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
84    pub fn get_consumed_capacity(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>> {
85        &self.consumed_capacity
86    }
87    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
88        self._request_id = Some(request_id.into());
89        self
90    }
91
92    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
93        self._request_id = request_id;
94        self
95    }
96    /// Consumes the builder and constructs a [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
97    pub fn build(self) -> crate::operation::execute_transaction::ExecuteTransactionOutput {
98        crate::operation::execute_transaction::ExecuteTransactionOutput {
99            responses: self.responses,
100            consumed_capacity: self.consumed_capacity,
101            _request_id: self._request_id,
102        }
103    }
104}