listUsers method

Future<ListUsersResponse> listUsers({
  1. required String serverId,
  2. int? maxResults,
  3. String? nextToken,
})

Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter.

May throw ServiceUnavailableException. May throw InternalServiceError. May throw InvalidNextTokenException. May throw InvalidRequestException. May throw ResourceNotFoundException.

Parameter serverId : A system-assigned unique identifier for a server that has users assigned to it.

Parameter maxResults : Specifies the number of users to return as a response to the ListUsers request.

Parameter nextToken : When you can get additional results from the ListUsers call, a NextToken parameter is returned in the output. You can then pass in a subsequent command to the NextToken parameter to continue listing additional users.

Implementation

Future<ListUsersResponse> listUsers({
  required String serverId,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(serverId, 'serverId');
  _s.validateStringLength(
    'serverId',
    serverId,
    19,
    19,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    6144,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'TransferService.ListUsers'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServerId': serverId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListUsersResponse.fromJson(jsonResponse.body);
}