|
| 1 | +import { RDSDataClient } from "./RDSDataClient"; |
| 2 | +import { |
| 3 | + BatchExecuteStatementCommand, |
| 4 | + BatchExecuteStatementCommandInput, |
| 5 | + BatchExecuteStatementCommandOutput, |
| 6 | +} from "./commands/BatchExecuteStatementCommand"; |
| 7 | +import { |
| 8 | + BeginTransactionCommand, |
| 9 | + BeginTransactionCommandInput, |
| 10 | + BeginTransactionCommandOutput, |
| 11 | +} from "./commands/BeginTransactionCommand"; |
| 12 | +import { |
| 13 | + CommitTransactionCommand, |
| 14 | + CommitTransactionCommandInput, |
| 15 | + CommitTransactionCommandOutput, |
| 16 | +} from "./commands/CommitTransactionCommand"; |
| 17 | +import { |
| 18 | + ExecuteSqlCommand, |
| 19 | + ExecuteSqlCommandInput, |
| 20 | + ExecuteSqlCommandOutput, |
| 21 | +} from "./commands/ExecuteSqlCommand"; |
| 22 | +import { |
| 23 | + ExecuteStatementCommand, |
| 24 | + ExecuteStatementCommandInput, |
| 25 | + ExecuteStatementCommandOutput, |
| 26 | +} from "./commands/ExecuteStatementCommand"; |
| 27 | +import { |
| 28 | + RollbackTransactionCommand, |
| 29 | + RollbackTransactionCommandInput, |
| 30 | + RollbackTransactionCommandOutput, |
| 31 | +} from "./commands/RollbackTransactionCommand"; |
| 32 | +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; |
| 33 | + |
| 34 | +/** |
| 35 | + * <fullname>Amazon RDS Data Service</fullname> |
| 36 | + * <p>Amazon RDS provides an HTTP endpoint to run SQL statements on an Amazon Aurora |
| 37 | + * Serverless DB cluster. To run these statements, you work with the Data Service |
| 38 | + * API.</p> |
| 39 | + * <p>For more information about the Data Service API, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html">Using the Data API for Aurora |
| 40 | + * Serverless</a> in the <i>Amazon Aurora User Guide</i>.</p> |
| 41 | + * <note> |
| 42 | + * <p>If you have questions or comments related to the Data API, send email to |
| 43 | + |
| 44 | + * </note> |
| 45 | + */ |
| 46 | +export class RDSData extends RDSDataClient { |
| 47 | + /** |
| 48 | + * <p>Runs one or more SQL statements.</p> |
| 49 | + * <important> |
| 50 | + * <p>This operation is deprecated. Use the <code>BatchExecuteStatement</code> or |
| 51 | + * <code>ExecuteStatement</code> operation.</p> |
| 52 | + * </important> |
| 53 | + */ |
| 54 | + public executeSql( |
| 55 | + args: ExecuteSqlCommandInput, |
| 56 | + options?: __HttpHandlerOptions, |
| 57 | + ): Promise<ExecuteSqlCommandOutput>; |
| 58 | + public executeSql( |
| 59 | + args: ExecuteSqlCommandInput, |
| 60 | + cb: (err: any, data?: ExecuteSqlCommandOutput) => void |
| 61 | + ): void; |
| 62 | + public executeSql( |
| 63 | + args: ExecuteSqlCommandInput, |
| 64 | + options: __HttpHandlerOptions, |
| 65 | + cb: (err: any, data?: ExecuteSqlCommandOutput) => void |
| 66 | + ): void; |
| 67 | + public executeSql( |
| 68 | + args: ExecuteSqlCommandInput, |
| 69 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ExecuteSqlCommandOutput) => void), |
| 70 | + cb?: (err: any, data?: ExecuteSqlCommandOutput) => void |
| 71 | + ): Promise<ExecuteSqlCommandOutput> | void { |
| 72 | + const command = new ExecuteSqlCommand(args); |
| 73 | + if (typeof optionsOrCb === "function") { |
| 74 | + this.send(command, optionsOrCb) |
| 75 | + } else if (typeof cb === "function") { |
| 76 | + if (typeof optionsOrCb !== "object") |
| 77 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 78 | + this.send(command, optionsOrCb || {}, cb) |
| 79 | + } else { |
| 80 | + return this.send(command, optionsOrCb); |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * <p>Performs a rollback of a transaction. Rolling back a transaction cancels its changes.</p> |
| 86 | + */ |
| 87 | + public rollbackTransaction( |
| 88 | + args: RollbackTransactionCommandInput, |
| 89 | + options?: __HttpHandlerOptions, |
| 90 | + ): Promise<RollbackTransactionCommandOutput>; |
| 91 | + public rollbackTransaction( |
| 92 | + args: RollbackTransactionCommandInput, |
| 93 | + cb: (err: any, data?: RollbackTransactionCommandOutput) => void |
| 94 | + ): void; |
| 95 | + public rollbackTransaction( |
| 96 | + args: RollbackTransactionCommandInput, |
| 97 | + options: __HttpHandlerOptions, |
| 98 | + cb: (err: any, data?: RollbackTransactionCommandOutput) => void |
| 99 | + ): void; |
| 100 | + public rollbackTransaction( |
| 101 | + args: RollbackTransactionCommandInput, |
| 102 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RollbackTransactionCommandOutput) => void), |
| 103 | + cb?: (err: any, data?: RollbackTransactionCommandOutput) => void |
| 104 | + ): Promise<RollbackTransactionCommandOutput> | void { |
| 105 | + const command = new RollbackTransactionCommand(args); |
| 106 | + if (typeof optionsOrCb === "function") { |
| 107 | + this.send(command, optionsOrCb) |
| 108 | + } else if (typeof cb === "function") { |
| 109 | + if (typeof optionsOrCb !== "object") |
| 110 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 111 | + this.send(command, optionsOrCb || {}, cb) |
| 112 | + } else { |
| 113 | + return this.send(command, optionsOrCb); |
| 114 | + } |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * <p>Runs a batch SQL statement over an array of data.</p> |
| 119 | + * <p>You can run bulk update and insert operations for multiple records using a DML |
| 120 | + * statement with different parameter sets. Bulk operations can provide a significant |
| 121 | + * performance improvement over individual insert and update operations.</p> |
| 122 | + * <important> |
| 123 | + * <p>If a call isn't part of a transaction because it doesn't include the |
| 124 | + * <code>transactionID</code> parameter, changes that result from the call are |
| 125 | + * committed automatically.</p> |
| 126 | + * </important> |
| 127 | + */ |
| 128 | + public batchExecuteStatement( |
| 129 | + args: BatchExecuteStatementCommandInput, |
| 130 | + options?: __HttpHandlerOptions, |
| 131 | + ): Promise<BatchExecuteStatementCommandOutput>; |
| 132 | + public batchExecuteStatement( |
| 133 | + args: BatchExecuteStatementCommandInput, |
| 134 | + cb: (err: any, data?: BatchExecuteStatementCommandOutput) => void |
| 135 | + ): void; |
| 136 | + public batchExecuteStatement( |
| 137 | + args: BatchExecuteStatementCommandInput, |
| 138 | + options: __HttpHandlerOptions, |
| 139 | + cb: (err: any, data?: BatchExecuteStatementCommandOutput) => void |
| 140 | + ): void; |
| 141 | + public batchExecuteStatement( |
| 142 | + args: BatchExecuteStatementCommandInput, |
| 143 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchExecuteStatementCommandOutput) => void), |
| 144 | + cb?: (err: any, data?: BatchExecuteStatementCommandOutput) => void |
| 145 | + ): Promise<BatchExecuteStatementCommandOutput> | void { |
| 146 | + const command = new BatchExecuteStatementCommand(args); |
| 147 | + if (typeof optionsOrCb === "function") { |
| 148 | + this.send(command, optionsOrCb) |
| 149 | + } else if (typeof cb === "function") { |
| 150 | + if (typeof optionsOrCb !== "object") |
| 151 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 152 | + this.send(command, optionsOrCb || {}, cb) |
| 153 | + } else { |
| 154 | + return this.send(command, optionsOrCb); |
| 155 | + } |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * <p>Runs a SQL statement against a database.</p> |
| 160 | + * <important> |
| 161 | + * <p>If a call isn't part of a transaction because it doesn't include the |
| 162 | + * <code>transactionID</code> parameter, changes that result from the call are |
| 163 | + * committed automatically.</p> |
| 164 | + * </important> |
| 165 | + * <p>The response size limit is 1 MB or 1,000 records. If the call returns more than 1 MB of response data or over 1,000 records, the call is terminated.</p> |
| 166 | + */ |
| 167 | + public executeStatement( |
| 168 | + args: ExecuteStatementCommandInput, |
| 169 | + options?: __HttpHandlerOptions, |
| 170 | + ): Promise<ExecuteStatementCommandOutput>; |
| 171 | + public executeStatement( |
| 172 | + args: ExecuteStatementCommandInput, |
| 173 | + cb: (err: any, data?: ExecuteStatementCommandOutput) => void |
| 174 | + ): void; |
| 175 | + public executeStatement( |
| 176 | + args: ExecuteStatementCommandInput, |
| 177 | + options: __HttpHandlerOptions, |
| 178 | + cb: (err: any, data?: ExecuteStatementCommandOutput) => void |
| 179 | + ): void; |
| 180 | + public executeStatement( |
| 181 | + args: ExecuteStatementCommandInput, |
| 182 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ExecuteStatementCommandOutput) => void), |
| 183 | + cb?: (err: any, data?: ExecuteStatementCommandOutput) => void |
| 184 | + ): Promise<ExecuteStatementCommandOutput> | void { |
| 185 | + const command = new ExecuteStatementCommand(args); |
| 186 | + if (typeof optionsOrCb === "function") { |
| 187 | + this.send(command, optionsOrCb) |
| 188 | + } else if (typeof cb === "function") { |
| 189 | + if (typeof optionsOrCb !== "object") |
| 190 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 191 | + this.send(command, optionsOrCb || {}, cb) |
| 192 | + } else { |
| 193 | + return this.send(command, optionsOrCb); |
| 194 | + } |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * <p>Starts a SQL transaction.</p> |
| 199 | + * |
| 200 | + * <important> |
| 201 | + * <p>A transaction can run for a maximum of 24 hours. A transaction is terminated and |
| 202 | + * rolled back automatically after 24 hours.</p> |
| 203 | + * <p>A transaction times out if no calls use its transaction ID in three minutes. |
| 204 | + * If a transaction times out before it's committed, it's rolled back |
| 205 | + * automatically.</p> |
| 206 | + * <p>DDL statements inside a transaction cause an implicit commit. We recommend |
| 207 | + * that you run each DDL statement in a separate <code>ExecuteStatement</code> call with |
| 208 | + * <code>continueAfterTimeout</code> enabled.</p> |
| 209 | + * </important> |
| 210 | + */ |
| 211 | + public beginTransaction( |
| 212 | + args: BeginTransactionCommandInput, |
| 213 | + options?: __HttpHandlerOptions, |
| 214 | + ): Promise<BeginTransactionCommandOutput>; |
| 215 | + public beginTransaction( |
| 216 | + args: BeginTransactionCommandInput, |
| 217 | + cb: (err: any, data?: BeginTransactionCommandOutput) => void |
| 218 | + ): void; |
| 219 | + public beginTransaction( |
| 220 | + args: BeginTransactionCommandInput, |
| 221 | + options: __HttpHandlerOptions, |
| 222 | + cb: (err: any, data?: BeginTransactionCommandOutput) => void |
| 223 | + ): void; |
| 224 | + public beginTransaction( |
| 225 | + args: BeginTransactionCommandInput, |
| 226 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BeginTransactionCommandOutput) => void), |
| 227 | + cb?: (err: any, data?: BeginTransactionCommandOutput) => void |
| 228 | + ): Promise<BeginTransactionCommandOutput> | void { |
| 229 | + const command = new BeginTransactionCommand(args); |
| 230 | + if (typeof optionsOrCb === "function") { |
| 231 | + this.send(command, optionsOrCb) |
| 232 | + } else if (typeof cb === "function") { |
| 233 | + if (typeof optionsOrCb !== "object") |
| 234 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 235 | + this.send(command, optionsOrCb || {}, cb) |
| 236 | + } else { |
| 237 | + return this.send(command, optionsOrCb); |
| 238 | + } |
| 239 | + } |
| 240 | + |
| 241 | + /** |
| 242 | + * <p>Ends a SQL transaction started with the <code>BeginTransaction</code> operation and |
| 243 | + * commits the changes.</p> |
| 244 | + */ |
| 245 | + public commitTransaction( |
| 246 | + args: CommitTransactionCommandInput, |
| 247 | + options?: __HttpHandlerOptions, |
| 248 | + ): Promise<CommitTransactionCommandOutput>; |
| 249 | + public commitTransaction( |
| 250 | + args: CommitTransactionCommandInput, |
| 251 | + cb: (err: any, data?: CommitTransactionCommandOutput) => void |
| 252 | + ): void; |
| 253 | + public commitTransaction( |
| 254 | + args: CommitTransactionCommandInput, |
| 255 | + options: __HttpHandlerOptions, |
| 256 | + cb: (err: any, data?: CommitTransactionCommandOutput) => void |
| 257 | + ): void; |
| 258 | + public commitTransaction( |
| 259 | + args: CommitTransactionCommandInput, |
| 260 | + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CommitTransactionCommandOutput) => void), |
| 261 | + cb?: (err: any, data?: CommitTransactionCommandOutput) => void |
| 262 | + ): Promise<CommitTransactionCommandOutput> | void { |
| 263 | + const command = new CommitTransactionCommand(args); |
| 264 | + if (typeof optionsOrCb === "function") { |
| 265 | + this.send(command, optionsOrCb) |
| 266 | + } else if (typeof cb === "function") { |
| 267 | + if (typeof optionsOrCb !== "object") |
| 268 | + throw new Error(`Expect http options but get ${typeof optionsOrCb}`) |
| 269 | + this.send(command, optionsOrCb || {}, cb) |
| 270 | + } else { |
| 271 | + return this.send(command, optionsOrCb); |
| 272 | + } |
| 273 | + } |
| 274 | + |
| 275 | +} |
0 commit comments