Skip to content

Commit 67fcba1

Browse files
author
awstools
committed
feat(client-ssm-incidents): Adding support for dynamic SSM Runbook parameter values. Updating validation pattern for engagements. Adding ConflictException to UpdateReplicationSet API contract.
1 parent 796d6f4 commit 67fcba1

File tree

5 files changed

+229
-61
lines changed

5 files changed

+229
-61
lines changed

clients/client-ssm-incidents/src/SSMIncidents.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,10 @@ export class SSMIncidents extends SSMIncidentsClient {
774774
}
775775

776776
/**
777-
* <p>Adds a resource policy to the specified response plan.</p>
777+
* <p>Adds a resource policy to the specified response plan. The resource policy is used to
778+
* share the response plan using Resource Access Manager (RAM). For more
779+
* information about cross-account sharing, see <a href="https://docs.aws.amazon.com/incident-manager/latest/userguide/xa.html">Setting up
780+
* cross-account functionality</a>.</p>
778781
*/
779782
public putResourcePolicy(
780783
args: PutResourcePolicyCommandInput,

clients/client-ssm-incidents/src/commands/PutResourcePolicyCommand.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export interface PutResourcePolicyCommandInput extends PutResourcePolicyInput {}
2323
export interface PutResourcePolicyCommandOutput extends PutResourcePolicyOutput, __MetadataBearer {}
2424

2525
/**
26-
* <p>Adds a resource policy to the specified response plan.</p>
26+
* <p>Adds a resource policy to the specified response plan. The resource policy is used to
27+
* share the response plan using Resource Access Manager (RAM). For more
28+
* information about cross-account sharing, see <a href="https://docs.aws.amazon.com/incident-manager/latest/userguide/xa.html">Setting up
29+
* cross-account functionality</a>.</p>
2730
* @example
2831
* Use a bare-bones client and the command you need to make an API call.
2932
* ```javascript

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

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,51 @@ export class AccessDeniedException extends __BaseException {
2323
}
2424
}
2525

26+
export enum VariableType {
27+
INCIDENT_RECORD_ARN = "INCIDENT_RECORD_ARN",
28+
INVOLVED_RESOURCES = "INVOLVED_RESOURCES",
29+
}
30+
31+
/**
32+
* <p>The dynamic SSM parameter value.</p>
33+
*/
34+
export type DynamicSsmParameterValue =
35+
| DynamicSsmParameterValue.VariableMember
36+
| DynamicSsmParameterValue.$UnknownMember;
37+
38+
export namespace DynamicSsmParameterValue {
39+
/**
40+
* <p>Variable dynamic parameters. A parameter value is determined when an incident is created.</p>
41+
*/
42+
export interface VariableMember {
43+
variable: VariableType | string;
44+
$unknown?: never;
45+
}
46+
47+
export interface $UnknownMember {
48+
variable?: never;
49+
$unknown: [string, any];
50+
}
51+
52+
export interface Visitor<T> {
53+
variable: (value: VariableType | string) => T;
54+
_: (name: string, value: any) => T;
55+
}
56+
57+
export const visit = <T>(value: DynamicSsmParameterValue, visitor: Visitor<T>): T => {
58+
if (value.variable !== undefined) return visitor.variable(value.variable);
59+
return visitor._(value.$unknown[0], value.$unknown[1]);
60+
};
61+
62+
/**
63+
* @internal
64+
*/
65+
export const filterSensitiveLog = (obj: DynamicSsmParameterValue): any => {
66+
if (obj.variable !== undefined) return { variable: obj.variable };
67+
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
68+
};
69+
}
70+
2671
export enum SsmTargetAccount {
2772
IMPACTED_ACCOUNT = "IMPACTED_ACCOUNT",
2873
RESPONSE_PLAN_OWNER_ACCOUNT = "RESPONSE_PLAN_OWNER_ACCOUNT",
@@ -34,7 +79,8 @@ export enum SsmTargetAccount {
3479
*/
3580
export interface SsmAutomation {
3681
/**
37-
* <p>The Amazon Resource Name (ARN) of the role that the automation document will assume when running commands.</p>
82+
* <p>The Amazon Resource Name (ARN) of the role that the automation document will assume when
83+
* running commands.</p>
3884
*/
3985
roleArn: string | undefined;
4086

@@ -49,14 +95,20 @@ export interface SsmAutomation {
4995
documentVersion?: string;
5096

5197
/**
52-
* <p>The account that the automation document will be run in. This can be in either the management account or an application account.</p>
98+
* <p>The account that the automation document will be run in. This can be in either the
99+
* management account or an application account.</p>
53100
*/
54101
targetAccount?: SsmTargetAccount | string;
55102

56103
/**
57104
* <p>The key-value pair parameters to use when running the automation document.</p>
58105
*/
59106
parameters?: { [key: string]: string[] };
107+
108+
/**
109+
* <p>The key-value pair to resolve dynamic parameter values when processing a Systems Manager Automation runbook.</p>
110+
*/
111+
dynamicParameters?: { [key: string]: DynamicSsmParameterValue };
60112
}
61113

62114
export namespace SsmAutomation {
@@ -65,6 +117,15 @@ export namespace SsmAutomation {
65117
*/
66118
export const filterSensitiveLog = (obj: SsmAutomation): any => ({
67119
...obj,
120+
...(obj.dynamicParameters && {
121+
dynamicParameters: Object.entries(obj.dynamicParameters).reduce(
122+
(acc: any, [key, value]: [string, DynamicSsmParameterValue]) => ({
123+
...acc,
124+
[key]: DynamicSsmParameterValue.filterSensitiveLog(value),
125+
}),
126+
{}
127+
),
128+
}),
68129
});
69130
}
70131

@@ -260,9 +321,7 @@ export namespace ChatChannel {
260321
/**
261322
* <p>The Amazon SNS targets that Chatbot uses to notify the chat channel
262323
* of updates to an incident. You can also make updates to the incident through the chat
263-
* channel
264-
* by
265-
* using the Amazon SNS topics. </p>
324+
* channel by using the Amazon SNS topics. </p>
266325
*/
267326
export interface ChatbotSnsMember {
268327
empty?: never;
@@ -634,7 +693,8 @@ export namespace NotificationTargetItem {
634693
}
635694

636695
/**
637-
* <p>Basic details used in creating a response plan. The response plan is then used to create an incident record.</p>
696+
* <p>Basic details used in creating a response plan. The response plan is then used to create
697+
* an incident record.</p>
638698
*/
639699
export interface IncidentTemplate {
640700
/**
@@ -654,7 +714,8 @@ export interface IncidentTemplate {
654714
summary?: string;
655715

656716
/**
657-
* <p>Used to stop Incident Manager from creating multiple incident records for the same incident. </p>
717+
* <p>Used to stop Incident Manager from creating multiple incident records for the same incident.
718+
* </p>
658719
*/
659720
dedupeString?: string;
660721

@@ -806,8 +867,7 @@ export interface CreateTimelineEventInput {
806867
eventType: string | undefined;
807868

808869
/**
809-
* <p>A short description of the event as a valid JSON string. There is no other schema
810-
* imposed.</p>
870+
* <p>A short description of the event.</p>
811871
*/
812872
eventData: string | undefined;
813873
}
@@ -1059,7 +1119,8 @@ export interface Filter {
10591119
key: string | undefined;
10601120

10611121
/**
1062-
* <p>The condition accepts before or after a specified time, equal to a string, or equal to an integer.</p>
1122+
* <p>The condition accepts before or after a specified time, equal to a string, or equal to
1123+
* an integer.</p>
10631124
*/
10641125
condition: Condition | undefined;
10651126
}
@@ -1100,7 +1161,8 @@ export interface IncidentRecordSource {
11001161
createdBy: string | undefined;
11011162

11021163
/**
1103-
* <p>The principal the assumed the role specified of the <code>createdBy</code>.</p>
1164+
* <p>The service principal that assumed the role specified in <code>createdBy</code>. If no
1165+
* service principal assumed the role this will be left blank.</p>
11041166
*/
11051167
invokedBy?: string;
11061168

@@ -1192,7 +1254,8 @@ export interface IncidentRecord {
11921254
incidentRecordSource: IncidentRecordSource | undefined;
11931255

11941256
/**
1195-
* <p>The string Incident Manager uses to prevent duplicate incidents from being created by the same incident in the same account.</p>
1257+
* <p>The string Incident Manager uses to prevent duplicate incidents from being created by the
1258+
* same incident in the same account.</p>
11961259
*/
11971260
dedupeString: string | undefined;
11981261

@@ -1434,7 +1497,8 @@ export namespace GetResourcePoliciesInput {
14341497
}
14351498

14361499
/**
1437-
* <p>The resource policy that allows Incident Manager to perform actions on resources on your behalf.</p>
1500+
* <p>The resource policy that allows Incident Manager to perform actions on resources on your
1501+
* behalf.</p>
14381502
*/
14391503
export interface ResourcePolicy {
14401504
/**
@@ -1689,6 +1753,7 @@ export enum ItemType {
16891753
ATTACHMENT = "ATTACHMENT",
16901754
AUTOMATION = "AUTOMATION",
16911755
INCIDENT = "INCIDENT",
1756+
INVOLVED_RESOURCE = "INVOLVED_RESOURCE",
16921757
METRIC = "METRIC",
16931758
OTHER = "OTHER",
16941759
PARENT = "PARENT",
@@ -1777,39 +1842,7 @@ export interface ItemIdentifier {
17771842
value: ItemValue | undefined;
17781843

17791844
/**
1780-
* <p>The type of related item. Incident Manager supports the following types:</p>
1781-
* <ul>
1782-
* <li>
1783-
* <p>
1784-
* <code>ANALYSIS</code>
1785-
* </p>
1786-
* </li>
1787-
* <li>
1788-
* <p>
1789-
* <code>INCIDENT</code>
1790-
* </p>
1791-
* </li>
1792-
* <li>
1793-
* <p>
1794-
* <code>METRIC</code>
1795-
* </p>
1796-
* </li>
1797-
* <li>
1798-
* <p>
1799-
* <code>PARENT</code>
1800-
* </p>
1801-
* </li>
1802-
* <li>
1803-
* <p>
1804-
* <code>ATTACHMENT</code>
1805-
* </p>
1806-
* </li>
1807-
* <li>
1808-
* <p>
1809-
* <code>OTHER</code>
1810-
* </p>
1811-
* </li>
1812-
* </ul>
1845+
* <p>The type of related item. </p>
18131846
*/
18141847
type: ItemType | string | undefined;
18151848
}

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ import {
100100
Condition,
101101
ConflictException,
102102
DeleteRegionAction,
103+
DynamicSsmParameterValue,
103104
EmptyChatChannel,
104105
EventSummary,
105106
Filter,
@@ -2461,6 +2462,9 @@ const deserializeAws_restJson1UpdateReplicationSetCommandError = async (
24612462
case "AccessDeniedException":
24622463
case "com.amazonaws.ssmincidents#AccessDeniedException":
24632464
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2465+
case "ConflictException":
2466+
case "com.amazonaws.ssmincidents#ConflictException":
2467+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
24642468
case "InternalServerException":
24652469
case "com.amazonaws.ssmincidents#InternalServerException":
24662470
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
@@ -2806,6 +2810,31 @@ const serializeAws_restJson1DeleteRegionAction = (input: DeleteRegionAction, con
28062810
};
28072811
};
28082812

2813+
const serializeAws_restJson1DynamicSsmParameters = (
2814+
input: { [key: string]: DynamicSsmParameterValue },
2815+
context: __SerdeContext
2816+
): any => {
2817+
return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
2818+
if (value === null) {
2819+
return acc;
2820+
}
2821+
return {
2822+
...acc,
2823+
[key]: serializeAws_restJson1DynamicSsmParameterValue(value, context),
2824+
};
2825+
}, {});
2826+
};
2827+
2828+
const serializeAws_restJson1DynamicSsmParameterValue = (
2829+
input: DynamicSsmParameterValue,
2830+
context: __SerdeContext
2831+
): any => {
2832+
return DynamicSsmParameterValue.visit(input, {
2833+
variable: (value) => ({ variable: value }),
2834+
_: (name, value) => ({ name: value } as any),
2835+
});
2836+
};
2837+
28092838
const serializeAws_restJson1EmptyChatChannel = (input: EmptyChatChannel, context: __SerdeContext): any => {
28102839
return {};
28112840
};
@@ -2952,6 +2981,10 @@ const serializeAws_restJson1SsmAutomation = (input: SsmAutomation, context: __Se
29522981
...(input.documentName !== undefined && input.documentName !== null && { documentName: input.documentName }),
29532982
...(input.documentVersion !== undefined &&
29542983
input.documentVersion !== null && { documentVersion: input.documentVersion }),
2984+
...(input.dynamicParameters !== undefined &&
2985+
input.dynamicParameters !== null && {
2986+
dynamicParameters: serializeAws_restJson1DynamicSsmParameters(input.dynamicParameters, context),
2987+
}),
29552988
...(input.parameters !== undefined &&
29562989
input.parameters !== null && { parameters: serializeAws_restJson1SsmParameters(input.parameters, context) }),
29572990
...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }),
@@ -3106,6 +3139,34 @@ const deserializeAws_restJson1ChatChannel = (output: any, context: __SerdeContex
31063139
return { $unknown: Object.entries(output)[0] };
31073140
};
31083141

3142+
const deserializeAws_restJson1DynamicSsmParameters = (
3143+
output: any,
3144+
context: __SerdeContext
3145+
): { [key: string]: DynamicSsmParameterValue } => {
3146+
return Object.entries(output).reduce(
3147+
(acc: { [key: string]: DynamicSsmParameterValue }, [key, value]: [string, any]) => {
3148+
if (value === null) {
3149+
return acc;
3150+
}
3151+
return {
3152+
...acc,
3153+
[key]: deserializeAws_restJson1DynamicSsmParameterValue(__expectUnion(value), context),
3154+
};
3155+
},
3156+
{}
3157+
);
3158+
};
3159+
3160+
const deserializeAws_restJson1DynamicSsmParameterValue = (
3161+
output: any,
3162+
context: __SerdeContext
3163+
): DynamicSsmParameterValue => {
3164+
if (__expectString(output.variable) !== undefined) {
3165+
return { variable: __expectString(output.variable) as any };
3166+
}
3167+
return { $unknown: Object.entries(output)[0] };
3168+
};
3169+
31093170
const deserializeAws_restJson1EmptyChatChannel = (output: any, context: __SerdeContext): EmptyChatChannel => {
31103171
return {} as any;
31113172
};
@@ -3423,6 +3484,10 @@ const deserializeAws_restJson1SsmAutomation = (output: any, context: __SerdeCont
34233484
return {
34243485
documentName: __expectString(output.documentName),
34253486
documentVersion: __expectString(output.documentVersion),
3487+
dynamicParameters:
3488+
output.dynamicParameters !== undefined && output.dynamicParameters !== null
3489+
? deserializeAws_restJson1DynamicSsmParameters(output.dynamicParameters, context)
3490+
: undefined,
34263491
parameters:
34273492
output.parameters !== undefined && output.parameters !== null
34283493
? deserializeAws_restJson1SsmParameters(output.parameters, context)

0 commit comments

Comments
 (0)