Skip to content

Commit 6892bb9

Browse files
authored
fix(client-kinesis): support eventstream in subscribeToShard (#3818)
1 parent 6faf43c commit 6892bb9

File tree

1 file changed

+200
-84
lines changed

1 file changed

+200
-84
lines changed

clients/client-kinesis/src/protocols/Aws_json1_1.ts

Lines changed: 200 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
expectNonNull as __expectNonNull,
99
expectNumber as __expectNumber,
1010
expectString as __expectString,
11-
expectUnion as __expectUnion,
1211
parseEpochTimestamp as __parseEpochTimestamp,
1312
} from "@aws-sdk/smithy-client";
1413
import {
1514
Endpoint as __Endpoint,
15+
EventStreamSerdeContext as __EventStreamSerdeContext,
1616
HeaderBag as __HeaderBag,
1717
ResponseMetadata as __ResponseMetadata,
1818
SerdeContext as __SerdeContext,
@@ -158,7 +158,6 @@ import {
158158
SubscribeToShardEvent,
159159
SubscribeToShardEventStream,
160160
SubscribeToShardInput,
161-
SubscribeToShardOutput,
162161
Tag,
163162
UpdateShardCountInput,
164163
UpdateShardCountOutput,
@@ -1920,14 +1919,12 @@ const deserializeAws_json1_1StopStreamEncryptionCommandError = async (
19201919

19211920
export const deserializeAws_json1_1SubscribeToShardCommand = async (
19221921
output: __HttpResponse,
1923-
context: __SerdeContext
1922+
context: __SerdeContext & __EventStreamSerdeContext
19241923
): Promise<SubscribeToShardCommandOutput> => {
19251924
if (output.statusCode >= 300) {
19261925
return deserializeAws_json1_1SubscribeToShardCommandError(output, context);
19271926
}
1928-
const data: any = await parseBody(output.body, context);
1929-
let contents: any = {};
1930-
contents = deserializeAws_json1_1SubscribeToShardOutput(data, context);
1927+
const contents = { EventStream: deserializeAws_json1_1SubscribeToShardEventStream(output.body, context) };
19311928
const response: SubscribeToShardCommandOutput = {
19321929
$metadata: deserializeMetadata(output),
19331930
...contents,
@@ -2259,6 +2256,203 @@ const deserializeAws_json1_1ValidationExceptionResponse = async (
22592256
return __decorateServiceException(exception, body);
22602257
};
22612258

2259+
const deserializeAws_json1_1SubscribeToShardEventStream = (
2260+
output: any,
2261+
context: __SerdeContext & __EventStreamSerdeContext
2262+
): AsyncIterable<SubscribeToShardEventStream> => {
2263+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
2264+
if (event["SubscribeToShardEvent"] != null) {
2265+
return {
2266+
SubscribeToShardEvent: await deserializeAws_json1_1SubscribeToShardEvent_event(
2267+
event["SubscribeToShardEvent"],
2268+
context
2269+
),
2270+
};
2271+
}
2272+
if (event["ResourceNotFoundException"] != null) {
2273+
return {
2274+
ResourceNotFoundException: await deserializeAws_json1_1ResourceNotFoundException_event(
2275+
event["ResourceNotFoundException"],
2276+
context
2277+
),
2278+
};
2279+
}
2280+
if (event["ResourceInUseException"] != null) {
2281+
return {
2282+
ResourceInUseException: await deserializeAws_json1_1ResourceInUseException_event(
2283+
event["ResourceInUseException"],
2284+
context
2285+
),
2286+
};
2287+
}
2288+
if (event["KMSDisabledException"] != null) {
2289+
return {
2290+
KMSDisabledException: await deserializeAws_json1_1KMSDisabledException_event(
2291+
event["KMSDisabledException"],
2292+
context
2293+
),
2294+
};
2295+
}
2296+
if (event["KMSInvalidStateException"] != null) {
2297+
return {
2298+
KMSInvalidStateException: await deserializeAws_json1_1KMSInvalidStateException_event(
2299+
event["KMSInvalidStateException"],
2300+
context
2301+
),
2302+
};
2303+
}
2304+
if (event["KMSAccessDeniedException"] != null) {
2305+
return {
2306+
KMSAccessDeniedException: await deserializeAws_json1_1KMSAccessDeniedException_event(
2307+
event["KMSAccessDeniedException"],
2308+
context
2309+
),
2310+
};
2311+
}
2312+
if (event["KMSNotFoundException"] != null) {
2313+
return {
2314+
KMSNotFoundException: await deserializeAws_json1_1KMSNotFoundException_event(
2315+
event["KMSNotFoundException"],
2316+
context
2317+
),
2318+
};
2319+
}
2320+
if (event["KMSOptInRequired"] != null) {
2321+
return {
2322+
KMSOptInRequired: await deserializeAws_json1_1KMSOptInRequired_event(event["KMSOptInRequired"], context),
2323+
};
2324+
}
2325+
if (event["KMSThrottlingException"] != null) {
2326+
return {
2327+
KMSThrottlingException: await deserializeAws_json1_1KMSThrottlingException_event(
2328+
event["KMSThrottlingException"],
2329+
context
2330+
),
2331+
};
2332+
}
2333+
if (event["InternalFailureException"] != null) {
2334+
return {
2335+
InternalFailureException: await deserializeAws_json1_1InternalFailureException_event(
2336+
event["InternalFailureException"],
2337+
context
2338+
),
2339+
};
2340+
}
2341+
return { $unknown: output };
2342+
});
2343+
};
2344+
const deserializeAws_json1_1InternalFailureException_event = async (
2345+
output: any,
2346+
context: __SerdeContext
2347+
): Promise<InternalFailureException> => {
2348+
const parsedOutput: any = {
2349+
...output,
2350+
body: await parseBody(output.body, context),
2351+
};
2352+
return deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2353+
};
2354+
const deserializeAws_json1_1KMSAccessDeniedException_event = async (
2355+
output: any,
2356+
context: __SerdeContext
2357+
): Promise<KMSAccessDeniedException> => {
2358+
const parsedOutput: any = {
2359+
...output,
2360+
body: await parseBody(output.body, context),
2361+
};
2362+
return deserializeAws_json1_1KMSAccessDeniedExceptionResponse(parsedOutput, context);
2363+
};
2364+
const deserializeAws_json1_1KMSDisabledException_event = async (
2365+
output: any,
2366+
context: __SerdeContext
2367+
): Promise<KMSDisabledException> => {
2368+
const parsedOutput: any = {
2369+
...output,
2370+
body: await parseBody(output.body, context),
2371+
};
2372+
return deserializeAws_json1_1KMSDisabledExceptionResponse(parsedOutput, context);
2373+
};
2374+
const deserializeAws_json1_1KMSInvalidStateException_event = async (
2375+
output: any,
2376+
context: __SerdeContext
2377+
): Promise<KMSInvalidStateException> => {
2378+
const parsedOutput: any = {
2379+
...output,
2380+
body: await parseBody(output.body, context),
2381+
};
2382+
return deserializeAws_json1_1KMSInvalidStateExceptionResponse(parsedOutput, context);
2383+
};
2384+
const deserializeAws_json1_1KMSNotFoundException_event = async (
2385+
output: any,
2386+
context: __SerdeContext
2387+
): Promise<KMSNotFoundException> => {
2388+
const parsedOutput: any = {
2389+
...output,
2390+
body: await parseBody(output.body, context),
2391+
};
2392+
return deserializeAws_json1_1KMSNotFoundExceptionResponse(parsedOutput, context);
2393+
};
2394+
const deserializeAws_json1_1KMSOptInRequired_event = async (
2395+
output: any,
2396+
context: __SerdeContext
2397+
): Promise<KMSOptInRequired> => {
2398+
const parsedOutput: any = {
2399+
...output,
2400+
body: await parseBody(output.body, context),
2401+
};
2402+
return deserializeAws_json1_1KMSOptInRequiredResponse(parsedOutput, context);
2403+
};
2404+
const deserializeAws_json1_1KMSThrottlingException_event = async (
2405+
output: any,
2406+
context: __SerdeContext
2407+
): Promise<KMSThrottlingException> => {
2408+
const parsedOutput: any = {
2409+
...output,
2410+
body: await parseBody(output.body, context),
2411+
};
2412+
return deserializeAws_json1_1KMSThrottlingExceptionResponse(parsedOutput, context);
2413+
};
2414+
const deserializeAws_json1_1ResourceInUseException_event = async (
2415+
output: any,
2416+
context: __SerdeContext
2417+
): Promise<ResourceInUseException> => {
2418+
const parsedOutput: any = {
2419+
...output,
2420+
body: await parseBody(output.body, context),
2421+
};
2422+
return deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
2423+
};
2424+
const deserializeAws_json1_1ResourceNotFoundException_event = async (
2425+
output: any,
2426+
context: __SerdeContext
2427+
): Promise<ResourceNotFoundException> => {
2428+
const parsedOutput: any = {
2429+
...output,
2430+
body: await parseBody(output.body, context),
2431+
};
2432+
return deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2433+
};
2434+
const deserializeAws_json1_1SubscribeToShardEvent_event = async (
2435+
output: any,
2436+
context: __SerdeContext
2437+
): Promise<SubscribeToShardEvent> => {
2438+
const contents: SubscribeToShardEvent = {} as any;
2439+
const data: any = await parseBody(output.body, context);
2440+
Object.assign(contents, deserializeAws_json1_1SubscribeToShardEvent(data, context));
2441+
return contents;
2442+
};
2443+
const deserializeAws_json1_1InternalFailureExceptionResponse = async (
2444+
parsedOutput: any,
2445+
context: __SerdeContext
2446+
): Promise<InternalFailureException> => {
2447+
const body = parsedOutput.body;
2448+
const deserialized: any = deserializeAws_json1_1InternalFailureException(body, context);
2449+
const exception = new InternalFailureException({
2450+
$metadata: deserializeMetadata(parsedOutput),
2451+
...deserialized,
2452+
});
2453+
return __decorateServiceException(exception, body);
2454+
};
2455+
22622456
const serializeAws_json1_1AddTagsToStreamInput = (input: AddTagsToStreamInput, context: __SerdeContext): any => {
22632457
return {
22642458
...(input.StreamName != null && { StreamName: input.StreamName }),
@@ -3127,84 +3321,6 @@ const deserializeAws_json1_1SubscribeToShardEvent = (output: any, context: __Ser
31273321
} as any;
31283322
};
31293323

3130-
const deserializeAws_json1_1SubscribeToShardEventStream = (
3131-
output: any,
3132-
context: __SerdeContext
3133-
): SubscribeToShardEventStream => {
3134-
if (output.InternalFailureException !== undefined && output.InternalFailureException !== null) {
3135-
return {
3136-
InternalFailureException: deserializeAws_json1_1InternalFailureException(
3137-
output.InternalFailureException,
3138-
context
3139-
),
3140-
};
3141-
}
3142-
if (output.KMSAccessDeniedException !== undefined && output.KMSAccessDeniedException !== null) {
3143-
return {
3144-
KMSAccessDeniedException: deserializeAws_json1_1KMSAccessDeniedException(
3145-
output.KMSAccessDeniedException,
3146-
context
3147-
),
3148-
};
3149-
}
3150-
if (output.KMSDisabledException !== undefined && output.KMSDisabledException !== null) {
3151-
return {
3152-
KMSDisabledException: deserializeAws_json1_1KMSDisabledException(output.KMSDisabledException, context),
3153-
};
3154-
}
3155-
if (output.KMSInvalidStateException !== undefined && output.KMSInvalidStateException !== null) {
3156-
return {
3157-
KMSInvalidStateException: deserializeAws_json1_1KMSInvalidStateException(
3158-
output.KMSInvalidStateException,
3159-
context
3160-
),
3161-
};
3162-
}
3163-
if (output.KMSNotFoundException !== undefined && output.KMSNotFoundException !== null) {
3164-
return {
3165-
KMSNotFoundException: deserializeAws_json1_1KMSNotFoundException(output.KMSNotFoundException, context),
3166-
};
3167-
}
3168-
if (output.KMSOptInRequired !== undefined && output.KMSOptInRequired !== null) {
3169-
return {
3170-
KMSOptInRequired: deserializeAws_json1_1KMSOptInRequired(output.KMSOptInRequired, context),
3171-
};
3172-
}
3173-
if (output.KMSThrottlingException !== undefined && output.KMSThrottlingException !== null) {
3174-
return {
3175-
KMSThrottlingException: deserializeAws_json1_1KMSThrottlingException(output.KMSThrottlingException, context),
3176-
};
3177-
}
3178-
if (output.ResourceInUseException !== undefined && output.ResourceInUseException !== null) {
3179-
return {
3180-
ResourceInUseException: deserializeAws_json1_1ResourceInUseException(output.ResourceInUseException, context),
3181-
};
3182-
}
3183-
if (output.ResourceNotFoundException !== undefined && output.ResourceNotFoundException !== null) {
3184-
return {
3185-
ResourceNotFoundException: deserializeAws_json1_1ResourceNotFoundException(
3186-
output.ResourceNotFoundException,
3187-
context
3188-
),
3189-
};
3190-
}
3191-
if (output.SubscribeToShardEvent !== undefined && output.SubscribeToShardEvent !== null) {
3192-
return {
3193-
SubscribeToShardEvent: deserializeAws_json1_1SubscribeToShardEvent(output.SubscribeToShardEvent, context),
3194-
};
3195-
}
3196-
return { $unknown: Object.entries(output)[0] };
3197-
};
3198-
3199-
const deserializeAws_json1_1SubscribeToShardOutput = (output: any, context: __SerdeContext): SubscribeToShardOutput => {
3200-
return {
3201-
EventStream:
3202-
output.EventStream != null
3203-
? deserializeAws_json1_1SubscribeToShardEventStream(__expectUnion(output.EventStream), context)
3204-
: undefined,
3205-
} as any;
3206-
};
3207-
32083324
const deserializeAws_json1_1Tag = (output: any, context: __SerdeContext): Tag => {
32093325
return {
32103326
Key: __expectString(output.Key),

0 commit comments

Comments
 (0)