public class AWSIotDataClient extends AmazonWebServiceClient implements AWSIotData
AWS IoT-Data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the AWS 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 AWS cloud.
Find the endpoint address for actions in the AWS IoT data plane by running this CLI command:
aws iot describe-endpoint --endpoint-type iot:Data-ATS
The service name used by AWS Signature Version 4 to sign requests is: iotdevicegateway.
LOGGING_AWS_REQUEST_METRIC
Constructor and Description |
---|
AWSIotDataClient()
Deprecated.
|
AWSIotDataClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on AWSIotData using the
specified AWS account credentials.
|
AWSIotDataClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AWSIotData using the
specified AWS account credentials and client configuration options.
|
AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on AWSIotData using the
specified AWS account credentials provider.
|
AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AWSIotData using the
specified AWS account credentials provider and client configuration
options.
|
AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
HttpClient httpClient)
Constructs a new client to invoke service methods on AWSIotData using the
specified AWS account credentials provider, client configuration options
and request metric collector.
|
AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
com.amazonaws.metrics.RequestMetricCollector requestMetricCollector)
Deprecated.
|
AWSIotDataClient(ClientConfiguration clientConfiguration)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
DeleteThingShadowResult |
deleteThingShadow(DeleteThingShadowRequest deleteThingShadowRequest)
Deletes the shadow for the specified thing.
|
ResponseMetadata |
getCachedResponseMetadata(AmazonWebServiceRequest request)
Deprecated.
ResponseMetadata cache can hold up to 50 requests and
responses in memory and will cause memory issue. This method
now always returns null.
|
GetThingShadowResult |
getThingShadow(GetThingShadowRequest getThingShadowRequest)
Gets the shadow for the specified thing.
|
ListNamedShadowsForThingResult |
listNamedShadowsForThing(ListNamedShadowsForThingRequest listNamedShadowsForThingRequest)
Lists the shadows for the specified thing.
|
void |
publish(PublishRequest publishRequest)
Publishes state information.
|
UpdateThingShadowResult |
updateThingShadow(UpdateThingShadowRequest updateThingShadowRequest)
Updates the shadow for the specified thing.
|
addRequestHandler, addRequestHandler, getEndpoint, getEndpointPrefix, getRegions, getRequestMetricsCollector, getServiceName, getSignerByURI, getSignerRegionOverride, getTimeOffset, removeRequestHandler, removeRequestHandler, setConfiguration, setEndpoint, setEndpoint, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, shutdown, withTimeOffset
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setEndpoint, setRegion, shutdown
@Deprecated public AWSIotDataClient()
All service calls made using this new client object are blocking, and will not return until the service call completes.
DefaultAWSCredentialsProviderChain
@Deprecated public AWSIotDataClient(ClientConfiguration clientConfiguration)
All service calls made using this new client object are blocking, and will not return until the service call completes.
clientConfiguration
- The client configuration options controlling
how this client connects to AWSIotData (ex: proxy settings,
retry counts, etc.).DefaultAWSCredentialsProviderChain
public AWSIotDataClient(AWSCredentials awsCredentials)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AWSIotDataClient client = new AWSIotDataClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.public AWSIotDataClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AWSIotDataClient client = new AWSIotDataClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.clientConfiguration
- The client configuration options controlling
how this client connects to AWSIotData (ex: proxy settings,
retry counts, etc.).public AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AWSIotDataClient client = new AWSIotDataClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.public AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AWSIotDataClient client = new AWSIotDataClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AWSIotData (ex: proxy settings,
retry counts, etc.).@Deprecated public AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, com.amazonaws.metrics.RequestMetricCollector requestMetricCollector)
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AWSIotData (ex: proxy settings,
retry counts, etc.).requestMetricCollector
- optional request metric collectorpublic AWSIotDataClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, HttpClient httpClient)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AWSIotDataClient client = new AWSIotDataClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AWSIotData (ex: proxy settings,
retry counts, etc.).httpClient
- A http clientpublic DeleteThingShadowResult deleteThingShadow(DeleteThingShadowRequest deleteThingShadowRequest) throws AmazonServiceException, AmazonClientException
Deletes the shadow for the specified thing.
For more information, see DeleteThingShadow in the AWS IoT Developer Guide.
deleteThingShadow
in interface AWSIotData
deleteThingShadowRequest
- The input for the DeleteThingShadow operation.
ResourceNotFoundException
InvalidRequestException
ThrottlingException
UnauthorizedException
ServiceUnavailableException
InternalFailureException
MethodNotAllowedException
UnsupportedDocumentEncodingException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by AWS
IoT Data indicating either a problem with the data in the
request, or a server side issue.public GetThingShadowResult getThingShadow(GetThingShadowRequest getThingShadowRequest) throws AmazonServiceException, AmazonClientException
Gets the shadow for the specified thing.
For more information, see GetThingShadow in the AWS IoT Developer Guide.
getThingShadow
in interface AWSIotData
getThingShadowRequest
- The input for the GetThingShadow operation.
InvalidRequestException
ResourceNotFoundException
ThrottlingException
UnauthorizedException
ServiceUnavailableException
InternalFailureException
MethodNotAllowedException
UnsupportedDocumentEncodingException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by AWS
IoT Data indicating either a problem with the data in the
request, or a server side issue.public ListNamedShadowsForThingResult listNamedShadowsForThing(ListNamedShadowsForThingRequest listNamedShadowsForThingRequest) throws AmazonServiceException, AmazonClientException
Lists the shadows for the specified thing.
listNamedShadowsForThing
in interface AWSIotData
listNamedShadowsForThingRequest
- ResourceNotFoundException
InvalidRequestException
ThrottlingException
UnauthorizedException
ServiceUnavailableException
InternalFailureException
MethodNotAllowedException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by AWS
IoT Data indicating either a problem with the data in the
request, or a server side issue.public void publish(PublishRequest publishRequest) throws AmazonServiceException, AmazonClientException
Publishes state information.
For more information, see HTTP Protocol in the AWS IoT Developer Guide.
publish
in interface AWSIotData
publishRequest
- The input for the Publish operation.
InternalFailureException
InvalidRequestException
UnauthorizedException
MethodNotAllowedException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by AWS
IoT Data indicating either a problem with the data in the
request, or a server side issue.public UpdateThingShadowResult updateThingShadow(UpdateThingShadowRequest updateThingShadowRequest) throws AmazonServiceException, AmazonClientException
Updates the shadow for the specified thing.
For more information, see UpdateThingShadow in the AWS IoT Developer Guide.
updateThingShadow
in interface AWSIotData
updateThingShadowRequest
- The input for the UpdateThingShadow operation.
ConflictException
RequestEntityTooLargeException
InvalidRequestException
ThrottlingException
UnauthorizedException
ServiceUnavailableException
InternalFailureException
MethodNotAllowedException
UnsupportedDocumentEncodingException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by AWS
IoT Data indicating either a problem with the data in the
request, or a server side issue.@Deprecated public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic information for an executed request, you should use this method to retrieve it as soon as possible after executing the request.
getCachedResponseMetadata
in interface AWSIotData
request
- The originally executed requestCopyright © 2018 Amazon Web Services, Inc. All Rights Reserved.