startIncident method

Future<StartIncidentOutput> startIncident({
  1. required String responsePlanArn,
  2. String? clientToken,
  3. int? impact,
  4. List<RelatedItem>? relatedItems,
  5. String? title,
  6. TriggerDetails? triggerDetails,
})

Used to start an incident from CloudWatch alarms, EventBridge events, or manually.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter responsePlanArn : 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.

Parameter clientToken : A token ensuring that the operation is called only once with the specified details.

Parameter impact : Defines the impact to the customers. Providing an impact overwrites the impact provided by a response plan.

Supported impact codes

  • 1 - Critical
  • 2 - High
  • 3 - Medium
  • 4 - Low
  • 5 - No Impact

Parameter relatedItems : Add related items to the incident for other responders to use. Related items are Amazon Web Services resources, external links, or files uploaded to an Amazon S3 bucket.

Parameter title : Provide a title for the incident. Providing a title overwrites the title provided by the response plan.

Parameter triggerDetails : Details of what created the incident record in Incident Manager.

Implementation

Future<StartIncidentOutput> startIncident({
  required String responsePlanArn,
  String? clientToken,
  int? impact,
  List<RelatedItem>? relatedItems,
  String? title,
  TriggerDetails? triggerDetails,
}) async {
  _s.validateNumRange(
    'impact',
    impact,
    1,
    5,
  );
  final $payload = <String, dynamic>{
    'responsePlanArn': responsePlanArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (impact != null) 'impact': impact,
    if (relatedItems != null) 'relatedItems': relatedItems,
    if (title != null) 'title': title,
    if (triggerDetails != null) 'triggerDetails': triggerDetails,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/startIncident',
    exceptionFnMap: _exceptionFns,
  );
  return StartIncidentOutput.fromJson(response);
}