List of usage examples for com.amazonaws.services.iot.model ListThingsResult getThings
public java.util.List<ThingAttribute> getThings()
The things.
From source file:io.klerch.alexa.state.handler.AWSIotStateHandler.java
License:Open Source License
private boolean doesThingExist(final String thingName) { // if already checked existence than return immediately if (thingsExisting.contains(thingName)) return true; // query by an attribute having the name of the thing // unfortunately you can only query for things with their attributes, not directly with their names final ListThingsRequest request = new ListThingsRequest().withAttributeName(thingAttributeName) .withAttributeValue(thingName).withMaxResults(1); final ListThingsResult result = awsClient.listThings(request); if (result != null && result.getThings() != null && result.getThings().isEmpty()) { thingsExisting.add(thingName);//from ww w. ja v a2 s. com return true; } return false; }