createScheduledAudit method
Creates a scheduled audit that is run at a specified time interval.
May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ThrottlingException. May throw InternalFailureException. May throw LimitExceededException.
Parameter frequency
:
How often the scheduled audit takes place, either DAILY
,
WEEKLY
, BIWEEKLY
or MONTHLY
. The
start time of each audit is determined by the system.
Parameter scheduledAuditName
:
The name you want to give to the scheduled audit. (Max. 128 chars)
Parameter targetCheckNames
:
Which checks are performed during the scheduled audit. Checks must be
enabled for your account. (Use
DescribeAccountAuditConfiguration
to see the list of all
checks, including those that are enabled or use
UpdateAccountAuditConfiguration
to select which checks are
enabled.)
Parameter dayOfMonth
:
The day of the month on which the scheduled audit takes place. This can be
"1" through "31" or "LAST". This field is required if the "frequency"
parameter is set to MONTHLY
. If days 29 to 31 are specified,
and the month doesn't have that many days, the audit takes place on the
LAST
day of the month.
Parameter dayOfWeek
:
The day of the week on which the scheduled audit takes place, either
SUN
, MON
, TUE
, WED
,
THU
, FRI
, or SAT
. This field is
required if the frequency
parameter is set to
WEEKLY
or BIWEEKLY
.
Parameter tags
:
Metadata that can be used to manage the scheduled audit.
Implementation
Future<CreateScheduledAuditResponse> createScheduledAudit({
required AuditFrequency frequency,
required String scheduledAuditName,
required List<String> targetCheckNames,
String? dayOfMonth,
DayOfWeek? dayOfWeek,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(frequency, 'frequency');
ArgumentError.checkNotNull(scheduledAuditName, 'scheduledAuditName');
_s.validateStringLength(
'scheduledAuditName',
scheduledAuditName,
1,
128,
isRequired: true,
);
ArgumentError.checkNotNull(targetCheckNames, 'targetCheckNames');
final $payload = <String, dynamic>{
'frequency': frequency.toValue(),
'targetCheckNames': targetCheckNames,
if (dayOfMonth != null) 'dayOfMonth': dayOfMonth,
if (dayOfWeek != null) 'dayOfWeek': dayOfWeek.toValue(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/audit/scheduledaudits/${Uri.encodeComponent(scheduledAuditName)}',
exceptionFnMap: _exceptionFns,
);
return CreateScheduledAuditResponse.fromJson(response);
}