updateAccountAuditConfiguration method

Future<void> updateAccountAuditConfiguration({
  1. Map<String, AuditCheckConfiguration>? auditCheckConfigurations,
  2. Map<AuditNotificationType, AuditNotificationTarget>? auditNotificationTargetConfigurations,
  3. String? roleArn,
})

Configures or reconfigures the Device Defender audit settings for this account. Settings include how audit notifications are sent and which audit checks are enabled or disabled.

May throw InvalidRequestException. May throw ThrottlingException. May throw InternalFailureException.

Parameter auditCheckConfigurations : Specifies which audit checks are enabled and disabled for this account. Use DescribeAccountAuditConfiguration to see the list of all checks, including those that are currently enabled.

Some data collection might start immediately when certain checks are enabled. When a check is disabled, any data collected so far in relation to the check is deleted.

You cannot disable a check if it's used by any scheduled audit. You must first delete the check from the scheduled audit or delete the scheduled audit itself.

On the first call to UpdateAccountAuditConfiguration, this parameter is required and must specify at least one enabled check.

Parameter auditNotificationTargetConfigurations : Information about the targets to which audit notifications are sent.

Parameter roleArn : The Amazon Resource Name (ARN) of the role that grants permission to AWS IoT to access information about your devices, policies, certificates, and other items as required when performing an audit.

Implementation

Future<void> updateAccountAuditConfiguration({
  Map<String, AuditCheckConfiguration>? auditCheckConfigurations,
  Map<AuditNotificationType, AuditNotificationTarget>?
      auditNotificationTargetConfigurations,
  String? roleArn,
}) async {
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
  );
  final $payload = <String, dynamic>{
    if (auditCheckConfigurations != null)
      'auditCheckConfigurations': auditCheckConfigurations,
    if (auditNotificationTargetConfigurations != null)
      'auditNotificationTargetConfigurations':
          auditNotificationTargetConfigurations
              .map((k, e) => MapEntry(k.toValue(), e)),
    if (roleArn != null) 'roleArn': roleArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/audit/configuration',
    exceptionFnMap: _exceptionFns,
  );
}