1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 |
|
3 3 | /// <p>Represents an operation to perform - either <code>DeleteItem</code> or <code>PutItem</code>. You can only request one of these operations, not both, in a single <code>WriteRequest</code>. If you do need to perform both of these operations, you need to provide two separate <code>WriteRequest</code> objects.</p>
|
4 4 | #[non_exhaustive]
|
5 5 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
6 6 | pub struct WriteRequest {
|
7 7 | /// <p>A request to perform a <code>PutItem</code> operation.</p>
|
8 8 | pub put_request: ::std::option::Option<crate::types::PutRequest>,
|
9 9 | /// <p>A request to perform a <code>DeleteItem</code> operation.</p>
|
10 10 | pub delete_request: ::std::option::Option<crate::types::DeleteRequest>,
|
11 11 | }
|
12 12 | impl WriteRequest {
|
13 13 | /// <p>A request to perform a <code>PutItem</code> operation.</p>
|
14 14 | pub fn put_request(&self) -> ::std::option::Option<&crate::types::PutRequest> {
|
15 15 | self.put_request.as_ref()
|
16 16 | }
|
17 17 | /// <p>A request to perform a <code>DeleteItem</code> operation.</p>
|
18 18 | pub fn delete_request(&self) -> ::std::option::Option<&crate::types::DeleteRequest> {
|
19 19 | self.delete_request.as_ref()
|
20 20 | }
|
21 21 | }
|
22 22 | static WRITEREQUEST_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
23 23 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb#WriteRequest", "com.amazonaws.dynamodb", "WriteRequest");
|
24 24 | static WRITEREQUEST_MEMBER_PUT_REQUEST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
25 25 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb#WriteRequest$PutRequest", "com.amazonaws.dynamodb", "WriteRequest"),
|
26 26 | ::aws_smithy_schema::ShapeType::Structure,
|
27 - | "put_request",
|
27 + | "PutRequest",
|
28 28 | 0,
|
29 29 | );
|
30 30 | static WRITEREQUEST_MEMBER_DELETE_REQUEST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
31 31 | ::aws_smithy_schema::ShapeId::from_static(
|
32 32 | "com.amazonaws.dynamodb#WriteRequest$DeleteRequest",
|
33 33 | "com.amazonaws.dynamodb",
|
34 34 | "WriteRequest",
|
35 35 | ),
|
36 36 | ::aws_smithy_schema::ShapeType::Structure,
|
37 - | "delete_request",
|
37 + | "DeleteRequest",
|
38 38 | 1,
|
39 39 | );
|
40 40 | static WRITEREQUEST_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
41 41 | WRITEREQUEST_SCHEMA_ID,
|
42 42 | ::aws_smithy_schema::ShapeType::Structure,
|
43 43 | &[&WRITEREQUEST_MEMBER_PUT_REQUEST, &WRITEREQUEST_MEMBER_DELETE_REQUEST],
|
44 44 | );
|
45 45 | impl WriteRequest {
|
46 46 | /// The schema for this shape.
|
47 47 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &WRITEREQUEST_SCHEMA;
|
48 48 | }
|
49 49 | impl ::aws_smithy_schema::serde::SerializableStruct for WriteRequest {
|
50 50 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
51 51 | fn serialize_members(
|
52 52 | &self,
|
53 53 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
54 54 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
55 55 | if let Some(ref val) = self.put_request {
|
56 56 | ser.write_struct(&WRITEREQUEST_MEMBER_PUT_REQUEST, val)?;
|
57 57 | }
|
58 58 | if let Some(ref val) = self.delete_request {
|
59 59 | ser.write_struct(&WRITEREQUEST_MEMBER_DELETE_REQUEST, val)?;
|
60 60 | }
|
61 61 | Ok(())
|
62 62 | }
|
63 63 | }
|
64 64 | impl WriteRequest {
|
65 65 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
66 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
67 - | deserializer: &mut D,
|
66 + | pub fn deserialize(
|
67 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
68 68 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
69 69 | #[allow(unused_variables, unused_mut)]
|
70 70 | let mut builder = Self::builder();
|
71 71 | #[allow(
|
72 72 | unused_variables,
|
73 73 | unreachable_code,
|
74 74 | clippy::single_match,
|
75 75 | clippy::match_single_binding,
|
76 76 | clippy::diverging_sub_expression
|
77 77 | )]
|
78 - | deserializer.read_struct(&WRITEREQUEST_SCHEMA, (), |_, member, deser| {
|
78 + | deserializer.read_struct(&WRITEREQUEST_SCHEMA, &mut |member, deser| {
|
79 79 | match member.member_index() {
|
80 80 | Some(0) => {
|
81 81 | builder.put_request = Some(crate::types::PutRequest::deserialize(deser)?);
|
82 82 | }
|
83 83 | Some(1) => {
|
84 84 | builder.delete_request = Some(crate::types::DeleteRequest::deserialize(deser)?);
|
85 85 | }
|
86 86 | _ => {}
|
87 87 | }
|
88 88 | Ok(())
|
89 89 | })?;
|
90 90 | Ok(builder.build())
|
91 91 | }
|
92 92 | }
|
93 + | impl WriteRequest {
|
94 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
95 + | pub fn deserialize_with_response(
|
96 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
97 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
98 + | _status: u16,
|
99 + | _body: &[u8],
|
100 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
101 + | Self::deserialize(deserializer)
|
102 + | }
|
103 + | }
|
93 104 | impl WriteRequest {
|
94 105 | /// Creates a new builder-style object to manufacture [`WriteRequest`](crate::types::WriteRequest).
|
95 106 | pub fn builder() -> crate::types::builders::WriteRequestBuilder {
|
96 107 | crate::types::builders::WriteRequestBuilder::default()
|
97 108 | }
|
98 109 | }
|
99 110 |
|
100 111 | /// A builder for [`WriteRequest`](crate::types::WriteRequest).
|
101 112 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
102 113 | #[non_exhaustive]
|
103 114 | pub struct WriteRequestBuilder {
|
104 115 | pub(crate) put_request: ::std::option::Option<crate::types::PutRequest>,
|
105 116 | pub(crate) delete_request: ::std::option::Option<crate::types::DeleteRequest>,
|
106 117 | }
|
107 118 | impl WriteRequestBuilder {
|
108 119 | /// <p>A request to perform a <code>PutItem</code> operation.</p>
|
109 120 | pub fn put_request(mut self, input: crate::types::PutRequest) -> Self {
|
110 121 | self.put_request = ::std::option::Option::Some(input);
|
111 122 | self
|
112 123 | }
|
113 124 | /// <p>A request to perform a <code>PutItem</code> operation.</p>
|
114 125 | pub fn set_put_request(mut self, input: ::std::option::Option<crate::types::PutRequest>) -> Self {
|
115 126 | self.put_request = input;
|
116 127 | self
|
117 128 | }
|
118 129 | /// <p>A request to perform a <code>PutItem</code> operation.</p>
|
119 130 | pub fn get_put_request(&self) -> &::std::option::Option<crate::types::PutRequest> {
|
120 131 | &self.put_request
|
121 132 | }
|
122 133 | /// <p>A request to perform a <code>DeleteItem</code> operation.</p>
|