Skip to content

Commit de55f7e

Browse files
author
awstools
committed
feat(client-ssm-incidents): RelatedItems now have an ID field which can be used for referencing them else where. Introducing event references in TimelineEvent API and increasing maximum length of "eventData" to 12K characters.
1 parent 1957f04 commit de55f7e

File tree

3 files changed

+367
-135
lines changed

3 files changed

+367
-135
lines changed

clients/client-ssm-incidents/src/models/models_0.ts

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,7 @@ export interface IncidentTemplate {
610610

611611
/**
612612
* <p>Tags to assign to the template. When the <code>StartIncident</code> API action is
613-
* called, Incident Manager assigns the tags specified in the template to the
614-
* incident.</p>
613+
* called, Incident Manager assigns the tags specified in the template to the incident.</p>
615614
*/
616615
incidentTags?: Record<string, string>;
617616
}
@@ -699,6 +698,55 @@ export class ResourceNotFoundException extends __BaseException {
699698
}
700699
}
701700

701+
/**
702+
* <p>An item referenced in a <code>TimelineEvent</code> that is involved in or somehow
703+
* associated with an incident. You can specify an Amazon Resource Name (ARN) for an Amazon Web Services
704+
* resource or a <code>RelatedItem</code> ID.</p>
705+
*/
706+
export type EventReference =
707+
| EventReference.RelatedItemIdMember
708+
| EventReference.ResourceMember
709+
| EventReference.$UnknownMember;
710+
711+
export namespace EventReference {
712+
/**
713+
* <p>The Amazon Resource Name (ARN) of an Amazon Web Services resource referenced in a
714+
* <code>TimelineEvent</code>.</p>
715+
*/
716+
export interface ResourceMember {
717+
resource: string;
718+
relatedItemId?: never;
719+
$unknown?: never;
720+
}
721+
722+
/**
723+
* <p>The ID of a <code>RelatedItem</code> referenced in a <code>TimelineEvent</code>.</p>
724+
*/
725+
export interface RelatedItemIdMember {
726+
resource?: never;
727+
relatedItemId: string;
728+
$unknown?: never;
729+
}
730+
731+
export interface $UnknownMember {
732+
resource?: never;
733+
relatedItemId?: never;
734+
$unknown: [string, any];
735+
}
736+
737+
export interface Visitor<T> {
738+
resource: (value: string) => T;
739+
relatedItemId: (value: string) => T;
740+
_: (name: string, value: any) => T;
741+
}
742+
743+
export const visit = <T>(value: EventReference, visitor: Visitor<T>): T => {
744+
if (value.resource !== undefined) return visitor.resource(value.resource);
745+
if (value.relatedItemId !== undefined) return visitor.relatedItemId(value.relatedItemId);
746+
return visitor._(value.$unknown[0], value.$unknown[1]);
747+
};
748+
}
749+
702750
export interface CreateTimelineEventInput {
703751
/**
704752
* <p>A token ensuring that the action is called only once with the specified
@@ -727,6 +775,11 @@ export interface CreateTimelineEventInput {
727775
* <p>A short description of the event.</p>
728776
*/
729777
eventData: string | undefined;
778+
779+
/**
780+
* <p>Adds one or more references to the <code>TimelineEvent</code>. A reference can be an Amazon Web Services resource involved in the incident or in some way associated with it. When you specify a reference, you enter the Amazon Resource Name (ARN) of the resource. You can also specify a related item. As an example, you could specify the ARN of an Amazon DynamoDB (DynamoDB) table. The table for this example is the resource. You could also specify a Amazon CloudWatch metric for that table. The metric is the related item.</p>
781+
*/
782+
eventReferences?: EventReference[];
730783
}
731784

