@@ -12,15 +12,11 @@ import {
12
12
} from "../models/rdsdataservice" ;
13
13
import { HttpRequest , HttpResponse } from "@aws-sdk/protocol-http" ;
14
14
import { SerializerUtils , DeserializerUtils } from "@aws-sdk/types" ;
15
- import * as __aws_sdk_stream_collector_node from "@aws-sdk/stream-collector-node" ;
16
- import * as __aws_sdk_util_utf8_node from "@aws-sdk/util-utf8-node" ;
17
15
import { ResponseMetadata } from "@aws-sdk/types" ;
18
16
19
- type Utils = { [ key : string ] : any } ;
20
-
21
17
export function executeStatementAwsRestJson1_1Serialize (
22
18
input : ExecuteStatementRequest ,
23
- utils ?: Utils
19
+ utils : SerializerUtils
24
20
) : HttpRequest {
25
21
let body : any = { } ;
26
22
if ( input . resourceArn !== undefined ) {
@@ -44,7 +40,7 @@ export function executeStatementAwsRestJson1_1Serialize(
44
40
}
45
41
46
42
if ( input . parameters !== undefined ) {
47
- body . parameters = sqlParameterListAwsRestJson1_1Serialize ( input . parameters ) ;
43
+ body . parameters = sqlParameterListAwsRestJson1_1Serialize ( input . parameters , utils ) ;
48
44
}
49
45
50
46
if ( input . transactionId !== undefined ) {
@@ -72,51 +68,54 @@ export function executeStatementAwsRestJson1_1Serialize(
72
68
73
69
export async function executeStatementAwsRestJson1_1Deserialize (
74
70
output : HttpResponse ,
75
- utils ?: Utils
71
+ utils : DeserializerUtils
76
72
) : Promise < ExecuteStatementResponse > {
77
73
if ( output . statusCode !== 200 ) {
78
- return executeStatementAwsRestJson1_1DeserializeError ( output ) ;
74
+ return executeStatementAwsRestJson1_1DeserializeError ( output , utils ) ;
79
75
}
80
76
let data : any = await parseBody ( output . body , utils ) ;
81
77
return Promise . resolve ( {
82
78
$metadata : deserializeMetadata ( output ) ,
83
79
__type : "com.amazon.rdsdataservice#ExecuteStatementResponse" ,
84
- records : recordsAwsRestJson1_1Deserialize ( data . records ) ,
80
+ records : recordsAwsRestJson1_1Deserialize ( data . records , utils ) ,
85
81
columnMetadata : columnMetadataListAwsRestJson1_1Deserialize (
86
- data . columnMetadata
82
+ data . columnMetadata ,
83
+ utils
87
84
) ,
88
85
numberOfRecordsUpdated : data . numberOfRecordsUpdated ,
89
86
generatedFields : generatedFieldsAwsRestJson1_1Deserialize (
90
- data . generatedFields
87
+ data . generatedFields ,
88
+ utils
91
89
)
92
90
} ) ;
93
91
}
94
92
95
93
async function executeStatementAwsRestJson1_1DeserializeError (
96
- output : HttpResponse
94
+ output : HttpResponse ,
95
+ utils : DeserializerUtils
97
96
) : Promise < ExecuteStatementResponse > {
98
- let data = await parseBody ( output . body ) ;
97
+ let data = await parseBody ( output . body , utils ) ;
99
98
let response : any ;
100
99
switch ( output . headers [ "x-amzn-ErrorType" ] ) {
101
100
case "BadRequestException" :
102
101
case "com.amazon.rdsdataservice#BadRequestException" :
103
- response = badRequestExceptionDeserialize ( data ) ;
102
+ response = badRequestExceptionDeserialize ( data , utils ) ;
104
103
break ;
105
104
case "StatementTimeoutException" :
106
105
case "com.amazon.rdsdataservice#StatementTimeoutException" :
107
- response = statementTimeoutExceptionDeserialize ( data ) ;
106
+ response = statementTimeoutExceptionDeserialize ( data , utils ) ;
108
107
break ;
109
108
case "ForbiddenException" :
110
109
case "com.amazon.rdsdataservice#ForbiddenException" :
111
- response = forbiddenExceptionDeserialize ( data ) ;
110
+ response = forbiddenExceptionDeserialize ( data , utils ) ;
112
111
break ;
113
112
case "InternalServerErrorException" :
114
113
case "com.amazon.rdsdataservice#InternalServerErrorException" :
115
- response = internalServerErrorExceptionDeserialize ( data ) ;
114
+ response = internalServerErrorExceptionDeserialize ( data , utils ) ;
116
115
break ;
117
116
case "ServiceUnavailableError" :
118
117
case "com.amazon.rdsdataservice#ServiceUnavailableError" :
119
- response = serviceUnavailableErrorDeserialize ( data ) ;
118
+ response = serviceUnavailableErrorDeserialize ( data , utils ) ;
120
119
break ;
121
120
default :
122
121
response = {
@@ -130,19 +129,20 @@ async function executeStatementAwsRestJson1_1DeserializeError(
130
129
}
131
130
132
131
const sqlParameterListAwsRestJson1_1Serialize = (
133
- input : Array < SqlParameter >
132
+ input : Array < SqlParameter > ,
133
+ utils : SerializerUtils
134
134
) : Array < SqlParameter > =>
135
135
input &&
136
- input . map ( sqlParameter => sqlParameterAwsRestJson1_1Serialize ( sqlParameter ) ) ;
136
+ input . map ( sqlParameter => sqlParameterAwsRestJson1_1Serialize ( sqlParameter , utils ) ) ;
137
137
138
- const sqlParameterAwsRestJson1_1Serialize = ( input : SqlParameter ) : any =>
138
+ const sqlParameterAwsRestJson1_1Serialize = ( input : SqlParameter , utils : SerializerUtils ) : any =>
139
139
input . name &&
140
140
input . value && {
141
141
name : input . name ,
142
- value : fieldAwsRestJson1_1Serialize ( input . value )
142
+ value : fieldAwsRestJson1_1Serialize ( input . value , utils )
143
143
} ;
144
144
145
- const fieldAwsRestJson1_1Serialize = ( input : Field ) : any =>
145
+ const fieldAwsRestJson1_1Serialize = ( input : Field , utils : SerializerUtils ) : any =>
146
146
Field . visit ( input , {
147
147
blobValue : value => {
148
148
value ;
@@ -174,7 +174,8 @@ const fieldAwsRestJson1_1Serialize = (input: Field): any =>
174
174
} ) ;
175
175
176
176
export function columnMetadataAwsRestJson1_1Deserialize (
177
- input : any
177
+ input : any ,
178
+ utils : DeserializerUtils
178
179
) : ColumnMetadata {
179
180
let columnMetadata : any = {
180
181
$namespace : "com.amazon.rdsdataservice" ,
@@ -240,14 +241,15 @@ export function columnMetadataAwsRestJson1_1Deserialize(
240
241
}
241
242
242
243
const columnMetadataListAwsRestJson1_1Deserialize = (
243
- input : any
244
+ input : any ,
245
+ utils : DeserializerUtils
244
246
) : Array < ColumnMetadata > =>
245
247
input &&
246
248
input . map ( ( columnMetadata : any ) =>
247
- columnMetadataAwsRestJson1_1Deserialize ( columnMetadata )
249
+ columnMetadataAwsRestJson1_1Deserialize ( columnMetadata , utils )
248
250
) ;
249
251
250
- const fieldAwsRestJson1_1Deserialize = ( input : any ) : any =>
252
+ const fieldAwsRestJson1_1Deserialize = ( input : any , utils : DeserializerUtils ) : any =>
251
253
Field . visit ( input , {
252
254
blobValue : value => {
253
255
value ;
@@ -278,27 +280,28 @@ const fieldAwsRestJson1_1Deserialize = (input: any): any =>
278
280
}
279
281
} ) ;
280
282
281
- const generatedFieldsAwsRestJson1_1Deserialize = ( input : any ) : Array < Field > =>
282
- input && input . map ( ( field : any ) => fieldAwsRestJson1_1Deserialize ( field ) ) ;
283
+ const generatedFieldsAwsRestJson1_1Deserialize = ( input : any , utils : DeserializerUtils ) : Array < Field > =>
284
+ input && input . map ( ( field : any ) => fieldAwsRestJson1_1Deserialize ( field , utils ) ) ;
283
285
284
- const recordsAwsRestJson1_1Deserialize = ( input : any ) : Array < Array < Field > > =>
286
+ const recordsAwsRestJson1_1Deserialize = ( input : any , utils : DeserializerUtils ) : Array < Array < Field > > =>
285
287
input &&
286
288
input . map ( ( recordsList : any ) =>
287
- recordsListAwsRestJson1_1Deserialize ( recordsList )
289
+ recordsListAwsRestJson1_1Deserialize ( recordsList , utils )
288
290
) ;
289
291
290
- const recordsListAwsRestJson1_1Deserialize = ( input : any ) : Array < Field > =>
291
- input && input . map ( ( field : any ) => fieldAwsRestJson1_1Deserialize ( field ) ) ;
292
+ const recordsListAwsRestJson1_1Deserialize = ( input : any , utils : DeserializerUtils ) : Array < Field > =>
293
+ input && input . map ( ( field : any ) => fieldAwsRestJson1_1Deserialize ( field , utils ) ) ;
292
294
293
- const badRequestExceptionDeserialize = ( input : any ) : BadRequestException => ( {
295
+ const badRequestExceptionDeserialize = ( input : any , utils : DeserializerUtils ) : BadRequestException => ( {
294
296
__type : "com.amazon.rdsdataservice#BadRequestException" ,
295
297
$name : "BadRequestException" ,
296
298
$fault : "client" ,
297
299
message : input . message
298
300
} ) ;
299
301
300
302
const statementTimeoutExceptionDeserialize = (
301
- input : any
303
+ input : any ,
304
+ utils : DeserializerUtils
302
305
) : StatementTimeoutException => ( {
303
306
__type : "com.amazon.rdsdataservice#StatementTimeoutException" ,
304
307
$name : "StatementTimeoutException" ,
@@ -307,23 +310,25 @@ const statementTimeoutExceptionDeserialize = (
307
310
dbConnectionId : input . dbConnectionId
308
311
} ) ;
309
312
310
- const forbiddenExceptionDeserialize = ( input : any ) : ForbiddenException => ( {
313
+ const forbiddenExceptionDeserialize = ( input : any , utils : DeserializerUtils ) : ForbiddenException => ( {
311
314
__type : "com.amazon.rdsdataservice#ForbiddenException" ,
312
315
$name : "ForbiddenException" ,
313
316
$fault : "client" ,
314
317
message : input . message
315
318
} ) ;
316
319
317
320
const internalServerErrorExceptionDeserialize = (
318
- input : any
321
+ input : any ,
322
+ utils : DeserializerUtils
319
323
) : InternalServerErrorException => ( {
320
324
__type : "com.amazon.rdsdataservice#InternalServerErrorException" ,
321
325
$name : "InternalServerErrorException" ,
322
326
$fault : "server"
323
327
} ) ;
324
328
325
329
const serviceUnavailableErrorDeserialize = (
326
- input : any
330
+ input : any ,
331
+ utils : DeserializerUtils
327
332
) : ServiceUnavailableError => ( {
328
333
__type : "com.amazon.rdsdataservice#ServiceUnavailableError" ,
329
334
$name : "ServiceUnavailableError" ,
@@ -336,17 +341,8 @@ const deserializeMetadata = (output: HttpResponse): ResponseMetadata => ({
336
341
requestId : output . headers [ "x-amzn-requestid" ]
337
342
} ) ;
338
343
339
- const parseBody = ( streamBody : any , utils ?: Utils ) : any => {
340
- const streamCollector =
341
- utils && utils [ "streamCollector" ]
342
- ? ( < DeserializerUtils > utils ) [ "streamCollector" ]
343
- : __aws_sdk_stream_collector_node . streamCollector ;
344
- const toUtf8 =
345
- utils && utils [ "streamCollector" ]
346
- ? ( < DeserializerUtils > utils ) [ "utf8Encoder" ]
347
- : __aws_sdk_util_utf8_node . toUtf8 ;
348
-
349
- return streamCollector ( streamBody ) . then ( body => {
350
- return JSON . parse ( toUtf8 ( body ) ) ;
344
+ const parseBody = ( streamBody : any , utils : DeserializerUtils ) : any => {
345
+ return utils . streamCollector ( streamBody ) . then ( body => {
346
+ return JSON . parse ( utils . utf8Encoder ( body ) ) ;
351
347
} ) ;
352
348
} ;
0 commit comments