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.
Parameters:
-
server_id
(ServerId)
–
A system-assigned unique identifier for a server.
-
ssh_public_key_body
(SshPublicKeyBody)
–
The public key portion of an SSH key pair.
Transfer Family accepts RSA, ECDSA, and ED25519 keys.
-
user_name
(UserName)
–
The name of the Transfer Family user that is assigned to one or more servers.
Raises:
Source code in docs_src/capo_transfer/_services/async_transfer.py
| async def import_ssh_public_key(
self,
server_id: "capo_transfer.types.server_id.ServerId",
ssh_public_key_body: "capo_transfer.types.ssh_public_key_body.SshPublicKeyBody",
user_name: "capo_transfer.types.user_name.UserName",
*,
config_overrides: Optional[AsyncTransferClientConfig] = None,
) -> (
"capo_transfer.types.import_ssh_public_key_response.ImportSshPublicKeyResponse"
):
"""<p>Adds a Secure Shell (SSH) public key to a Transfer Family user identified by a <code>UserName</code> value assigned to the specific file transfer protocol-enabled server, identified by <code>ServerId</code>.</p> <p>The response returns the <code>UserName</code> value, the <code>ServerId</code> value, and the name of the <code>SshPublicKeyId</code>.</p>
Args:
server_id: <p>A system-assigned unique identifier for a server.</p>
ssh_public_key_body: <p>The public key portion of an SSH key pair.</p> <p>Transfer Family accepts RSA, ECDSA, and ED25519 keys.</p>
user_name: <p>The name of the Transfer Family user that is assigned to one or more servers.</p>
Raises:
capo_transfer.errors.internal_service_error.InternalServiceError: <p>This exception is thrown when an error occurs in the Transfer Family service.</p>
capo_transfer.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
capo_transfer.errors.resource_exists_exception.ResourceExistsException: <p>The requested resource does not exist, or exists in a region other than the one specified for the command.</p>
capo_transfer.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family service.</p>
capo_transfer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed because the Amazon Web ServicesTransfer Family service is not available.</p>
capo_transfer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
capo_transfer.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_transfer.types.import_ssh_public_key_request.ImportSshPublicKeyRequest]",
) -> AsyncOperationResponse[
"capo_transfer.types.import_ssh_public_key_response.ImportSshPublicKeyResponse"
]:
import capo_transfer._operations.transfer_service.import_ssh_public_key
(
output,
http_response,
) = await capo_transfer._operations.transfer_service.import_ssh_public_key.async_import_ssh_public_key(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ImportSshPublicKey")
)
input_: capo_transfer.types.import_ssh_public_key_request.ImportSshPublicKeyRequest = {
"server_id": server_id,
"ssh_public_key_body": ssh_public_key_body,
"user_name": user_name,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|