732785
export interface CreateTimelineEventOutput {
@@ -838,6 +891,11 @@ export interface EventSummary {
838891
* <p>The type of event. The timeline event must be <code>Custom Event</code>.</p>
839892
*/
840893
eventType: string | undefined;
894+
895+
/**
896+
* <p>A list of references in a <code>TimelineEvent</code>.</p>
897+
*/
898+
eventReferences?: EventReference[];
841899
}
842900

843901
/**
@@ -1256,6 +1314,11 @@ export interface TimelineEvent {
12561314
* <p>A short description of the event.</p>
12571315
*/
12581316
eventData: string | undefined;
1317+
1318+
/**
1319+
* <p>A list of references in a <code>TimelineEvent</code>.</p>
1320+
*/
1321+
eventReferences?: EventReference[];
12591322
}
12601323

12611324
export interface GetTimelineEventOutput {
@@ -1494,6 +1557,15 @@ export interface RelatedItem {
14941557
* <p>The title of the related item.</p>
14951558
*/
14961559
title?: string;
1560+
1561+
/**
1562+
* <p>A unique ID for a <code>RelatedItem</code>.</p>
1563+
* <important>
1564+
* <p>Don't specify this parameter when you add a <code>RelatedItem</code> by using the
1565+
* <a>UpdateRelatedItems</a> API action.</p>
1566+
* </important>
1567+
*/
1568+
generatedId?: string;
14971569
}
14981570

14991571
export interface ListRelatedItemsOutput {
@@ -2192,6 +2264,16 @@ export interface UpdateTimelineEventInput {
21922264
* <p>A short description of the event.</p>
21932265
*/
21942266
eventData?: string;
2267+
2268+
/**
2269+
* <p>Updates all existing references in a <code>TimelineEvent</code>. A reference can be an Amazon Web Services resource involved in the incident or in some way associated with it. When you specify a reference, you enter the Amazon Resource Name (ARN) of the resource. You can also specify a related item. As an example, you could specify the ARN of an Amazon DynamoDB (DynamoDB) table. The table for this example is the resource. You could also specify a Amazon CloudWatch metric for that table. The metric is the related item.</p>
2270+
* <important>
2271+
* <p>This update action overrides all existing references. If you want to keep existing
2272+
* references, you must specify them in the call. If you don't, this action removes
2273+
* them and enters only new references.</p>
2274+
* </important>
2275+
*/
2276+
eventReferences?: EventReference[];
21952277
}
21962278

21972279
export interface UpdateTimelineEventOutput {}
@@ -2334,11 +2416,23 @@ export const CreateResponsePlanOutputFilterSensitiveLog = (obj: CreateResponsePl
23342416
...obj,
23352417
});
23362418

2419+
/**
2420+
* @internal
2421+
*/
2422+
export const EventReferenceFilterSensitiveLog = (obj: EventReference): any => {
2423+
if (obj.resource !== undefined) return { resource: obj.resource };
2424+
if (obj.relatedItemId !== undefined) return { relatedItemId: obj.relatedItemId };
2425+
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
2426+
};
2427+
23372428
/**
23382429
* @internal
23392430
*/
23402431
export const CreateTimelineEventInputFilterSensitiveLog = (obj: CreateTimelineEventInput): any => ({
23412432
...obj,
2433+
...(obj.eventReferences && {
2434+
eventReferences: obj.eventReferences.map((item) => EventReferenceFilterSensitiveLog(item)),
2435+
}),
23422436
});
23432437

23442438
/**
@@ -2430,6 +2524,9 @@ export const DeleteTimelineEventOutputFilterSensitiveLog = (obj: DeleteTimelineE
24302524
*/
24312525
export const EventSummaryFilterSensitiveLog = (obj: EventSummary): any => ({
24322526
...obj,
2527+
...(obj.eventReferences && {
2528+
eventReferences: obj.eventReferences.map((item) => EventReferenceFilterSensitiveLog(item)),
2529+
}),
24332530
});
24342531

24352532
/**
@@ -2554,13 +2651,17 @@ export const GetTimelineEventInputFilterSensitiveLog = (obj: GetTimelineEventInp
25542651
*/
25552652
export const TimelineEventFilterSensitiveLog = (obj: TimelineEvent): any => ({
25562653
...obj,
2654+
...(obj.eventReferences && {
2655+
eventReferences: obj.eventReferences.map((item) => EventReferenceFilterSensitiveLog(item)),
2656+
}),
25572657
});
25582658

25592659
/**
25602660
* @internal
25612661
*/
25622662
export const GetTimelineEventOutputFilterSensitiveLog = (obj: GetTimelineEventOutput): any => ({
25632663
...obj,
2664+
...(obj.event && { event: TimelineEventFilterSensitiveLog(obj.event) }),
25642665
});
25652666

25662667
/**
@@ -2688,6 +2789,7 @@ export const ListTimelineEventsInputFilterSensitiveLog = (obj: ListTimelineEvent
26882789
*/
26892790
export const ListTimelineEventsOutputFilterSensitiveLog = (obj: ListTimelineEventsOutput): any => ({
26902791
...obj,
2792+
...(obj.eventSummaries && { eventSummaries: obj.eventSummaries.map((item) => EventSummaryFilterSensitiveLog(item)) }),
26912793
});
26922794

26932795
/**
@@ -2862,6 +2964,9 @@ export const UpdateResponsePlanOutputFilterSensitiveLog = (obj: UpdateResponsePl
28622964
*/
28632965
export const UpdateTimelineEventInputFilterSensitiveLog = (obj: UpdateTimelineEventInput): any => ({
28642966
...obj,
2967+
...(obj.eventReferences && {
2968+
eventReferences: obj.eventReferences.map((item) => EventReferenceFilterSensitiveLog(item)),
2969+
}),
28652970
});
28662971

28672972
/**

clients/client-ssm-incidents/src/protocols/Aws_restJson1.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import {
105105
DeleteRegionAction,
106106
DynamicSsmParameterValue,
107107
EmptyChatChannel,
108+
EventReference,
108109
EventSummary,
109110
Filter,
110111
IncidentRecord,
@@ -205,6 +206,9 @@ export const serializeAws_restJson1CreateTimelineEventCommand = async (
205206
body = JSON.stringify({
206207
clientToken: input.clientToken ?? generateIdempotencyToken(),
207208
...(input.eventData != null && { eventData: input.eventData }),
209+
...(input.eventReferences != null && {
210+
eventReferences: serializeAws_restJson1EventReferenceList(input.eventReferences, context),
211+
}),
208212
...(input.eventTime != null && { eventTime: Math.round(input.eventTime.getTime() / 1000) }),
209213
...(input.eventType != null && { eventType: input.eventType }),
210214
...(input.incidentRecordArn != null && { incidentRecordArn: input.incidentRecordArn }),
@@ -893,6 +897,9 @@ export const serializeAws_restJson1UpdateTimelineEventCommand = async (
893897
clientToken: input.clientToken ?? generateIdempotencyToken(),
894898
...(input.eventData != null && { eventData: input.eventData }),
895899
...(input.eventId != null && { eventId: input.eventId }),
900+
...(input.eventReferences != null && {
901+
eventReferences: serializeAws_restJson1EventReferenceList(input.eventReferences, context),
902+
}),
896903
...(input.eventTime != null && { eventTime: Math.round(input.eventTime.getTime() / 1000) }),
897904
...(input.eventType != null && { eventType: input.eventType }),
898905
...(input.incidentRecordArn != null && { incidentRecordArn: input.incidentRecordArn }),
@@ -2707,6 +2714,22 @@ const serializeAws_restJson1EngagementSet = (input: string[], context: __SerdeCo
27072714
});
27082715
};
27092716

2717+
const serializeAws_restJson1EventReference = (input: EventReference, context: __SerdeContext): any => {
2718+
return EventReference.visit(input, {
2719+
relatedItemId: (value) => ({ relatedItemId: value }),
2720+
resource: (value) => ({ resource: value }),
2721+
_: (name, value) => ({ name: value } as any),
2722+
});
2723+
};
2724+
2725+
const serializeAws_restJson1EventReferenceList = (input: EventReference[], context: __SerdeContext): any => {
2726+
return input
2727+
.filter((e: any) => e != null)
2728+
.map((entry) => {
2729+
return serializeAws_restJson1EventReference(entry, context);
2730+
});
2731+
};
2732+
27102733
const serializeAws_restJson1Filter = (input: Filter, context: __SerdeContext): any => {
27112734
return {
27122735
...(input.condition != null && { condition: serializeAws_restJson1Condition(input.condition, context) }),
@@ -2797,6 +2820,7 @@ const serializeAws_restJson1RegionMapInputValue = (input: RegionMapInputValue, c
27972820

27982821
const serializeAws_restJson1RelatedItem = (input: RelatedItem, context: __SerdeContext): any => {
27992822
return {
2823+
...(input.generatedId != null && { generatedId: input.generatedId }),
28002824
...(input.identifier != null && { identifier: serializeAws_restJson1ItemIdentifier(input.identifier, context) }),
28012825
...(input.title != null && { title: input.title }),
28022826
};
@@ -3021,9 +3045,35 @@ const deserializeAws_restJson1EngagementSet = (output: any, context: __SerdeCont
30213045
return retVal;
30223046
};
30233047

3048+
const deserializeAws_restJson1EventReference = (output: any, context: __SerdeContext): EventReference => {
3049+
if (__expectString(output.relatedItemId) !== undefined) {
3050+
return { relatedItemId: __expectString(output.relatedItemId) as any };
3051+
}
3052+
if (__expectString(output.resource) !== undefined) {
3053+
return { resource: __expectString(output.resource) as any };
3054+
}
3055+
return { $unknown: Object.entries(output)[0] };
3056+
};
3057+
3058+
const deserializeAws_restJson1EventReferenceList = (output: any, context: __SerdeContext): EventReference[] => {
3059+
const retVal = (output || [])
3060+
.filter((e: any) => e != null)
3061+
.map((entry: any) => {
3062+
if (entry === null) {
3063+
return null as any;
3064+
}
3065+
return deserializeAws_restJson1EventReference(__expectUnion(entry), context);
3066+
});
3067+
return retVal;
3068+
};
3069+
30243070
const deserializeAws_restJson1EventSummary = (output: any, context: __SerdeContext): EventSummary => {
30253071
return {
30263072
eventId: __expectString(output.eventId),
3073+
eventReferences:
3074+
output.eventReferences != null
3075+
? deserializeAws_restJson1EventReferenceList(output.eventReferences, context)
3076+
: undefined,
30273077
eventTime:
30283078
output.eventTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.eventTime))) : undefined,
30293079
eventType: __expectString(output.eventType),
@@ -3218,6 +3268,7 @@ const deserializeAws_restJson1RegionInfoMap = (output: any, context: __SerdeCont
32183268

32193269
const deserializeAws_restJson1RelatedItem = (output: any, context: __SerdeContext): RelatedItem => {
32203270
return {
3271+
generatedId: __expectString(output.generatedId),
32213272
identifier:
32223273
output.identifier != null ? deserializeAws_restJson1ItemIdentifier(output.identifier, context) : undefined,
32233274
title: __expectString(output.title),
@@ -3365,6 +3416,10 @@ const deserializeAws_restJson1TimelineEvent = (output: any, context: __SerdeCont
33653416
return {
33663417
eventData: __expectString(output.eventData),
33673418
eventId: __expectString(output.eventId),
3419+
eventReferences:
3420+
output.eventReferences != null
3421+
? deserializeAws_restJson1EventReferenceList(output.eventReferences, context)
3422+
: undefined,
33683423
eventTime:
33693424
output.eventTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.eventTime))) : undefined,
33703425
eventType: __expectString(output.eventType),

0 commit comments

Comments
 (0)