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 ValidationException. May throw ResourceNotFoundException.

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 AWS CloudWatch. FULL will include any supplemental information provided by AWS 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.

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 {
  ArgumentError.checkNotNull(arn, 'arn');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
  );
  final $payload = <String, dynamic>{
    'Arn': arn,
    if (detailType != null) 'DetailType': detailType.toValue(),
    if (eventTypeIds != null) 'EventTypeIds': eventTypeIds,
    if (name != null) 'Name': name,
    if (status != null) 'Status': status.toValue(),
    if (targets != null) 'Targets': targets,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/updateNotificationRule',
    exceptionFnMap: _exceptionFns,
  );
}