Skip to content

Commit

Permalink
feat(client-ssm-incidents): Adds support for tagging incident-record …
Browse files Browse the repository at this point in the history
…on creation by providing incident tags in the template within a response-plan.
  • Loading branch information
awstools committed Jul 5, 2022
1 parent c700486 commit 3aff9aa
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 17 deletions.
38 changes: 27 additions & 11 deletions clients/client-ssm-incidents/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export type DynamicSsmParameterValue =

export namespace DynamicSsmParameterValue {
/**
* <p>Variable dynamic parameters. A parameter value is determined when an incident is created.</p>
* <p>Variable dynamic parameters. A parameter value is determined when an incident is
* created.</p>
*/
export interface VariableMember {
variable: VariableType | string;
Expand Down Expand Up @@ -105,7 +106,8 @@ export interface SsmAutomation {
parameters?: Record<string, string[]>;

/**
* <p>The key-value pair to resolve dynamic parameter values when processing a Systems Manager Automation runbook.</p>
* <p>The key-value pair to resolve dynamic parameter values when processing a Systems Manager
* Automation runbook.</p>
*/
dynamicParameters?: Record<string, DynamicSsmParameterValue>;
}
Expand Down Expand Up @@ -723,6 +725,11 @@ export interface IncidentTemplate {
* incident.</p>
*/
notificationTargets?: NotificationTargetItem[];

/**
* <p>Tags to apply to an incident when calling the <code>StartIncident</code> API action.</p>
*/
incidentTags?: Record<string, string>;
}

export namespace IncidentTemplate {
Expand Down Expand Up @@ -2401,7 +2408,8 @@ export interface StartIncidentInput {

/**
* <p>The Amazon Resource Name (ARN) of the response plan that pre-defines summary, chat
* channels, Amazon SNS topics, runbooks, title, and impact of the incident. </p>
* channels, Amazon SNS topics, runbooks, title, and impact of the incident.
* </p>
*/
responsePlanArn: string | undefined;

Expand Down Expand Up @@ -2430,12 +2438,12 @@ export interface StartIncidentInput {
* </li>
* <li>
* <p>
* <code>3</code> - Medium impact, the application is providing reduced service
* <code>3</code> - Medium impact, the application is providing reduced service
* to customers.</p>
* </li>
* <li>
* <p>
* <code>4</code> - Low impact, customer might aren't impacted by the problem
* <code>4</code> - Low impact, customer might aren't impacted by the problem
* yet.</p>
* </li>
* <li>
Expand Down Expand Up @@ -2860,23 +2868,23 @@ export interface UpdateResponsePlanInput {
* </p>
* <ul>
* <li>
* <p>
* <p>
* <code>5</code> - Severe impact</p>
* </li>
* <li>
* <p>
* <p>
* <code>4</code> - High impact</p>
* </li>
* <li>
* <p>
* <p>
* <code>3</code> - Medium impact</p>
* </li>
* <li>
* <p>
* <p>
* <code>2</code> - Low impact</p>
* </li>
* <li>
* <p>
* <p>
* <code>1</code> - No impact</p>
* </li>
* </ul>
Expand Down Expand Up @@ -2909,14 +2917,22 @@ export interface UpdateResponsePlanInput {
chatChannel?: ChatChannel;

/**
* <p>The contacts and escalation plans that Incident Manager engages at the start of the incident.</p>
* <p>The contacts and escalation plans that Incident Manager engages at the start of the
* incident.</p>
*/
engagements?: string[];

/**
* <p>The actions that this response plan takes at the beginning of an incident.</p>
*/
actions?: Action[];

/**
* <p>Tags to apply to an incident when calling the <code>StartIncident</code> API action.
* To call this action, you must also have permission to call the <code>TagResource</code>
* API action for the incident record resource.</p>
*/
incidentTemplateTags?: Record<string, string>;
}

export namespace UpdateResponsePlanInput {
Expand Down
22 changes: 22 additions & 0 deletions clients/client-ssm-incidents/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@ export const serializeAws_restJson1UpdateResponsePlanCommand = async (
}),
...(input.incidentTemplateSummary !== undefined &&
input.incidentTemplateSummary !== null && { incidentTemplateSummary: input.incidentTemplateSummary }),
...(input.incidentTemplateTags !== undefined &&
input.incidentTemplateTags !== null && {
incidentTemplateTags: serializeAws_restJson1TagMapUpdate(input.incidentTemplateTags, context),
}),
...(input.incidentTemplateTitle !== undefined &&
input.incidentTemplateTitle !== null && { incidentTemplateTitle: input.incidentTemplateTitle }),
});
Expand Down Expand Up @@ -2902,6 +2906,8 @@ const serializeAws_restJson1IncidentTemplate = (input: IncidentTemplate, context
return {
...(input.dedupeString !== undefined && input.dedupeString !== null && { dedupeString: input.dedupeString }),
...(input.impact !== undefined && input.impact !== null && { impact: input.impact }),
...(input.incidentTags !== undefined &&
input.incidentTags !== null && { incidentTags: serializeAws_restJson1TagMap(input.incidentTags, context) }),
...(input.notificationTargets !== undefined &&
input.notificationTargets !== null && {
notificationTargets: serializeAws_restJson1NotificationTargetSet(input.notificationTargets, context),
Expand Down Expand Up @@ -3067,6 +3073,18 @@ const serializeAws_restJson1TagMap = (input: Record<string, string>, context: __
}, {});
};

const serializeAws_restJson1TagMapUpdate = (input: Record<string, string>, context: __SerdeContext): any => {
return Object.entries(input).reduce((acc: Record<string, any>, [key, value]: [string, any]) => {
if (value === null) {
return acc;
}
return {
...acc,
[key]: value,
};
}, {});
};

const serializeAws_restJson1TriggerDetails = (input: TriggerDetails, context: __SerdeContext): any => {
return {
...(input.rawData !== undefined && input.rawData !== null && { rawData: input.rawData }),
Expand Down Expand Up @@ -3326,6 +3344,10 @@ const deserializeAws_restJson1IncidentTemplate = (output: any, context: __SerdeC
return {
dedupeString: __expectString(output.dedupeString),
impact: __expectInt32(output.impact),
incidentTags:
output.incidentTags !== undefined && output.incidentTags !== null
? deserializeAws_restJson1TagMap(output.incidentTags, context)
: undefined,
notificationTargets:
output.notificationTargets !== undefined && output.notificationTargets !== null
? deserializeAws_restJson1NotificationTargetSet(output.notificationTargets, context)
Expand Down
45 changes: 39 additions & 6 deletions codegen/sdk-codegen/aws-models/ssm-incidents.json
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@
"variable": {
"target": "com.amazonaws.ssmincidents#VariableType",
"traits": {
"smithy.api#documentation": "<p>Variable dynamic parameters. A parameter value is determined when an incident is created.</p>",
"smithy.api#documentation": "<p>Variable dynamic parameters. A parameter value is determined when an incident is\n created.</p>",
"smithy.api#tags": ["logs_investigations"]
}
}
Expand Down Expand Up @@ -1693,6 +1693,12 @@
"traits": {
"smithy.api#documentation": "<p>The Amazon SNS targets that are notified when updates are made to an\n incident.</p>"
}
},
"incidentTags": {
"target": "com.amazonaws.ssmincidents#TagMap",
"traits": {
"smithy.api#documentation": "<p>Tags to apply to an incident when calling the <code>StartIncident</code> API action.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -3129,7 +3135,7 @@
"dynamicParameters": {
"target": "com.amazonaws.ssmincidents#DynamicSsmParameters",
"traits": {
"smithy.api#documentation": "<p>The key-value pair to resolve dynamic parameter values when processing a Systems Manager Automation runbook.</p>"
"smithy.api#documentation": "<p>The key-value pair to resolve dynamic parameter values when processing a Systems Manager\n Automation runbook.</p>"
}
}
},
Expand Down Expand Up @@ -3252,7 +3258,7 @@
"responsePlanArn": {
"target": "com.amazonaws.ssmincidents#Arn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Name (ARN) of the response plan that pre-defines summary, chat\n channels, Amazon SNS topics, runbooks, title, and impact of the incident. </p>",
"smithy.api#documentation": "<p>The Amazon Resource Name (ARN) of the response plan that pre-defines summary, chat\n channels, Amazon SNS topics, runbooks, title, and impact of the incident.\n </p>",
"smithy.api#required": {},
"smithy.api#tags": ["logs_investigations"]
}
Expand All @@ -3266,7 +3272,7 @@
"impact": {
"target": "com.amazonaws.ssmincidents#Impact",
"traits": {
"smithy.api#documentation": "<p>Defines the impact to the customers. Providing an impact overwrites the impact\n provided by a response plan.</p>\n <p class=\"title\">\n <b>Possible impacts:</b>\n </p>\n <ul>\n <li>\n <p>\n <code>1</code> - Critical impact, this typically relates to full application\n failure that impacts many to all customers. </p>\n </li>\n <li>\n <p>\n <code>2</code> - High impact, partial application failure with impact to many\n customers.</p>\n </li>\n <li>\n <p>\n <code>3</code> - Medium impact, the application is providing reduced service\n to customers.</p>\n </li>\n <li>\n <p>\n <code>4</code> - Low impact, customer might aren't impacted by the problem\n yet.</p>\n </li>\n <li>\n <p>\n <code>5</code> - No impact, customers aren't currently impacted but urgent\n action is needed to avoid impact.</p>\n </li>\n </ul>"
"smithy.api#documentation": "<p>Defines the impact to the customers. Providing an impact overwrites the impact\n provided by a response plan.</p>\n <p class=\"title\">\n <b>Possible impacts:</b>\n </p>\n <ul>\n <li>\n <p>\n <code>1</code> - Critical impact, this typically relates to full application\n failure that impacts many to all customers. </p>\n </li>\n <li>\n <p>\n <code>2</code> - High impact, partial application failure with impact to many\n customers.</p>\n </li>\n <li>\n <p>\n <code>3</code> - Medium impact, the application is providing reduced service\n to customers.</p>\n </li>\n <li>\n <p>\n <code>4</code> - Low impact, customer might aren't impacted by the problem\n yet.</p>\n </li>\n <li>\n <p>\n <code>5</code> - No impact, customers aren't currently impacted but urgent\n action is needed to avoid impact.</p>\n </li>\n </ul>"
}
},
"triggerDetails": {
Expand Down Expand Up @@ -3355,6 +3361,27 @@
}
}
},
"com.amazonaws.ssmincidents#TagMapUpdate": {
"type": "map",
"key": {
"target": "com.amazonaws.ssmincidents#TagKey",
"traits": {
"smithy.api#tags": ["logs_investigations"]
}
},
"value": {
"target": "com.amazonaws.ssmincidents#TagValue",
"traits": {
"smithy.api#tags": ["logs_investigations"]
}
},
"traits": {
"smithy.api#length": {
"min": 0,
"max": 50
}
}
},
"com.amazonaws.ssmincidents#TagResource": {
"type": "operation",
"input": {
Expand Down Expand Up @@ -4045,7 +4072,7 @@
"incidentTemplateImpact": {
"target": "com.amazonaws.ssmincidents#Impact",
"traits": {
"smithy.api#documentation": "<p>Defines the impact to the customers. Providing an impact overwrites the impact\n provided by a response plan.</p>\n <p class=\"title\">\n <b>Possible impacts:</b>\n </p>\n <ul>\n <li>\n <p>\n <code>5</code> - Severe impact</p>\n </li>\n <li>\n <p>\n <code>4</code> - High impact</p>\n </li>\n <li>\n <p>\n <code>3</code> - Medium impact</p>\n </li>\n <li>\n <p>\n <code>2</code> - Low impact</p>\n </li>\n <li>\n <p>\n <code>1</code> - No impact</p>\n </li>\n </ul>"
"smithy.api#documentation": "<p>Defines the impact to the customers. Providing an impact overwrites the impact\n provided by a response plan.</p>\n <p class=\"title\">\n <b>Possible impacts:</b>\n </p>\n <ul>\n <li>\n <p>\n <code>5</code> - Severe impact</p>\n </li>\n <li>\n <p>\n <code>4</code> - High impact</p>\n </li>\n <li>\n <p>\n <code>3</code> - Medium impact</p>\n </li>\n <li>\n <p>\n <code>2</code> - Low impact</p>\n </li>\n <li>\n <p>\n <code>1</code> - No impact</p>\n </li>\n </ul>"
}
},
"incidentTemplateSummary": {
Expand Down Expand Up @@ -4076,14 +4103,20 @@
"engagements": {
"target": "com.amazonaws.ssmincidents#EngagementSet",
"traits": {
"smithy.api#documentation": "<p>The contacts and escalation plans that Incident Manager engages at the start of the incident.</p>"
"smithy.api#documentation": "<p>The contacts and escalation plans that Incident Manager engages at the start of the\n incident.</p>"
}
},
"actions": {
"target": "com.amazonaws.ssmincidents#ActionsList",
"traits": {
"smithy.api#documentation": "<p>The actions that this response plan takes at the beginning of an incident.</p>"
}
},
"incidentTemplateTags": {
"target": "com.amazonaws.ssmincidents#TagMapUpdate",
"traits": {
"smithy.api#documentation": "<p>Tags to apply to an incident when calling the <code>StartIncident</code> API action.\n To call this action, you must also have permission to call the <code>TagResource</code>\n API action for the incident record resource.</p>"
}
}
}
},
Expand Down

0 comments on commit 3aff9aa

Please sign in to comment.