1
+ import {
2
+ ColumnMetadata ,
3
+ ExecuteStatementRequest ,
4
+ ExecuteStatementResponse ,
5
+ Field ,
6
+ SqlParameter
7
+ } from "../models/com/amazon/rdsdataservice" ;
8
+ import { HttpRequest , HttpResponse } from "@aws-sdk/protocol-http" ;
9
+
10
+ export function executeStatementAwsRestJson1_1Serialize (
11
+ input : ExecuteStatementRequest
12
+ ) : HttpRequest {
13
+ let body : any = { } ;
14
+ if ( input . resourceArn !== undefined ) {
15
+ body . resourceArn = input . resourceArn ;
16
+ }
17
+
18
+ if ( input . secretArn !== undefined ) {
19
+ body . secretArn = input . secretArn ;
20
+ }
21
+
22
+ if ( input . sql !== undefined ) {
23
+ body . sql = input . sql ;
24
+ }
25
+
26
+ if ( input . database !== undefined ) {
27
+ body . database = input . database ;
28
+ }
29
+
30
+ if ( input . schema !== undefined ) {
31
+ body . schema = input . schema ;
32
+ }
33
+
34
+ if ( input . parameters !== undefined ) {
35
+ body . parameters = sqlParameterListAwsRestJson1_1Serialize ( input . parameters ) ;
36
+ }
37
+
38
+ if ( input . transactionId !== undefined ) {
39
+ body . transactionId = input . transactionId ;
40
+ }
41
+
42
+ if ( input . includeResultMetadata !== undefined ) {
43
+ body . includeResultMetadata = input . includeResultMetadata ;
44
+ }
45
+
46
+ if ( input . continueAfterTimeout !== undefined ) {
47
+ body . continueAfterTimeout = input . continueAfterTimeout ;
48
+ }
49
+
50
+ return new HttpRequest ( {
51
+ body : JSON . stringify ( body ) ,
52
+ path : "/execute" ,
53
+ method : "POST" ,
54
+ protocol : "https:" ,
55
+ headers : {
56
+ "Content-Type" : "application/json"
57
+ }
58
+ } ) ;
59
+ }
60
+
61
+ export function executeStatementAwsRestJson1_1Deserialize (
62
+ output : HttpResponse
63
+ ) : ExecuteStatementResponse {
64
+ let data : any = { } ;
65
+ if ( output . body ) {
66
+ data = JSON . parse ( output . body ) ;
67
+ }
68
+ return {
69
+ $namespace : "com.amazon.rdsdataservice" ,
70
+ $name : "ExecuteStatementResponse" ,
71
+ records : recordsAwsRestJson1_1Deserialize ( data . records ) ,
72
+ columnMetadata : columnMetadataListAwsRestJson1_1Deserialize (
73
+ data . columnMetadata
74
+ ) ,
75
+ numberOfRecordsUpdated : data . numberOfRecordsUpdated ,
76
+ generatedFields : generatedFieldsAwsRestJson1_1Deserialize (
77
+ data . generatedFields
78
+ )
79
+ } ;
80
+ }
81
+
82
+ function finalize ( input : any ) : HttpRequest {
83
+ input . protocol = "https:" ;
84
+ input . body = JSON . stringify ( input . body ) ;
85
+ input . headers = {
86
+ "Content-Type" : "application/json"
87
+ } ;
88
+ return input ;
89
+ }
90
+
91
+ function sqlParameterListAwsRestJson1_1Serialize (
92
+ input : Array < SqlParameter >
93
+ ) : Array < SqlParameter > {
94
+ let list : Array < SqlParameter > = [ ] ;
95
+ for ( let SqlParameter of input ) {
96
+ list . push ( sqlParameterAwsRestJson1_1Serialize ( SqlParameter ) ) ;
97
+ }
98
+ return list ;
99
+ }
100
+
101
+ function sqlParameterAwsRestJson1_1Serialize ( input : SqlParameter ) : any {
102
+ return {
103
+ name : input . name ,
104
+ value : fieldAwsRestJson1_1Serialize ( input . value )
105
+ } ;
106
+ }
107
+
108
+ function fieldAwsRestJson1_1Serialize ( input : Field ) : any {
109
+ return input . visit ( input , { } ) ;
110
+ }
111
+
112
+ export function columnMetadataAwsRestJson1_1Deserialize (
113
+ input : any
114
+ ) : ColumnMetadata {
115
+ let columnMetadata : any = {
116
+ $namespace : "com.amazon.rdsdataservice" ,
117
+ $name : "ColumnMetadata"
118
+ } ;
119
+ if ( input . nullable !== undefined ) {
120
+ columnMetadata . nullable = input . nullable ;
121
+ }
122
+
123
+ if ( input . label !== undefined ) {
124
+ columnMetadata . label = input . label ;
125
+ }
126
+
127
+ if ( input . typeName !== undefined ) {
128
+ columnMetadata . typeName = input . typeName ;
129
+ }
130
+
131
+ if ( input . isCaseSensitive !== undefined ) {
132
+ columnMetadata . isCaseSensitive = input . isCaseSensitive ;
133
+ }
134
+
135
+ if ( input . isCurrency !== undefined ) {
136
+ columnMetadata . isCurrency = input . isCurrency ;
137
+ }
138
+
139
+ if ( input . arrayBaseColumnType !== undefined ) {
140
+ columnMetadata . arrayBaseColumnType = input . arrayBaseColumnType ;
141
+ }
142
+
143
+ if ( input . precision !== undefined ) {
144
+ columnMetadata . precision = input . precision ;
145
+ }
146
+
147
+ if ( input . type !== undefined ) {
148
+ columnMetadata . type = input . type ;
149
+ }
150
+
151
+ if ( input . isSigned !== undefined ) {
152
+ columnMetadata . isSigned = input . isSigned ;
153
+ }
154
+
155
+ if ( input . schemeName !== undefined ) {
156
+ columnMetadata . schemeName = input . schemeName ;
157
+ }
158
+
159
+ if ( input . isAutoIncrement !== undefined ) {
160
+ columnMetadata . isAutoIncrement = input . isAutoIncrement ;
161
+ }
162
+
163
+ if ( input . name !== undefined ) {
164
+ columnMetadata . name = input . name ;
165
+ }
166
+
167
+ if ( input . scale !== undefined ) {
168
+ columnMetadata . scale = input . scale ;
169
+ }
170
+
171
+ if ( input . tableName !== undefined ) {
172
+ columnMetadata . tableName = input . tableName ;
173
+ }
174
+
175
+ return columnMetadata ;
176
+ }
177
+
178
+ function columnMetadataListAwsRestJson1_1Deserialize (
179
+ input : any
180
+ ) : Array < ColumnMetadata > {
181
+ let list : Array < ColumnMetadata > = [ ] ;
182
+ for ( let ColumnMetadata of input ) {
183
+ list . push ( columnMetadataAwsRestJson1_1Deserialize ( ColumnMetadata ) ) ;
184
+ }
185
+ return list ;
186
+ }
187
+
188
+ function fieldAwsRestJson1_1Deserialize ( input : any ) : Field {
189
+ return input . visit ( input , { } ) ;
190
+ }
191
+
192
+ function generatedFieldsAwsRestJson1_1Deserialize ( input : any ) : Array < Field > {
193
+ let list : Array < Field > = [ ] ;
194
+ for ( let Field of input ) {
195
+ list . push ( fieldAwsRestJson1_1Deserialize ( Field ) ) ;
196
+ }
197
+ return list ;
198
+ }
199
+
200
+ function recordsAwsRestJson1_1Deserialize ( input : any ) : Array < Array < Field > > {
201
+ let list : Array < Array < Field > > = [ ] ;
202
+ for ( let recordsList of input ) {
203
+ list . push ( recordsListAwsRestJson1_1Deserialize ( input ) ) ;
204
+ }
205
+ return list ;
206
+ }
207
+
208
+ function recordsListAwsRestJson1_1Deserialize ( input : any ) : Array < Field > {
209
+ let list : Array < Field > = [ ] ;
210
+ for ( let Field of input ) {
211
+ list . push ( fieldAwsRestJson1_1Serialize ( input ) ) ;
212
+ }
213
+ return list ;
214
+ }
0 commit comments