diff --git a/clients/client-transcribe-streaming/src/TranscribeStreamingClient.ts b/clients/client-transcribe-streaming/src/TranscribeStreamingClient.ts index 56755f50a477..f72b683dafa9 100644 --- a/clients/client-transcribe-streaming/src/TranscribeStreamingClient.ts +++ b/clients/client-transcribe-streaming/src/TranscribeStreamingClient.ts @@ -12,7 +12,6 @@ import { } from "@aws-sdk/middleware-host-header"; import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection"; -import { getTranscribeStreamingPlugin } from "@aws-sdk/middleware-sdk-transcribe-streaming"; import { getUserAgentPlugin, resolveUserAgentConfig, @@ -361,7 +360,6 @@ export class TranscribeStreamingClient extends __Client< }), }) ); - this.middlewareStack.use(getTranscribeStreamingPlugin(this.config)); this.middlewareStack.use(getHttpSigningPlugin(this.config)); } diff --git a/clients/client-transcribe-streaming/src/commands/StartCallAnalyticsStreamTranscriptionCommand.ts b/clients/client-transcribe-streaming/src/commands/StartCallAnalyticsStreamTranscriptionCommand.ts index c86000954e9a..bde4511fd55f 100644 --- a/clients/client-transcribe-streaming/src/commands/StartCallAnalyticsStreamTranscriptionCommand.ts +++ b/clients/client-transcribe-streaming/src/commands/StartCallAnalyticsStreamTranscriptionCommand.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream"; +import { getTranscribeStreamingPlugin } from "@aws-sdk/middleware-sdk-transcribe-streaming"; import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket"; import { getEndpointPlugin } from "@smithy/middleware-endpoint"; import { getSerdePlugin } from "@smithy/middleware-serde"; @@ -248,6 +249,7 @@ export class StartCallAnalyticsStreamTranscriptionCommand extends $Command getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-", }), + getTranscribeStreamingPlugin(config), ]; }) .s("Transcribe", "StartCallAnalyticsStreamTranscription", { diff --git a/clients/client-transcribe-streaming/src/commands/StartMedicalStreamTranscriptionCommand.ts b/clients/client-transcribe-streaming/src/commands/StartMedicalStreamTranscriptionCommand.ts index 141cad5dc81a..b55896d637fa 100644 --- a/clients/client-transcribe-streaming/src/commands/StartMedicalStreamTranscriptionCommand.ts +++ b/clients/client-transcribe-streaming/src/commands/StartMedicalStreamTranscriptionCommand.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream"; +import { getTranscribeStreamingPlugin } from "@aws-sdk/middleware-sdk-transcribe-streaming"; import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket"; import { getEndpointPlugin } from "@smithy/middleware-endpoint"; import { getSerdePlugin } from "@smithy/middleware-serde"; @@ -229,6 +230,7 @@ export class StartMedicalStreamTranscriptionCommand extends $Command getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-", }), + getTranscribeStreamingPlugin(config), ]; }) .s("Transcribe", "StartMedicalStreamTranscription", { diff --git a/clients/client-transcribe-streaming/src/commands/StartStreamTranscriptionCommand.ts b/clients/client-transcribe-streaming/src/commands/StartStreamTranscriptionCommand.ts index e04efbdafb6f..3f2185eb96ae 100644 --- a/clients/client-transcribe-streaming/src/commands/StartStreamTranscriptionCommand.ts +++ b/clients/client-transcribe-streaming/src/commands/StartStreamTranscriptionCommand.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream"; +import { getTranscribeStreamingPlugin } from "@aws-sdk/middleware-sdk-transcribe-streaming"; import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket"; import { getEndpointPlugin } from "@smithy/middleware-endpoint"; import { getSerdePlugin } from "@smithy/middleware-serde"; @@ -253,6 +254,7 @@ export class StartStreamTranscriptionCommand extends $Command getWebSocketPlugin(config, { headerPrefix: "x-amzn-transcribe-", }), + getTranscribeStreamingPlugin(config), ]; }) .s("Transcribe", "StartStreamTranscription", { diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java index f427d183de36..1c6a3fd819ac 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTranscribeStreamingDependency.java @@ -22,6 +22,8 @@ import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.codegen.core.SymbolProvider; import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.knowledge.EventStreamIndex; +import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.typescript.codegen.LanguageTarget; import software.amazon.smithy.typescript.codegen.TypeScriptSettings; @@ -54,7 +56,7 @@ public List getClientPlugins() { RuntimeClientPlugin.builder() .withConventions(AwsDependency.TRANSCRIBE_STREAMING_MIDDLEWARE.dependency, "TranscribeStreaming", RuntimeClientPlugin.Convention.HAS_MIDDLEWARE) - .servicePredicate((m, s) -> isTranscribeStreaming(s)) + .operationPredicate((m, s, o) -> isTranscribeStreaming(s) && hasEventStreamInput(m, s, o)) .build() ); } @@ -92,6 +94,11 @@ private static boolean isTranscribeStreaming(ServiceShape service) { String serviceId = service.getTrait(ServiceTrait.class).map(ServiceTrait::getSdkId).orElse(""); return serviceId.equals("Transcribe Streaming"); } + + private static boolean hasEventStreamInput(Model model, ServiceShape service, OperationShape operation) { + EventStreamIndex eventStreamIndex = EventStreamIndex.of(model); + return eventStreamIndex.getInputInfo(operation).isPresent(); + } }