Skip to content

get_session_endpoint

get_session_endpoint(
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional[ClusterId] = None,
    session_id: Optional[SessionId] = None,
) -> GetSessionEndpointOutput

Returns the Spark Connect endpoint URL and a time-limited authentication token for the specified session. Use the endpoint and token to connect a PySpark client to the session. Call this operation again when the token expires to obtain a new one.

Parameters:

  • cluster_id (Optional[ClusterId], default: None ) –

    The ID of the cluster that the session belongs to.

  • session_id (Optional[SessionId], default: None ) –

    The ID of the session.

Raises:

Source code in docs_src/capo_emr/_services/emr.py
def get_session_endpoint(
    self,
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional["capo_emr.types.cluster_id.ClusterId"] = None,
    session_id: Optional["capo_emr.types.session_id.SessionId"] = None,
) -> "capo_emr.types.get_session_endpoint_output.GetSessionEndpointOutput":
    """<p>Returns the Spark Connect endpoint URL and a time-limited authentication token for the specified session. Use the endpoint and token to connect a PySpark client to the session. Call this operation again when the token expires to obtain a new one.</p>

    Args:
        cluster_id: <p>The ID of the cluster that the session belongs to.</p>
        session_id: <p>The ID of the session.</p>

    Raises:
        capo_emr.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Amazon EMR service.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr.types.get_session_endpoint_input.GetSessionEndpointInput]",
    ) -> OperationResponse[
        "capo_emr.types.get_session_endpoint_output.GetSessionEndpointOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.get_session_endpoint

        output, http_response = (
            capo_emr._operations.elastic_map_reduce.get_session_endpoint.get_session_endpoint(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_emr.types.get_session_endpoint_output.GetSessionEndpointOutput",
    ) -> dict[str, Any]:
        import capo_emr.types.get_session_endpoint_output

        return capo_emr.types.get_session_endpoint_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetSessionEndpoint", redact_output=_redact_output),
    )
    input_: capo_emr.types.get_session_endpoint_input.GetSessionEndpointInput = {}
    if cluster_id is not None:
        input_["cluster_id"] = cluster_id
    if session_id is not None:
        input_["session_id"] = session_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output