Skip to content

get_thing_connectivity_data

get_thing_connectivity_data(
    thing_name: ConnectivityApiThingName,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    include_socket_information: Optional[Boolean] = None,
) -> GetThingConnectivityDataResponse

Retrieves the live connectivity status per device. If a device has never connected to IoT Core or was disconnected for more than 1 hour before fleet indexing's thingConnectivityIndexingMode was enabled, the response will have the connected field set to false with no additional session details.

Parameters:

  • thing_name (ConnectivityApiThingName) –

    The name of your IoT thing.

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

    Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp, vpcEndpointId) should be included in the GetThingConnectivityData response. Set to true to include socket information. Set to false to omit socket information. By default, this is set to false.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def get_thing_connectivity_data(
    self,
    thing_name: "capo_iot.types.connectivity_api_thing_name.ConnectivityApiThingName",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    include_socket_information: Optional["capo_iot.types.boolean.Boolean"] = None,
) -> "capo_iot.types.get_thing_connectivity_data_response.GetThingConnectivityDataResponse":
    """<p>Retrieves the live connectivity status per device. If a device has never connected to IoT Core or was disconnected for more than 1 hour before fleet indexing's <code>thingConnectivityIndexingMode</code> was enabled, the response will have the <code>connected</code> field set to <code>false</code> with no additional session details.</p>

    Args:
        thing_name: <p>The name of your IoT thing.</p>
        include_socket_information: <p>Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp, vpcEndpointId) should be included in the GetThingConnectivityData 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>.</p>

    Raises:
        capo_iot.errors.index_not_ready_exception.IndexNotReadyException: <p>The index is not ready.</p>
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.get_thing_connectivity_data_request.GetThingConnectivityDataRequest]",
    ) -> OperationResponse[
        "capo_iot.types.get_thing_connectivity_data_response.GetThingConnectivityDataResponse"
    ]:
        import capo_iot._operations.aws_iot_service.get_thing_connectivity_data

        output, http_response = (
            capo_iot._operations.aws_iot_service.get_thing_connectivity_data.get_thing_connectivity_data(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_iot.types.get_thing_connectivity_data_request.GetThingConnectivityDataRequest",
    ) -> dict[str, Any]:
        import capo_iot.types.get_thing_connectivity_data_request

        return capo_iot.types.get_thing_connectivity_data_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_iot.types.get_thing_connectivity_data_response.GetThingConnectivityDataResponse",
    ) -> dict[str, Any]:
        import capo_iot.types.get_thing_connectivity_data_response

        return capo_iot.types.get_thing_connectivity_data_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetThingConnectivityData",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_iot.types.get_thing_connectivity_data_request.GetThingConnectivityDataRequest = {
        "thing_name": thing_name
    }
    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