|
| 1 | +import { HttpRequest } from "@aws-sdk/types"; |
| 2 | +import { ExecuteStatementRequest } from "../models/com/amazon/rdsdataservice"; |
| 3 | +import { SqlParameterListAwsRestJson1_1Serialize } from "./AwsRestJson1_1Serializers"; |
| 4 | + |
| 5 | +export function ExecuteStatementSerializer( |
| 6 | + input: ExecuteStatementRequest, |
| 7 | + protocol: string |
| 8 | +): HttpRequest { |
| 9 | + switch (protocol) { |
| 10 | + case "aws.rest-json-1.1": |
| 11 | + return ExecuteStatementAwsRestJson1_1Serialize(input); |
| 12 | + default: |
| 13 | + throw new Error("Unknown protocol, use aws.rest-json-1.1"); |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +function ExecuteStatementAwsRestJson1_1Serialize( |
| 18 | + input: ExecuteStatementRequest |
| 19 | +): HttpRequest { |
| 20 | + let body: any = {}; |
| 21 | + if (input.resourceArn) { |
| 22 | + body.resourceArn = input.resourceArn; |
| 23 | + } |
| 24 | + |
| 25 | + if (input.secretArn) { |
| 26 | + body.secretArn = input.secretArn; |
| 27 | + } |
| 28 | + |
| 29 | + if (input.sql) { |
| 30 | + body.sql = input.sql; |
| 31 | + } |
| 32 | + |
| 33 | + if (input.database) { |
| 34 | + body.database = input.database; |
| 35 | + } |
| 36 | + |
| 37 | + if (input.schema) { |
| 38 | + body.schema = input.schema; |
| 39 | + } |
| 40 | + |
| 41 | + if (input.parameters) { |
| 42 | + body.parameters = SqlParameterListAwsRestJson1_1Serialize(input.parameters); |
| 43 | + } |
| 44 | + |
| 45 | + if (input.transactionId) { |
| 46 | + body.transactionId = input.transactionId; |
| 47 | + } |
| 48 | + |
| 49 | + if (input.includeResultMetadata) { |
| 50 | + body.includeResultMetadata = input.includeResultMetadata; |
| 51 | + } |
| 52 | + |
| 53 | + if (input.continueAfterTimeout) { |
| 54 | + body.continueAfterTimeout = input.continueAfterTimeout; |
| 55 | + } |
| 56 | + |
| 57 | + return { |
| 58 | + method: "POST", |
| 59 | + hostname: "rdsdataservice.us-east-1.amazonaws.com", |
| 60 | + path: "/execute", |
| 61 | + protocol: "https:", |
| 62 | + body: JSON.stringify(body), |
| 63 | + headers: { |
| 64 | + "Content-Type": "application/json" |
| 65 | + } |
| 66 | + }; |
| 67 | +} |
0 commit comments