Interface IotDataPlaneClient
- All Superinterfaces:
AutoCloseable
,AwsClient
,SdkAutoCloseable
,SdkClient
builder()
method.
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-ATS
The service name used by Amazon Web ServicesSignature Version 4 to sign requests is: iotdevicegateway.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Value for looking up the service's metadata from theServiceMetadataProvider
.static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic IotDataPlaneClientBuilder
builder()
Create a builder that can be used to configure and create aIotDataPlaneClient
.static IotDataPlaneClient
create()
Create aIotDataPlaneClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
.default DeleteThingShadowResponse
deleteThingShadow
(Consumer<DeleteThingShadowRequest.Builder> deleteThingShadowRequest) Deletes the shadow for the specified thing.default DeleteThingShadowResponse
deleteThingShadow
(DeleteThingShadowRequest deleteThingShadowRequest) Deletes the shadow for the specified thing.default GetRetainedMessageResponse
getRetainedMessage
(Consumer<GetRetainedMessageRequest.Builder> getRetainedMessageRequest) Gets the details of a single retained message for the specified topic.default GetRetainedMessageResponse
getRetainedMessage
(GetRetainedMessageRequest getRetainedMessageRequest) Gets the details of a single retained message for the specified topic.default GetThingShadowResponse
getThingShadow
(Consumer<GetThingShadowRequest.Builder> getThingShadowRequest) Gets the shadow for the specified thing.default GetThingShadowResponse
getThingShadow
(GetThingShadowRequest getThingShadowRequest) Gets the shadow for the specified thing.default ListNamedShadowsForThingResponse
listNamedShadowsForThing
(Consumer<ListNamedShadowsForThingRequest.Builder> listNamedShadowsForThingRequest) Lists the shadows for the specified thing.default ListNamedShadowsForThingResponse
listNamedShadowsForThing
(ListNamedShadowsForThingRequest listNamedShadowsForThingRequest) Lists the shadows for the specified thing.default ListRetainedMessagesResponse
listRetainedMessages
(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest) Lists summary information about the retained messages stored for the account.default ListRetainedMessagesResponse
listRetainedMessages
(ListRetainedMessagesRequest listRetainedMessagesRequest) Lists summary information about the retained messages stored for the account.default ListRetainedMessagesIterable
listRetainedMessagesPaginator
(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest) This is a variant oflistRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)
operation.default ListRetainedMessagesIterable
listRetainedMessagesPaginator
(ListRetainedMessagesRequest listRetainedMessagesRequest) This is a variant oflistRetainedMessages(software.amazon.awssdk.services.iotdataplane.model.ListRetainedMessagesRequest)
operation.default PublishResponse
publish
(Consumer<PublishRequest.Builder> publishRequest) Publishes an MQTT message.default PublishResponse
publish
(PublishRequest publishRequest) Publishes an MQTT message.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadata
default UpdateThingShadowResponse
updateThingShadow
(Consumer<UpdateThingShadowRequest.Builder> updateThingShadowRequest) Updates the shadow for the specified thing.default UpdateThingShadowResponse
updateThingShadow
(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 Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider
.- See Also:
-
-
Method Details
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaDeleteThingShadowRequest.builder()
- Parameters:
deleteThingShadowRequest
- AConsumer
that will call methods onDeleteThingShadowRequest.Builder
to create a request. The input for the DeleteThingShadow operation.- Returns:
- Result of the DeleteThingShadow operation returned by the service.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaGetRetainedMessageRequest.builder()
- Parameters:
getRetainedMessageRequest
- AConsumer
that will call methods onGetRetainedMessageRequest.Builder
to create a request. The input for the GetRetainedMessage operation.- Returns:
- Result of the GetRetainedMessage operation returned by the service.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaGetThingShadowRequest.builder()
- Parameters:
getThingShadowRequest
- AConsumer
that will call methods onGetThingShadowRequest.Builder
to create a request. The input for the GetThingShadow operation.- Returns:
- Result of the GetThingShadow operation returned by the service.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaListNamedShadowsForThingRequest.builder()
- Parameters:
listNamedShadowsForThingRequest
- AConsumer
that will call methods onListNamedShadowsForThingRequest.Builder
to create a request.- Returns:
- Result of the ListNamedShadowsForThing operation returned by the service.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaListRetainedMessagesRequest.builder()
- Parameters:
listRetainedMessagesRequest
- AConsumer
that will call methods onListRetainedMessagesRequest.Builder
to create a request.- Returns:
- Result of the ListRetainedMessages operation returned by the service.
- See Also:
-
listRetainedMessagesPaginator
default ListRetainedMessagesIterable listRetainedMessagesPaginator(ListRetainedMessagesRequest listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException 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 Streamsoftware.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.
- See Also:
-
listRetainedMessagesPaginator
default ListRetainedMessagesIterable listRetainedMessagesPaginator(Consumer<ListRetainedMessagesRequest.Builder> listRetainedMessagesRequest) throws InvalidRequestException, ThrottlingException, UnauthorizedException, ServiceUnavailableException, InternalFailureException, MethodNotAllowedException, AwsServiceException, SdkClientException, IotDataPlaneException 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 Streamsoftware.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.Builder
avoiding the need to create one manually viaListRetainedMessagesRequest.builder()
- Parameters:
listRetainedMessagesRequest
- AConsumer
that will call methods onListRetainedMessagesRequest.Builder
to create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaPublishRequest.builder()
- Parameters:
publishRequest
- AConsumer
that will call methods onPublishRequest.Builder
to create a request. The input for the Publish operation.- Returns:
- Result of the Publish operation returned by the service.
- See Also:
-
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.
- See Also:
-
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.Builder
avoiding the need to create one manually viaUpdateThingShadowRequest.builder()
- Parameters:
updateThingShadowRequest
- AConsumer
that will call methods onUpdateThingShadowRequest.Builder
to create a request. The input for the UpdateThingShadow operation.- Returns:
- Result of the UpdateThingShadow operation returned by the service.
- See Also:
-
create
Create aIotDataPlaneClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
. -
builder
Create a builder that can be used to configure and create aIotDataPlaneClient
. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClient
The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfiguration
in interfaceAwsClient
- Specified by:
serviceClientConfiguration
in interfaceSdkClient
- Returns:
- SdkServiceClientConfiguration
-