updateNotificationRule method

Future<void> updateNotificationRule({
  1. required String arn,
  2. DetailType? detailType,
  3. List<String>? eventTypeIds,
  4. String? name,
  5. NotificationRuleStatus? status,
  6. List<Target>? targets,
})

Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications.

May throw ConfigurationException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter arn : The Amazon Resource Name (ARN) of the notification rule.

Parameter detailType : The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in Amazon CloudWatch. FULL will include any supplemental information provided by CodeStar Notifications and/or the service for the resource for which the notification is created.

Parameter eventTypeIds : A list of event types associated with this notification rule. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.

Parameter name : The name of the notification rule.

Parameter status : The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications).

Parameter targets : The address and type of the targets to receive notifications from this notification rule.

Implementation

Future<void> updateNotificationRule({
  required String arn,
  DetailType? detailType,
  List<String>? eventTypeIds,
  String? name,
  NotificationRuleStatus? status,
  List<Target>? targets,
}) async {
  final $payload = <String, dynamic>{
    'Arn': arn,
    if (detailType != null) 'DetailType': detailType.value,
    if (eventTypeIds != null) 'EventTypeIds': eventTypeIds,
    if (name != null) 'Name': name,
    if (status != null) 'Status': status.value,
    if (targets != null) 'Targets': targets,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/updateNotificationRule',
    exceptionFnMap: _exceptionFns,
  );
}