-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
clients/node/client-rds-data-node/protocol/AwsRestJson1_1Serializers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Field, SqlParameter } from "../models/com/amazon/rdsdataservice"; | ||
|
||
export function SqlParameterListAwsRestJson1_1Serialize( | ||
input: Array<SqlParameter> | ||
): Array<SqlParameter> { | ||
let list: Array<SqlParameter> = []; | ||
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, {}); | ||
} |
67 changes: 67 additions & 0 deletions
67
clients/node/client-rds-data-node/protocol/ExecuteStatementSerializer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
}; | ||
} |