Skip to content

create_mount_session async

create_mount_session(
    file_system_id: FileSystemId,
    *,
    config_overrides: Optional[AsyncS3FilesClientConfig] = None,
    preferred_availability_zone_id: Optional[AvailabilityZoneId] = None,
    network_origin: Optional[NetworkOrigin] = None,
) -> CreateMountSessionResponse

Creates a mount session for an S3 File System and returns a set of endpoints that you can use to mount the file system. Each endpoint includes an IP address, a port, and a mount token that a client presents when it connects to the endpoint.

Parameters:

  • file_system_id (FileSystemId) –

    The ID of the S3 File System for which to create the mount session.

  • preferred_availability_zone_id (Optional[AvailabilityZoneId], default: None ) –

    The ID of the Availability Zone (for example, use1-az1) in which you prefer the returned endpoints to be located. The Availability Zone must be in the same Amazon Web Services Region as the file system. This preference is best effort: if an endpoint in the preferred Availability Zone isn't available, endpoints in another Availability Zone are returned instead of failing the request. If you don't specify a value, endpoints are returned without an Availability Zone preference.

  • network_origin (Optional[NetworkOrigin], default: None ) –

    Indicates whether the client connects to the file system from within the Amazon Web Services Cloud (AWS_NETWORK). External network (EXTERNAL_NETWORK) connections are not supported.

Raises:

  • ThrottlingException –

    The request was throttled. Retry your request using exponential backoff.

  • ConflictException –

    The request conflicts with the current state of the resource. This can occur when trying to create a resource that already exists or delete a resource that is in use.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ResourceNotFoundException –

    The specified resource was not found. Verify that the resource exists and that you have permission to access it.

  • ValidationException –

    The input parameters are not valid. Check the parameter values and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_s3files/_services/async_s3_files.py
async def create_mount_session(
    self,
    file_system_id: "capo_s3files.types.file_system_id.FileSystemId",
    *,
    config_overrides: Optional[AsyncS3FilesClientConfig] = None,
    preferred_availability_zone_id: Optional[
        "capo_s3files.types.availability_zone_id.AvailabilityZoneId"
    ] = None,
    network_origin: Optional[
        "capo_s3files.types.network_origin.NetworkOrigin"
    ] = None,
) -> "capo_s3files.types.create_mount_session_response.CreateMountSessionResponse":
    """<p>Creates a mount session for an S3 File System and returns a set of endpoints that you can use to mount the file system. Each endpoint includes an IP address, a port, and a mount token that a client presents when it connects to the endpoint.</p>

    Args:
        file_system_id: <p>The ID of the S3 File System for which to create the mount session.</p>
        preferred_availability_zone_id: <p>The ID of the Availability Zone (for example, <code>use1-az1</code>) in which you prefer the returned endpoints to be located. The Availability Zone must be in the same Amazon Web Services Region as the file system. This preference is best effort: if an endpoint in the preferred Availability Zone isn't available, endpoints in another Availability Zone are returned instead of failing the request. If you don't specify a value, endpoints are returned without an Availability Zone preference.</p>
        network_origin: <p>Indicates whether the client connects to the file system from within the Amazon Web Services Cloud (<code>AWS_NETWORK</code>). External network (<code>EXTERNAL_NETWORK</code>) connections are not supported.</p>

    Raises:
        capo_s3files.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry your request using exponential backoff.</p>
        capo_s3files.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. This can occur when trying to create a resource that already exists or delete a resource that is in use.</p>
        capo_s3files.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_s3files.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify that the resource exists and that you have permission to access it.</p>
        capo_s3files.errors.validation_exception.ValidationException: <p>The input parameters are not valid. Check the parameter values and try again.</p>
        capo_s3files.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3files.types.create_mount_session_request.CreateMountSessionRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3files.types.create_mount_session_response.CreateMountSessionResponse"
    ]:
        import capo_s3files._operations.s3_files.create_mount_session

        (
            output,
            http_response,
        ) = await capo_s3files._operations.s3_files.create_mount_session.async_create_mount_session(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_s3files.types.create_mount_session_response.CreateMountSessionResponse",
    ) -> dict[str, Any]:
        import capo_s3files.types.create_mount_session_response

        return capo_s3files.types.create_mount_session_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateMountSession", redact_output=_redact_output),
    )
    input_: capo_s3files.types.create_mount_session_request.CreateMountSessionRequest = {
        "file_system_id": file_system_id
    }
    if preferred_availability_zone_id is not None:
        input_["preferred_availability_zone_id"] = preferred_availability_zone_id
    if network_origin is not None:
        input_["network_origin"] = network_origin

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