Skip to content

Commit e29478b

Browse files
Chase Coalwelltrivikr
Chase Coalwell
authored andcommitted
feat: add serializer
1 parent 14728d2 commit e29478b

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Field, SqlParameter } from "../models/com/amazon/rdsdataservice";
2+
3+
export function SqlParameterListAwsRestJson1_1Serialize(
4+
input: Array<SqlParameter>
5+
): Array<SqlParameter> {
6+
let list: Array<SqlParameter> = [];
7+
for (let SqlParameter of input) {
8+
list.push(SqlParameterAwsRestJson1_1Serialize(SqlParameter));
9+
}
10+
return list;
11+
}
12+
13+
export function SqlParameterAwsRestJson1_1Serialize(input: SqlParameter): any {
14+
return {
15+
name: input.name,
16+
value: FieldAwsRestJson1_1Serialize(input.value)
17+
};
18+
}
19+
20+
export function FieldAwsRestJson1_1Serialize(input: Field): any {
21+
return input.visit(input, {});
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Comments
 (0)