listHostKeys method

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

Returns a list of host keys for the server that's specified by the ServerId parameter.

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

Parameter serverId : The identifier of the server that contains the host keys that you want to view.

Parameter maxResults : The maximum number of items to return.

Parameter nextToken : When there are additional results that were not returned, a NextToken parameter is returned. You can use that value for a subsequent call to ListHostKeys to continue listing results.

Implementation

Future<ListHostKeysResponse> listHostKeys({
  required String serverId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'TransferService.ListHostKeys'
  };
  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 ListHostKeysResponse.fromJson(jsonResponse.body);
}