createAuditSuppression method
Creates a Device Defender audit suppression.
May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ThrottlingException. May throw InternalFailureException. May throw LimitExceededException.
Parameter clientRequestToken
:
The epoch timestamp in seconds at which this suppression expires.
Parameter description
:
The description of the audit suppression.
Parameter expirationDate
:
The epoch timestamp in seconds at which this suppression expires.
Parameter suppressIndefinitely
:
Indicates whether a suppression should exist indefinitely or not.
Implementation
Future<void> createAuditSuppression({
required String checkName,
required ResourceIdentifier resourceIdentifier,
String? clientRequestToken,
String? description,
DateTime? expirationDate,
bool? suppressIndefinitely,
}) async {
ArgumentError.checkNotNull(checkName, 'checkName');
ArgumentError.checkNotNull(resourceIdentifier, 'resourceIdentifier');
_s.validateStringLength(
'clientRequestToken',
clientRequestToken,
1,
64,
);
_s.validateStringLength(
'description',
description,
0,
1000,
);
final $payload = <String, dynamic>{
'checkName': checkName,
'resourceIdentifier': resourceIdentifier,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (expirationDate != null)
'expirationDate': unixTimestampToJson(expirationDate),
if (suppressIndefinitely != null)
'suppressIndefinitely': suppressIndefinitely,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/audit/suppressions/create',
exceptionFnMap: _exceptionFns,
);
}