listScanJobs method

Future<ListScanJobsOutput> listScanJobs({
  1. String? byAccountId,
  2. String? byBackupVaultName,
  3. DateTime? byCompleteAfter,
  4. DateTime? byCompleteBefore,
  5. MalwareScanner? byMalwareScanner,
  6. String? byRecoveryPointArn,
  7. String? byResourceArn,
  8. ScanResourceType? byResourceType,
  9. ScanResultStatus? byScanResultStatus,
  10. ScanState? byState,
  11. int? maxResults,
  12. String? nextToken,
})

Returns a list of existing scan jobs for an authenticated account for the last 30 days.

May throw InvalidParameterValueException. May throw ServiceUnavailableException.

Parameter byAccountId : The account ID to list the jobs from. Returns only backup jobs associated with the specified account ID.

If used from an Amazon Web Services Organizations management account, passing * returns all jobs across the organization.

Pattern: ^[0-9]{12}$

Parameter byBackupVaultName : Returns only scan jobs that will be stored in the specified backup vault. Backup vaults are identified by names that are unique to the account used to create them and the Amazon Web Services Region where they are created.

Pattern: ^[a-zA-Z0-9-_.]{2,50}$

Parameter byCompleteAfter : Returns only scan jobs completed after a date expressed in Unix format and Coordinated Universal Time (UTC).

Parameter byCompleteBefore : Returns only backup jobs completed before a date expressed in Unix format and Coordinated Universal Time (UTC).

Parameter byMalwareScanner : Returns only the scan jobs for the specified malware scanner. Currently only supports GUARDDUTY.

Parameter byRecoveryPointArn : Returns only the scan jobs that are ran against the specified recovery point.

Parameter byResourceArn : Returns only scan jobs that match the specified resource Amazon Resource Name (ARN).

Parameter byResourceType : Returns restore testing selections by the specified restore testing plan name.

  • EBSfor Amazon Elastic Block Store
  • EC2for Amazon Elastic Compute Cloud
  • S3for Amazon Simple Storage Service (Amazon S3)
Pattern: ^\[a-zA-Z0-9\-\_\.\]{1,50}$

Parameter byScanResultStatus : Returns only the scan jobs for the specified scan results:

  • THREATS_FOUND
  • NO_THREATS_FOUND

Parameter byState : Returns only the scan jobs for the specified scanning job state.

Parameter maxResults : The maximum number of items to be returned.

Valid Range: Minimum value of 1. Maximum value of 1000.

Parameter nextToken : The next item following a partial list of returned items. For example, if a request is made to return MaxResults number of items, NextToken allows you to return more items in your list starting at the location pointed to by the next token.

Implementation

Future<ListScanJobsOutput> listScanJobs({
  String? byAccountId,
  String? byBackupVaultName,
  DateTime? byCompleteAfter,
  DateTime? byCompleteBefore,
  MalwareScanner? byMalwareScanner,
  String? byRecoveryPointArn,
  String? byResourceArn,
  ScanResourceType? byResourceType,
  ScanResultStatus? byScanResultStatus,
  ScanState? byState,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $query = <String, List<String>>{
    if (byAccountId != null) 'ByAccountId': [byAccountId],
    if (byBackupVaultName != null) 'ByBackupVaultName': [byBackupVaultName],
    if (byCompleteAfter != null)
      'ByCompleteAfter': [_s.iso8601ToJson(byCompleteAfter).toString()],
    if (byCompleteBefore != null)
      'ByCompleteBefore': [_s.iso8601ToJson(byCompleteBefore).toString()],
    if (byMalwareScanner != null)
      'ByMalwareScanner': [byMalwareScanner.value],
    if (byRecoveryPointArn != null)
      'ByRecoveryPointArn': [byRecoveryPointArn],
    if (byResourceArn != null) 'ByResourceArn': [byResourceArn],
    if (byResourceType != null) 'ByResourceType': [byResourceType.value],
    if (byScanResultStatus != null)
      'ByScanResultStatus': [byScanResultStatus.value],
    if (byState != null) 'ByState': [byState.value],
    if (maxResults != null) 'MaxResults': [maxResults.toString()],
    if (nextToken != null) 'NextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/scan/jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListScanJobsOutput.fromJson(response);
}