importSshPublicKey method
Adds a Secure Shell (SSH) public key to a Transfer Family user identified
by a UserName value assigned to the specific file transfer
protocol-enabled server, identified by ServerId.
The response returns the UserName value, the
ServerId value, and the name of the
SshPublicKeyId.
May throw InternalServiceError.
May throw InvalidRequestException.
May throw ResourceExistsException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter serverId :
A system-assigned unique identifier for a server.
Parameter sshPublicKeyBody :
The public key portion of an SSH key pair.
Transfer Family accepts RSA, ECDSA, and ED25519 keys.
Parameter userName :
The name of the Transfer Family user that is assigned to one or more
servers.
Implementation
Future<ImportSshPublicKeyResponse> importSshPublicKey({
required String serverId,
required String sshPublicKeyBody,
required String userName,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'TransferService.ImportSshPublicKey'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ServerId': serverId,
'SshPublicKeyBody': sshPublicKeyBody,
'UserName': userName,
},
);
return ImportSshPublicKeyResponse.fromJson(jsonResponse.body);
}