Skip to content

get_connection

get_connection(
    client_id: ClientId,
    *,
    config_overrides: Optional[IoTDataPlaneClientConfig] = None,
    include_socket_information: Optional[IncludeSocketInformation] = None,
) -> GetConnectionResponse

Retrieves connection information for the specified MQTT client.

Requires permission to access the GetConnection action.

Parameters:

  • client_id (ClientId) –

    The unique identifier of the MQTT client to retrieve connection information. The client ID can't start with a dollar sign ($).

    MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.

  • include_socket_information (Optional[IncludeSocketInformation], default: None ) –

    Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp) should be included in the GetConnection response. Set to TRUE to include socket information. Set to FALSE to omit socket information. By default, this is set to FALSE. See the developer guide for how to authorize this parameter.

Raises:

Source code in docs_src/capo_iot_data_plane/_services/io_t_data_plane.py
def get_connection(
    self,
    client_id: "capo_iot_data_plane.types.client_id.ClientId",
    *,
    config_overrides: Optional[IoTDataPlaneClientConfig] = None,
    include_socket_information: Optional[
        "capo_iot_data_plane.types.include_socket_information.IncludeSocketInformation"
    ] = None,
) -> "capo_iot_data_plane.types.get_connection_response.GetConnectionResponse":
    """<p>Retrieves connection information for the specified MQTT client.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">GetConnection</a> action.</p>

    Args:
        client_id: <p>The unique identifier of the MQTT client to retrieve connection information. The client ID can't start with a dollar sign ($).</p> <p>MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.</p>
        include_socket_information: <p>Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp) should be included in the GetConnection response. Set to <code>TRUE</code> to include socket information. Set to <code>FALSE</code> to omit socket information. By default, this is set to <code>FALSE</code>. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html#mqtt-client-disconnect">developer guide</a> for how to authorize this parameter.</p>

    Raises:
        capo_iot_data_plane.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request.</p>
        capo_iot_data_plane.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot_data_plane.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot_data_plane.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot_data_plane.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_data_plane.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot_data_plane.types.get_connection_request.GetConnectionRequest]",
    ) -> OperationResponse[
        "capo_iot_data_plane.types.get_connection_response.GetConnectionResponse"
    ]:
        import capo_iot_data_plane._operations.iot_moonraker_service.get_connection

        output, http_response = (
            capo_iot_data_plane._operations.iot_moonraker_service.get_connection.get_connection(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetConnection")
    )
    input_: capo_iot_data_plane.types.get_connection_request.GetConnectionRequest = {
        "client_id": client_id
    }
    if include_socket_information is not None:
        input_["include_socket_information"] = include_socket_information

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