Skip to content

fix: use generated types in commands #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs update when the tagged union is generated


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