listRestoreJobsByProtectedResource method

Future<ListRestoreJobsByProtectedResourceOutput> listRestoreJobsByProtectedResource({
  1. required String resourceArn,
  2. DateTime? byRecoveryPointCreationDateAfter,
  3. DateTime? byRecoveryPointCreationDateBefore,
  4. RestoreJobStatus? byStatus,
  5. int? maxResults,
  6. String? nextToken,
})

This returns restore jobs that contain the specified protected resource.

You must include ResourceArn. You can optionally include NextToken, ByStatus, MaxResults, ByRecoveryPointCreationDateAfter , and ByRecoveryPointCreationDateBefore.

May throw InvalidParameterValueException. May throw MissingParameterValueException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

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

Parameter byRecoveryPointCreationDateAfter : Returns only restore jobs of recovery points that were created after the specified date.

Parameter byRecoveryPointCreationDateBefore : Returns only restore jobs of recovery points that were created before the specified date.

Parameter byStatus : Returns only restore jobs associated with the specified job status.

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

Parameter nextToken : The next item following a partial list of returned items. For example, if a request ismade 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<ListRestoreJobsByProtectedResourceOutput>
    listRestoreJobsByProtectedResource({
  required String resourceArn,
  DateTime? byRecoveryPointCreationDateAfter,
  DateTime? byRecoveryPointCreationDateBefore,
  RestoreJobStatus? byStatus,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $query = <String, List<String>>{
    if (byRecoveryPointCreationDateAfter != null)
      'recoveryPointCreationDateAfter': [
        _s.iso8601ToJson(byRecoveryPointCreationDateAfter).toString()
      ],
    if (byRecoveryPointCreationDateBefore != null)
      'recoveryPointCreationDateBefore': [
        _s.iso8601ToJson(byRecoveryPointCreationDateBefore).toString()
      ],
    if (byStatus != null) 'status': [byStatus.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/resources/${Uri.encodeComponent(resourceArn)}/restore-jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListRestoreJobsByProtectedResourceOutput.fromJson(response);
}