listMigrationTasks method

Future<ListMigrationTasksResult> listMigrationTasks({
  1. int? maxResults,
  2. String? nextToken,
  3. String? resourceName,
})

Lists all, or filtered by resource name, migration tasks associated with the user account making this call. This API has the following traits:

  • Can show a summary list of the most recent migration tasks.
  • Can show a summary list of migration tasks associated with a given discovered resource.
  • Lists migration tasks in a paginated interface.

May throw AccessDeniedException. May throw ThrottlingException. May throw InternalServerError. May throw ServiceUnavailableException. May throw InvalidInputException. May throw PolicyErrorException. May throw ResourceNotFoundException. May throw HomeRegionNotSetException.

Parameter maxResults : Value to specify how many results are returned per page.

Parameter nextToken : If a NextToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in NextToken.

Parameter resourceName : Filter migration tasks by discovered resource name.

Implementation

Future<ListMigrationTasksResult> listMigrationTasks({
  int? maxResults,
  String? nextToken,
  String? resourceName,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    2048,
  );
  _s.validateStringLength(
    'resourceName',
    resourceName,
    1,
    1600,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSMigrationHub.ListMigrationTasks'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceName != null) 'ResourceName': resourceName,
    },
  );

  return ListMigrationTasksResult.fromJson(jsonResponse.body);
}