Skip to content

update_host_key async

update_host_key(
    server_id: ServerId,
    host_key_id: HostKeyId,
    *,
    config_overrides: Optional[AsyncTransferClientConfig] = None,
    description: Optional[HostKeyDescription] = None,
    storage_type: Optional[HostKeyStorageType] = None,
    kms_key: Optional[KmsKey] = None,
) -> UpdateHostKeyResponse

Updates the host key that's specified by the ServerId and HostKeyId parameters. You can update the description of the host key, change where the host key is stored by specifying the StorageType, and specify the KMS key used to encrypt the host key when it's stored in Secrets Manager.

To change a host key's storage type from SERVICE_MANAGED to SECRETS_MANAGER, you must have the transfer:ExportHostKey permission. transfer:ExportHostKey is a permission-only action that has no corresponding API operation.

Parameters:

  • server_id (ServerId) –

    The identifier of the server that contains the host key that you are updating.

  • host_key_id (HostKeyId) –

    The identifier of the host key that you are updating.

  • description (Optional[HostKeyDescription], default: None ) –

    An updated description for the host key.

  • storage_type (Optional[HostKeyStorageType], default: None ) –

    Specifies whether the host key is stored by Transfer Family (SERVICE_MANAGED) or in Secrets Manager (SECRETS_MANAGER). When you specify SECRETS_MANAGER, Transfer Family stores the private host key material in an Secrets Manager secret.

  • kms_key (Optional[KmsKey], default: None ) –

    The Amazon Resource Name (ARN) of the KMS key used to encrypt the Secrets Manager secret that stores the host key. If you specify a customer managed key, its key policy must allow the AWSServiceRoleForTransfer service-linked role to decrypt the secret. If you don't specify a value, Transfer Family uses the Amazon Web Services managed key for Secrets Manager.

Raises:

Source code in docs_src/capo_transfer/_services/async_transfer.py
async def update_host_key(
    self,
    server_id: "capo_transfer.types.server_id.ServerId",
    host_key_id: "capo_transfer.types.host_key_id.HostKeyId",
    *,
    config_overrides: Optional[AsyncTransferClientConfig] = None,
    description: Optional[
        "capo_transfer.types.host_key_description.HostKeyDescription"
    ] = None,
    storage_type: Optional[
        "capo_transfer.types.host_key_storage_type.HostKeyStorageType"
    ] = None,
    kms_key: Optional["capo_transfer.types.kms_key.KmsKey"] = None,
) -> "capo_transfer.types.update_host_key_response.UpdateHostKeyResponse":
    """<p>Updates the host key that's specified by the <code>ServerId</code> and <code>HostKeyId</code> parameters. You can update the description of the host key, change where the host key is stored by specifying the <code>StorageType</code>, and specify the KMS key used to encrypt the host key when it's stored in Secrets Manager.</p> <p>To change a host key's storage type from <code>SERVICE_MANAGED</code> to <code>SECRETS_MANAGER</code>, you must have the <code>transfer:ExportHostKey</code> permission. <code>transfer:ExportHostKey</code> is a permission-only action that has no corresponding API operation.</p>

    Args:
        server_id: <p>The identifier of the server that contains the host key that you are updating.</p>
        host_key_id: <p>The identifier of the host key that you are updating.</p>
        description: <p>An updated description for the host key.</p>
        storage_type: <p>Specifies whether the host key is stored by Transfer Family (<code>SERVICE_MANAGED</code>) or in Secrets Manager (<code>SECRETS_MANAGER</code>). When you specify <code>SECRETS_MANAGER</code>, Transfer Family stores the private host key material in an Secrets Manager secret.</p>
        kms_key: <p>The Amazon Resource Name (ARN) of the KMS key used to encrypt the Secrets Manager secret that stores the host key. If you specify a customer managed key, its key policy must allow the <code>AWSServiceRoleForTransfer</code> service-linked role to decrypt the secret. If you don't specify a value, Transfer Family uses the Amazon Web Services managed key for Secrets Manager.</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_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.update_host_key_request.UpdateHostKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_transfer.types.update_host_key_response.UpdateHostKeyResponse"
    ]:
        import capo_transfer._operations.transfer_service.update_host_key

        (
            output,
            http_response,
        ) = await capo_transfer._operations.transfer_service.update_host_key.async_update_host_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateHostKey")
    )
    input_: capo_transfer.types.update_host_key_request.UpdateHostKeyRequest = {
        "server_id": server_id,
        "host_key_id": host_key_id,
    }
    if description is not None:
        input_["description"] = description
    if storage_type is not None:
        input_["storage_type"] = storage_type
    if kms_key is not None:
        input_["kms_key"] = kms_key

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output