Skip to main content

winterbaume_redshiftdata/
wire.rs

1//! Auto-generated wire helpers from Smithy models.
2//! Do not edit manually. Regenerate with:
3//!   smithy-codegen gen-serializers winterbaume-redshift-data
4
5#![allow(
6    dead_code,
7    unused_variables,
8    clippy::let_and_return,
9    clippy::single_match
10)]
11
12use winterbaume_core::MockResponse;
13
14pub use super::model::*;
15
16/// Serialize response for awsJson protocol.
17pub fn serialize_batch_execute_statement_response(
18    result: &BatchExecuteStatementOutput,
19) -> MockResponse {
20    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
21    MockResponse::json(200, body)
22}
23
24/// Serialize response for awsJson protocol.
25pub fn serialize_cancel_statement_response(result: &CancelStatementResponse) -> MockResponse {
26    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
27    MockResponse::json(200, body)
28}
29
30/// Serialize response for awsJson protocol.
31pub fn serialize_describe_statement_response(result: &DescribeStatementResponse) -> MockResponse {
32    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
33    MockResponse::json(200, body)
34}
35
36/// Serialize response for awsJson protocol.
37pub fn serialize_describe_table_response(result: &DescribeTableResponse) -> MockResponse {
38    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
39    MockResponse::json(200, body)
40}
41
42/// Serialize response for awsJson protocol.
43pub fn serialize_execute_statement_response(result: &ExecuteStatementOutput) -> MockResponse {
44    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
45    MockResponse::json(200, body)
46}
47
48/// Serialize response for awsJson protocol.
49pub fn serialize_get_statement_result_response(
50    result: &GetStatementResultResponse,
51) -> MockResponse {
52    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
53    MockResponse::json(200, body)
54}
55
56/// Serialize response for awsJson protocol.
57pub fn serialize_get_statement_result_v2_response(
58    result: &GetStatementResultV2Response,
59) -> MockResponse {
60    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
61    MockResponse::json(200, body)
62}
63
64/// Serialize response for awsJson protocol.
65pub fn serialize_list_databases_response(result: &ListDatabasesResponse) -> MockResponse {
66    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
67    MockResponse::json(200, body)
68}
69
70/// Serialize response for awsJson protocol.
71pub fn serialize_list_schemas_response(result: &ListSchemasResponse) -> MockResponse {
72    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
73    MockResponse::json(200, body)
74}
75
76/// Serialize response for awsJson protocol.
77pub fn serialize_list_statements_response(result: &ListStatementsResponse) -> MockResponse {
78    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
79    MockResponse::json(200, body)
80}
81
82/// Serialize response for awsJson protocol.
83pub fn serialize_list_tables_response(result: &ListTablesResponse) -> MockResponse {
84    let body = serde_json::to_string(result).unwrap_or_else(|_| "{}".to_string());
85    MockResponse::json(200, body)
86}
87
88/// Deserialize request for awsJson protocol.
89pub fn deserialize_batch_execute_statement_request(
90    body: &[u8],
91) -> Result<BatchExecuteStatementInput, String> {
92    if body.is_empty() {
93        return Ok(BatchExecuteStatementInput::default());
94    }
95    serde_json::from_slice(body)
96        .map_err(|e| format!("Failed to deserialize BatchExecuteStatement request: {e}"))
97}
98
99/// Deserialize request for awsJson protocol.
100pub fn deserialize_cancel_statement_request(body: &[u8]) -> Result<CancelStatementRequest, String> {
101    if body.is_empty() {
102        return Ok(CancelStatementRequest::default());
103    }
104    serde_json::from_slice(body)
105        .map_err(|e| format!("Failed to deserialize CancelStatement request: {e}"))
106}
107
108/// Deserialize request for awsJson protocol.
109pub fn deserialize_describe_statement_request(
110    body: &[u8],
111) -> Result<DescribeStatementRequest, String> {
112    if body.is_empty() {
113        return Ok(DescribeStatementRequest::default());
114    }
115    serde_json::from_slice(body)
116        .map_err(|e| format!("Failed to deserialize DescribeStatement request: {e}"))
117}
118
119/// Deserialize request for awsJson protocol.
120pub fn deserialize_describe_table_request(body: &[u8]) -> Result<DescribeTableRequest, String> {
121    if body.is_empty() {
122        return Ok(DescribeTableRequest::default());
123    }
124    serde_json::from_slice(body)
125        .map_err(|e| format!("Failed to deserialize DescribeTable request: {e}"))
126}
127
128/// Deserialize request for awsJson protocol.
129pub fn deserialize_execute_statement_request(body: &[u8]) -> Result<ExecuteStatementInput, String> {
130    if body.is_empty() {
131        return Ok(ExecuteStatementInput::default());
132    }
133    serde_json::from_slice(body)
134        .map_err(|e| format!("Failed to deserialize ExecuteStatement request: {e}"))
135}
136
137/// Deserialize request for awsJson protocol.
138pub fn deserialize_get_statement_result_request(
139    body: &[u8],
140) -> Result<GetStatementResultRequest, String> {
141    if body.is_empty() {
142        return Ok(GetStatementResultRequest::default());
143    }
144    serde_json::from_slice(body)
145        .map_err(|e| format!("Failed to deserialize GetStatementResult request: {e}"))
146}
147
148/// Deserialize request for awsJson protocol.
149pub fn deserialize_get_statement_result_v2_request(
150    body: &[u8],
151) -> Result<GetStatementResultV2Request, String> {
152    if body.is_empty() {
153        return Ok(GetStatementResultV2Request::default());
154    }
155    serde_json::from_slice(body)
156        .map_err(|e| format!("Failed to deserialize GetStatementResultV2 request: {e}"))
157}
158
159/// Deserialize request for awsJson protocol.
160pub fn deserialize_list_databases_request(body: &[u8]) -> Result<ListDatabasesRequest, String> {
161    if body.is_empty() {
162        return Ok(ListDatabasesRequest::default());
163    }
164    serde_json::from_slice(body)
165        .map_err(|e| format!("Failed to deserialize ListDatabases request: {e}"))
166}
167
168/// Deserialize request for awsJson protocol.
169pub fn deserialize_list_schemas_request(body: &[u8]) -> Result<ListSchemasRequest, String> {
170    if body.is_empty() {
171        return Ok(ListSchemasRequest::default());
172    }
173    serde_json::from_slice(body)
174        .map_err(|e| format!("Failed to deserialize ListSchemas request: {e}"))
175}
176
177/// Deserialize request for awsJson protocol.
178pub fn deserialize_list_statements_request(body: &[u8]) -> Result<ListStatementsRequest, String> {
179    if body.is_empty() {
180        return Ok(ListStatementsRequest::default());
181    }
182    serde_json::from_slice(body)
183        .map_err(|e| format!("Failed to deserialize ListStatements request: {e}"))
184}
185
186/// Deserialize request for awsJson protocol.
187pub fn deserialize_list_tables_request(body: &[u8]) -> Result<ListTablesRequest, String> {
188    if body.is_empty() {
189        return Ok(ListTablesRequest::default());
190    }
191    serde_json::from_slice(body)
192        .map_err(|e| format!("Failed to deserialize ListTables request: {e}"))
193}