Skip to content

list_retained_messages async

list_retained_messages(
    *,
    config_overrides: Optional[AsyncIoTDataPlaneClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListRetainedMessagesResponse

Lists summary information about the retained messages stored for the account.

This action returns only the topic names of the retained messages. It doesn't return any message payloads. Although this action doesn't return a message payload, it can still incur messaging costs.

To get the message payload of a retained message, call GetRetainedMessage with the topic name of the retained message.

Requires permission to access the ListRetainedMessages action.

For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

Parameters:

  • next_token (Optional[NextToken], default: None ) –

    To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return at one time.

Raises:

Source code in docs_src/capo_iot_data_plane/_services/async_io_t_data_plane.py
async def list_retained_messages(
    self,
    *,
    config_overrides: Optional[AsyncIoTDataPlaneClientConfig] = None,
    next_token: Optional["capo_iot_data_plane.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_iot_data_plane.types.max_results.MaxResults"
    ] = None,
) -> "capo_iot_data_plane.types.list_retained_messages_response.ListRetainedMessagesResponse":
    """<p>Lists summary information about the retained messages stored for the account.</p> <p>This action returns only the topic names of the retained messages. It doesn't return any message payloads. Although this action doesn't return a message payload, it can still incur messaging costs.</p> <p>To get the message payload of a retained message, call <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_iotdata_GetRetainedMessage.html">GetRetainedMessage</a> with the topic name of the retained message.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html">ListRetainedMessages</a> action.</p> <p>For more information about messaging costs, see <a href="http://aws.amazon.com/iot-core/pricing/#Messaging">Amazon Web Services IoT Core pricing - Messaging</a>.</p>

    Args:
        next_token: <p>To retrieve the next set of results, the <code>nextToken</code> value from a previous response; otherwise <b>null</b> to receive the first set of results.</p>
        max_results: <p>The maximum number of results to return at one time.</p>

    Raises:
        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.method_not_allowed_exception.MethodNotAllowedException: <p>The specified combination of HTTP verb and URI is not supported.</p>
        capo_iot_data_plane.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot_data_plane.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_data_plane.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot_data_plane.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot_data_plane.types.list_retained_messages_request.ListRetainedMessagesRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_data_plane.types.list_retained_messages_response.ListRetainedMessagesResponse"
    ]:
        import capo_iot_data_plane._operations.iot_moonraker_service.list_retained_messages

        (
            output,
            http_response,
        ) = await capo_iot_data_plane._operations.iot_moonraker_service.list_retained_messages.async_list_retained_messages(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRetainedMessages")
    )
    input_: capo_iot_data_plane.types.list_retained_messages_request.ListRetainedMessagesRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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