diff --git a/clients/node/client-rds-data-node/protocol/AwsRestJson1_1Serializers.ts b/clients/node/client-rds-data-node/protocol/AwsRestJson1_1Serializers.ts new file mode 100644 index 000000000000..d9134a6d1be1 --- /dev/null +++ b/clients/node/client-rds-data-node/protocol/AwsRestJson1_1Serializers.ts @@ -0,0 +1,22 @@ +import { Field, SqlParameter } from "../models/com/amazon/rdsdataservice"; + +export function SqlParameterListAwsRestJson1_1Serialize( + input: Array +): Array { + let list: Array = []; + for (let SqlParameter of input) { + list.push(SqlParameterAwsRestJson1_1Serialize(SqlParameter)); + } + return list; +} + +export function SqlParameterAwsRestJson1_1Serialize(input: SqlParameter): any { + return { + name: input.name, + value: FieldAwsRestJson1_1Serialize(input.value) + }; +} + +export function FieldAwsRestJson1_1Serialize(input: Field): any { + return input.visit(input, {}); +} diff --git a/clients/node/client-rds-data-node/protocol/ExecuteStatementSerializer.ts b/clients/node/client-rds-data-node/protocol/ExecuteStatementSerializer.ts new file mode 100644 index 000000000000..46ed1d1e31d7 --- /dev/null +++ b/clients/node/client-rds-data-node/protocol/ExecuteStatementSerializer.ts @@ -0,0 +1,67 @@ +import { HttpRequest } from "@aws-sdk/types"; +import { ExecuteStatementRequest } from "../models/com/amazon/rdsdataservice"; +import { SqlParameterListAwsRestJson1_1Serialize } from "./AwsRestJson1_1Serializers"; + +export function ExecuteStatementSerializer( + input: ExecuteStatementRequest, + protocol: string +): HttpRequest { + switch (protocol) { + case "aws.rest-json-1.1": + return ExecuteStatementAwsRestJson1_1Serialize(input); + default: + throw new Error("Unknown protocol, use aws.rest-json-1.1"); + } +} + +function ExecuteStatementAwsRestJson1_1Serialize( + input: ExecuteStatementRequest +): HttpRequest { + let body: any = {}; + if (input.resourceArn) { + body.resourceArn = input.resourceArn; + } + + if (input.secretArn) { + body.secretArn = input.secretArn; + } + + if (input.sql) { + body.sql = input.sql; + } + + if (input.database) { + body.database = input.database; + } + + if (input.schema) { + body.schema = input.schema; + } + + if (input.parameters) { + body.parameters = SqlParameterListAwsRestJson1_1Serialize(input.parameters); + } + + if (input.transactionId) { + body.transactionId = input.transactionId; + } + + if (input.includeResultMetadata) { + body.includeResultMetadata = input.includeResultMetadata; + } + + if (input.continueAfterTimeout) { + body.continueAfterTimeout = input.continueAfterTimeout; + } + + return { + method: "POST", + hostname: "rdsdataservice.us-east-1.amazonaws.com", + path: "/execute", + protocol: "https:", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json" + } + }; +}