Interface IotDataPlaneClient
-
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface IotDataPlaneClient extends AwsClient
Service client for accessing AWS IoT Data Plane. This can be created using the staticbuilder()method.IoT data IoT data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. It implements a broker for applications and things to publish messages over HTTP (Publish) and retrieve, update, and delete shadows. A shadow is a persistent representation of your things and their state in the Amazon Web Services cloud.
Find the endpoint address for actions in IoT data by running this CLI command:
aws iot describe-endpoint --endpoint-type iot:Data-ATSThe service name used by Amazon Web ServicesSignature Version 4 to sign requests is: iotdevicegateway.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_METADATA_IDValue for looking up the service's metadata from theServiceMetadataProvider.static StringSERVICE_NAME
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static IotDataPlaneClientBuilderbuilder()Create a builder that can be used to configure and create aIotDataPlaneClient.static IotDataPlaneClientcreate()Create aIotDataPlaneClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default DeleteThingShadowResponsedeleteThingShadow(Consumer<DeleteThingShadowRequest.Builder> deleteThingShadowRequest)Deletes the shadow for the specified thing.default DeleteThingShadowResponsedeleteThingShadow(DeleteThingShadowRequest deleteThingShadowRequest)Deletes the shadow for the specified thing.default GetRetainedMessageResponsegetRetainedMessage(Consumer<GetRetainedMessageRequest.Builder> getRetainedMessageRequest)Gets the details of a single retained message for the specified topic.default GetRetainedMessageResponsegetRetainedMessage(GetRetainedMessageRequest getRetainedMessageRequest)Gets the details of a single retained message for the specified topic.default GetThingShadowResponsegetThingShadow(Consumer<GetThingShadowRequest.Builder> getThingShadowRequest)Gets the shadow for the specified thing.default GetThingShadowResponsegetThingShadow(GetThingShadowRequest getThingShadowRequest)Gets the shadow for the specified thing.default ListNamedShadowsForThingResponselistNamedShadowsForThing(Consumer<ListNamedShadowsForThingRequest.Builder> listNamedShadowsForThingRequest)Lists the shadows for the specified thing.default ListNamedShadowsForThingResponselistNamedShadowsForThing(ListNamedShadowsForThingRequest listNamedShadowsForThingRequest)Lists the shadows for the specified thing.default ListRetainedMessagesResponselistRetainedMessages(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest)Lists summary information about the retained messages stored for the account.default ListRetainedMessagesResponselistRetainedMessages(ListRetainedMessagesRequest listRetainedMessagesRequest)Lists summary information about the retained messages stored for the account.default ListRetainedMessagesIterablelistRetainedMessagesPaginator(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest)Lists summary information about the retained messages stored for the account.default ListRetainedMessagesIterablelistRetainedMessagesPaginator(ListRetainedMessagesRequest listRetainedMessagesRequest)Lists summary information about the retained messages stored for the account.default PublishResponsepublish(Consumer<PublishRequest.Builder> publishRequest)Publishes an MQTT message.default PublishResponsepublish(PublishRequest publishRequest)Publishes an MQTT message.default IotDataPlaneServiceClientConfigurationserviceClientConfiguration()static ServiceMetadataserviceMetadata()default UpdateThingShadowResponseupdateThingShadow(Consumer<UpdateThingShadowRequest.Builder> updateThingShadowRequest)Updates the shadow for the specified thing.default UpdateThingShadowResponseupdateThingShadow(UpdateThingShadowRequest updateThingShadowRequest)Updates the shadow for the specified thing.-
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
Methods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
- See Also:
- Constant Field Values
-
SERVICE_METADATA_ID
static final String SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
- Constant Field Values
-
-
Method Detail
-
deleteThingShadow
default DeleteThingShadowResponse deleteThingShadow(DeleteThingShadowRequest deleteThingShadowRequest) throws ResourceNotFoundException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Deletes the shadow for the specified thing.
Requires permission to access the DeleteThingShadow action.
For more information, see DeleteThingShadow in the IoT Developer Guide.
- Parameters:
deleteThingShadowRequest- The input for the DeleteThingShadow operation.- Returns:
- Result of the DeleteThingShadow operation returned by the service.
- Throws:
ResourceNotFoundException- The specified resource does not exist.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
deleteThingShadow
default DeleteThingShadowResponse deleteThingShadow(Consumer<DeleteThingShadowRequest.Builder> deleteThingShadowRequest) throws ResourceNotFoundException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Deletes the shadow for the specified thing.
Requires permission to access the DeleteThingShadow action.
For more information, see DeleteThingShadow in the IoT Developer Guide.
This is a convenience which creates an instance of the
DeleteThingShadowRequest.Builderavoiding the need to create one manually viaDeleteThingShadowRequest.builder()- Parameters:
deleteThingShadowRequest- AConsumerthat will call methods onDeleteThingShadowRequest.Builderto create a request. The input for the DeleteThingShadow operation.- Returns:
- Result of the DeleteThingShadow operation returned by the service.
- Throws:
ResourceNotFoundException- The specified resource does not exist.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getRetainedMessage
default GetRetainedMessageResponse getRetainedMessage(GetRetainedMessageRequest getRetainedMessageRequest) throws InvalidRequestException, ResourceNotFoundException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
Gets the details of a single retained message for the specified topic.
This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.
Requires permission to access the GetRetainedMessage action.
For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.
- Parameters:
getRetainedMessageRequest- The input for the GetRetainedMessage operation.- Returns:
- Result of the GetRetainedMessage operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ResourceNotFoundException- The specified resource does not exist.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getRetainedMessage
default GetRetainedMessageResponse getRetainedMessage(Consumer<GetRetainedMessageRequest.Builder> getRetainedMessageRequest) throws InvalidRequestException, ResourceNotFoundException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
Gets the details of a single retained message for the specified topic.
This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.
Requires permission to access the GetRetainedMessage action.
For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.
This is a convenience which creates an instance of the
GetRetainedMessageRequest.Builderavoiding the need to create one manually viaGetRetainedMessageRequest.builder()- Parameters:
getRetainedMessageRequest- AConsumerthat will call methods onGetRetainedMessageRequest.Builderto create a request. The input for the GetRetainedMessage operation.- Returns:
- Result of the GetRetainedMessage operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ResourceNotFoundException- The specified resource does not exist.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getThingShadow
default GetThingShadowResponse getThingShadow(GetThingShadowRequest getThingShadowRequest) throws InvalidRequestException, ResourceNotFoundException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Gets the shadow for the specified thing.
Requires permission to access the GetThingShadow action.
For more information, see GetThingShadow in the IoT Developer Guide.
- Parameters:
getThingShadowRequest- The input for the GetThingShadow operation.- Returns:
- Result of the GetThingShadow operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ResourceNotFoundException- The specified resource does not exist.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getThingShadow
default GetThingShadowResponse getThingShadow(Consumer<GetThingShadowRequest.Builder> getThingShadowRequest) throws InvalidRequestException, ResourceNotFoundException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Gets the shadow for the specified thing.
Requires permission to access the GetThingShadow action.
For more information, see GetThingShadow in the IoT Developer Guide.
This is a convenience which creates an instance of the
GetThingShadowRequest.Builderavoiding the need to create one manually viaGetThingShadowRequest.builder()- Parameters:
getThingShadowRequest- AConsumerthat will call methods onGetThingShadowRequest.Builderto create a request. The input for the GetThingShadow operation.- Returns:
- Result of the GetThingShadow operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ResourceNotFoundException- The specified resource does not exist.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listNamedShadowsForThing
default ListNamedShadowsForThingResponse listNamedShadowsForThing(ListNamedShadowsForThingRequest listNamedShadowsForThingRequest) throws ResourceNotFoundException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
Lists the shadows for the specified thing.
Requires permission to access the ListNamedShadowsForThing action.
- Parameters:
listNamedShadowsForThingRequest-- Returns:
- Result of the ListNamedShadowsForThing operation returned by the service.
- Throws:
ResourceNotFoundException- The specified resource does not exist.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listNamedShadowsForThing
default ListNamedShadowsForThingResponse listNamedShadowsForThing(Consumer<ListNamedShadowsForThingRequest.Builder> listNamedShadowsForThingRequest) throws ResourceNotFoundException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
Lists the shadows for the specified thing.
Requires permission to access the ListNamedShadowsForThing action.
This is a convenience which creates an instance of the
ListNamedShadowsForThingRequest.Builderavoiding the need to create one manually viaListNamedShadowsForThingRequest.builder()- Parameters:
listNamedShadowsForThingRequest- AConsumerthat will call methods onListNamedShadowsForThingRequest.Builderto create a request.- Returns:
- Result of the ListNamedShadowsForThing operation returned by the service.
- Throws:
ResourceNotFoundException- The specified resource does not exist.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRetainedMessages
default ListRetainedMessagesResponse listRetainedMessages(ListRetainedMessagesRequest listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
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:
listRetainedMessagesRequest-- Returns:
- Result of the ListRetainedMessages operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRetainedMessages
default ListRetainedMessagesResponse listRetainedMessages(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
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.
This is a convenience which creates an instance of the
ListRetainedMessagesRequest.Builderavoiding the need to create one manually viaListRetainedMessagesRequest.builder()- Parameters:
listRetainedMessagesRequest- AConsumerthat will call methods onListRetainedMessagesRequest.Builderto create a request.- Returns:
- Result of the ListRetainedMessages operation returned by the service.
- Throws:
InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRetainedMessagesPaginator
default ListRetainedMessagesIterable listRetainedMessagesPaginator(ListRetainedMessagesRequest listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
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.
This is a variant of
listRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client.listRetainedMessagesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client .listRetainedMessagesPaginator(request); for (software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client.listRetainedMessagesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)operation.- Parameters:
listRetainedMessagesRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRetainedMessagesPaginator
default ListRetainedMessagesIterable listRetainedMessagesPaginator(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException
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.
This is a variant of
listRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client.listRetainedMessagesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client .listRetainedMessagesPaginator(request); for (software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.iotdataplane.paginators.ListRetainedMessagesIterable responses = client.listRetainedMessagesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of maxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)operation.This is a convenience which creates an instance of the
ListRetainedMessagesRequest.Builderavoiding the need to create one manually viaListRetainedMessagesRequest.builder()- Parameters:
listRetainedMessagesRequest- AConsumerthat will call methods onListRetainedMessagesRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
publish
default PublishResponse publish(PublishRequest publishRequest) throws InternalFailureException, InvalidRequestException, UnauthorizedException, MethodNotAllowedException, ThrottlingException, AwsServiceException, SdkClientException, IotDataPlaneException
Publishes an MQTT message.
Requires permission to access the Publish action.
For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.
For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.
- Parameters:
publishRequest- The input for the Publish operation.- Returns:
- Result of the Publish operation returned by the service.
- Throws:
InternalFailureException- An unexpected error has occurred.InvalidRequestException- The request is not valid.UnauthorizedException- You are not authorized to perform this operation.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.ThrottlingException- The rate exceeds the limit.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
publish
default PublishResponse publish(Consumer<PublishRequest.Builder> publishRequest) throws InternalFailureException, InvalidRequestException, UnauthorizedException, MethodNotAllowedException, ThrottlingException, AwsServiceException, SdkClientException, IotDataPlaneException
Publishes an MQTT message.
Requires permission to access the Publish action.
For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.
For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.
This is a convenience which creates an instance of the
PublishRequest.Builderavoiding the need to create one manually viaPublishRequest.builder()- Parameters:
publishRequest- AConsumerthat will call methods onPublishRequest.Builderto create a request. The input for the Publish operation.- Returns:
- Result of the Publish operation returned by the service.
- Throws:
InternalFailureException- An unexpected error has occurred.InvalidRequestException- The request is not valid.UnauthorizedException- You are not authorized to perform this operation.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.ThrottlingException- The rate exceeds the limit.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updateThingShadow
default UpdateThingShadowResponse updateThingShadow(UpdateThingShadowRequest updateThingShadowRequest) throws ConflictException, RequestEntityTooLargeException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Updates the shadow for the specified thing.
Requires permission to access the UpdateThingShadow action.
For more information, see UpdateThingShadow in the IoT Developer Guide.
- Parameters:
updateThingShadowRequest- The input for the UpdateThingShadow operation.- Returns:
- Result of the UpdateThingShadow operation returned by the service.
- Throws:
ConflictException- The specified version does not match the version of the document.RequestEntityTooLargeException- The payload exceeds the maximum size allowed.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updateThingShadow
default UpdateThingShadowResponse updateThingShadow(Consumer<UpdateThingShadowRequest.Builder> updateThingShadowRequest) throws ConflictException, RequestEntityTooLargeException, InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, UnsupportedDocumentEncodingException, AwsServiceException, SdkClientException, IotDataPlaneException
Updates the shadow for the specified thing.
Requires permission to access the UpdateThingShadow action.
For more information, see UpdateThingShadow in the IoT Developer Guide.
This is a convenience which creates an instance of the
UpdateThingShadowRequest.Builderavoiding the need to create one manually viaUpdateThingShadowRequest.builder()- Parameters:
updateThingShadowRequest- AConsumerthat will call methods onUpdateThingShadowRequest.Builderto create a request. The input for the UpdateThingShadow operation.- Returns:
- Result of the UpdateThingShadow operation returned by the service.
- Throws:
ConflictException- The specified version does not match the version of the document.RequestEntityTooLargeException- The payload exceeds the maximum size allowed.InvalidRequestException- The request is not valid.ThrottlingException- The rate exceeds the limit.UnauthorizedException- You are not authorized to perform this operation.ServiceUnavailableException- The service is temporarily unavailable.InternalFailureException- An unexpected error has occurred.MethodNotAllowedException- The specified combination of HTTP verb and URI is not supported.UnsupportedDocumentEncodingException- The document encoding is not supported.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.IotDataPlaneException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
create
static IotDataPlaneClient create()
Create aIotDataPlaneClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.
-
builder
static IotDataPlaneClientBuilder builder()
Create a builder that can be used to configure and create aIotDataPlaneClient.
-
serviceMetadata
static ServiceMetadata serviceMetadata()
-
serviceClientConfiguration
default IotDataPlaneServiceClientConfiguration serviceClientConfiguration()
- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient
-
-