Skip to content

Commit

Permalink
fix: use generated types in commands (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell authored and trivikr committed Jan 3, 2020
1 parent 29f3f54 commit 26068a4
Showing 1 changed file with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
import { Command } from '@aws-sdk/smithy-client';
import { Command } from "@aws-sdk/smithy-client";
import { serializerPlugin } from "@aws-sdk/middleware-serializer";
import { deserializerPlugin } from "@aws-sdk/middleware-deserializer";
import * as __aws_sdk_types from "@aws-sdk/types";
import { RDSDataResolvedConfiguration } from "../RDSDataConfiguration";
import { HttpRequest } from '@aws-sdk/protocol-http';
import { executeStatementSerializer, executeStatementDeserializer } from '../protocol/ExecuteStatement'
import { FinalizeHandlerArguments, MiddlewareStack } from '@aws-sdk/types';
import { HttpRequest } from "@aws-sdk/protocol-http";
import {
executeStatementSerializer,
executeStatementDeserializer
} from "../protocol/ExecuteStatement";
import { FinalizeHandlerArguments, MiddlewareStack } from "@aws-sdk/types";
import {
ExecuteStatementRequest,
ExecuteStatementResponse
} from "../models/rdsdataservice";

/**
* To remove this when move to Smithy model
*/
type ExecuteStatementInput = any;
type ExecuteStatementOutput = any;
type InputTypesUnion = any;
type OutputTypesUnion = any;

export class ExecuteStatementCommand extends Command<ExecuteStatementInput, ExecuteStatementOutput> {

constructor(readonly input: ExecuteStatementInput) {
export class ExecuteStatementCommand extends Command<
ExecuteStatementRequest,
ExecuteStatementResponse
> {
constructor(readonly input: ExecuteStatementRequest) {
super();
}

resolveMiddleware(
clientStack: MiddlewareStack<
InputTypesUnion,
OutputTypesUnion
>,
clientStack: MiddlewareStack<InputTypesUnion, OutputTypesUnion>,
configuration: RDSDataResolvedConfiguration,
options?: __aws_sdk_types.HttpOptions
): __aws_sdk_types.Handler<ExecuteStatementInput, ExecuteStatementOutput> {
): __aws_sdk_types.Handler<
ExecuteStatementRequest,
ExecuteStatementResponse
> {
const { httpHandler } = configuration;

this.use(serializerPlugin(configuration, executeStatementSerializer));
this.use(deserializerPlugin<ExecuteStatementOutput>(configuration, executeStatementDeserializer));
this.use(
deserializerPlugin<ExecuteStatementResponse>(
configuration,
executeStatementDeserializer
)
);

const stack = clientStack.concat(this.middlewareStack);

Expand All @@ -41,7 +50,8 @@ export class ExecuteStatementCommand extends Command<ExecuteStatementInput, Exec
};

return stack.resolve(
(request: FinalizeHandlerArguments<any>) => httpHandler.handle(request.request as HttpRequest, options || {}),
(request: FinalizeHandlerArguments<any>) =>
httpHandler.handle(request.request as HttpRequest, options || {}),
handlerExecutionContext
);
}
Expand Down

0 comments on commit 26068a4

Please sign in to comment.