@@ -20,6 +20,7 @@ import {
20
20
EndpointWithHostLabelOperationCommandOutput ,
21
21
} from "../commands/EndpointWithHostLabelOperationCommand" ;
22
22
import { GreetingWithErrorsCommandInput , GreetingWithErrorsCommandOutput } from "../commands/GreetingWithErrorsCommand" ;
23
+ import { HttpEnumPayloadCommandInput , HttpEnumPayloadCommandOutput } from "../commands/HttpEnumPayloadCommand" ;
23
24
import { HttpPayloadTraitsCommandInput , HttpPayloadTraitsCommandOutput } from "../commands/HttpPayloadTraitsCommand" ;
24
25
import {
25
26
HttpPayloadTraitsWithMediaTypeCommandInput ,
@@ -47,6 +48,7 @@ import {
47
48
HttpRequestWithLabelsCommandOutput ,
48
49
} from "../commands/HttpRequestWithLabelsCommand" ;
49
50
import { HttpResponseCodeCommandInput , HttpResponseCodeCommandOutput } from "../commands/HttpResponseCodeCommand" ;
51
+ import { HttpStringPayloadCommandInput , HttpStringPayloadCommandOutput } from "../commands/HttpStringPayloadCommand" ;
50
52
import {
51
53
IgnoreQueryParamsInResponseCommandInput ,
52
54
IgnoreQueryParamsInResponseCommandOutput ,
@@ -364,6 +366,30 @@ export const serializeAws_restJson1GreetingWithErrorsCommand = async (
364
366
} ) ;
365
367
} ;
366
368
369
+ export const serializeAws_restJson1HttpEnumPayloadCommand = async (
370
+ input : HttpEnumPayloadCommandInput ,
371
+ context : __SerdeContext
372
+ ) : Promise < __HttpRequest > => {
373
+ const headers : any = {
374
+ "content-type" : "text/plain" ,
375
+ } ;
376
+ let resolvedPath = "/EnumPayload" ;
377
+ let body : any ;
378
+ if ( input . payload !== undefined ) {
379
+ body = input . payload ;
380
+ }
381
+ const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
382
+ return new __HttpRequest ( {
383
+ protocol,
384
+ hostname,
385
+ port,
386
+ method : "POST" ,
387
+ headers,
388
+ path : resolvedPath ,
389
+ body,
390
+ } ) ;
391
+ } ;
392
+
367
393
export const serializeAws_restJson1HttpPayloadTraitsCommand = async (
368
394
input : HttpPayloadTraitsCommandInput ,
369
395
context : __SerdeContext
@@ -728,6 +754,30 @@ export const serializeAws_restJson1HttpResponseCodeCommand = async (
728
754
} ) ;
729
755
} ;
730
756
757
+ export const serializeAws_restJson1HttpStringPayloadCommand = async (
758
+ input : HttpStringPayloadCommandInput ,
759
+ context : __SerdeContext
760
+ ) : Promise < __HttpRequest > => {
761
+ const headers : any = {
762
+ "content-type" : "text/plain" ,
763
+ } ;
764
+ let resolvedPath = "/StringPayload" ;
765
+ let body : any ;
766
+ if ( input . payload !== undefined ) {
767
+ body = input . payload ;
768
+ }
769
+ const { hostname, protocol = "https" , port } = await context . endpoint ( ) ;
770
+ return new __HttpRequest ( {
771
+ protocol,
772
+ hostname,
773
+ port,
774
+ method : "POST" ,
775
+ headers,
776
+ path : resolvedPath ,
777
+ body,
778
+ } ) ;
779
+ } ;
780
+
731
781
export const serializeAws_restJson1IgnoreQueryParamsInResponseCommand = async (
732
782
input : IgnoreQueryParamsInResponseCommandInput ,
733
783
context : __SerdeContext
@@ -1782,6 +1832,51 @@ const deserializeAws_restJson1GreetingWithErrorsCommandError = async (
1782
1832
return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ;
1783
1833
} ;
1784
1834
1835
+ export const deserializeAws_restJson1HttpEnumPayloadCommand = async (
1836
+ output : __HttpResponse ,
1837
+ context : __SerdeContext
1838
+ ) : Promise < HttpEnumPayloadCommandOutput > => {
1839
+ if ( output . statusCode !== 200 && output . statusCode >= 300 ) {
1840
+ return deserializeAws_restJson1HttpEnumPayloadCommandError ( output , context ) ;
1841
+ }
1842
+ const contents : HttpEnumPayloadCommandOutput = {
1843
+ $metadata : deserializeMetadata ( output ) ,
1844
+ payload : undefined ,
1845
+ } ;
1846
+ const data : any = await collectBodyString ( output . body , context ) ;
1847
+ contents . payload = data ;
1848
+ return Promise . resolve ( contents ) ;
1849
+ } ;
1850
+
1851
+ const deserializeAws_restJson1HttpEnumPayloadCommandError = async (
1852
+ output : __HttpResponse ,
1853
+ context : __SerdeContext
1854
+ ) : Promise < HttpEnumPayloadCommandOutput > => {
1855
+ const parsedOutput : any = {
1856
+ ...output ,
1857
+ body : await parseBody ( output . body , context ) ,
1858
+ } ;
1859
+ let response : __SmithyException & __MetadataBearer & { [ key : string ] : any } ;
1860
+ let errorCode : string = "UnknownError" ;
1861
+ errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ;
1862
+ switch ( errorCode ) {
1863
+ default :
1864
+ const parsedBody = parsedOutput . body ;
1865
+ errorCode = parsedBody . code || parsedBody . Code || errorCode ;
1866
+ response = {
1867
+ ...parsedBody ,
1868
+ name : `${ errorCode } ` ,
1869
+ message : parsedBody . message || parsedBody . Message || errorCode ,
1870
+ $fault : "client" ,
1871
+ $metadata : deserializeMetadata ( output ) ,
1872
+ } as any ;
1873
+ }
1874
+ const message = response . message || response . Message || errorCode ;
1875
+ response . message = message ;
1876
+ delete response . Message ;
1877
+ return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ;
1878
+ } ;
1879
+
1785
1880
export const deserializeAws_restJson1HttpPayloadTraitsCommand = async (
1786
1881
output : __HttpResponse ,
1787
1882
context : __SerdeContext
@@ -2209,6 +2304,51 @@ const deserializeAws_restJson1HttpResponseCodeCommandError = async (
2209
2304
return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ;
2210
2305
} ;
2211
2306
2307
+ export const deserializeAws_restJson1HttpStringPayloadCommand = async (
2308
+ output : __HttpResponse ,
2309
+ context : __SerdeContext
2310
+ ) : Promise < HttpStringPayloadCommandOutput > => {
2311
+ if ( output . statusCode !== 200 && output . statusCode >= 300 ) {
2312
+ return deserializeAws_restJson1HttpStringPayloadCommandError ( output , context ) ;
2313
+ }
2314
+ const contents : HttpStringPayloadCommandOutput = {
2315
+ $metadata : deserializeMetadata ( output ) ,
2316
+ payload : undefined ,
2317
+ } ;
2318
+ const data : any = await collectBodyString ( output . body , context ) ;
2319
+ contents . payload = data ;
2320
+ return Promise . resolve ( contents ) ;
2321
+ } ;
2322
+
2323
+ const deserializeAws_restJson1HttpStringPayloadCommandError = async (
2324
+ output : __HttpResponse ,
2325
+ context : __SerdeContext
2326
+ ) : Promise < HttpStringPayloadCommandOutput > => {
2327
+ const parsedOutput : any = {
2328
+ ...output ,
2329
+ body : await parseBody ( output . body , context ) ,
2330
+ } ;
2331
+ let response : __SmithyException & __MetadataBearer & { [ key : string ] : any } ;
2332
+ let errorCode : string = "UnknownError" ;
2333
+ errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ;
2334
+ switch ( errorCode ) {
2335
+ default :
2336
+ const parsedBody = parsedOutput . body ;
2337
+ errorCode = parsedBody . code || parsedBody . Code || errorCode ;
2338
+ response = {
2339
+ ...parsedBody ,
2340
+ name : `${ errorCode } ` ,
2341
+ message : parsedBody . message || parsedBody . Message || errorCode ,
2342
+ $fault : "client" ,
2343
+ $metadata : deserializeMetadata ( output ) ,
2344
+ } as any ;
2345
+ }
2346
+ const message = response . message || response . Message || errorCode ;
2347
+ response . message = message ;
2348
+ delete response . Message ;
2349
+ return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ;
2350
+ } ;
2351
+
2212
2352
export const deserializeAws_restJson1IgnoreQueryParamsInResponseCommand = async (
2213
2353
output : __HttpResponse ,
2214
2354
context : __SerdeContext
0 commit comments