This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSIotData iotDataClient = AWSIotDataClientBuilder | |
.standard() | |
.withRegion(Regions.US_WEST_2) | |
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(CLIENT_TOKEN, CLIENT_SECRET))).build(); | |
String thingName = "plant-manager"; | |
GetThingShadowResult getThingShadowResult = iotDataClient.getThingShadow(new GetThingShadowRequest().withThingName(thingName)); | |
String state = new String( getThingShadowResult.getPayload().array(), StandardCharsets.UTF_8); | |
// state is now a JSON string representing the plant-manager Thing Shadow's state | |
/* { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build an authenticated client object | |
// This pattern repeats from https://www.linkedin.com/pulse/sending-sms-from-java-aws-sns-steve-perkins | |
AWSIot iotClient = AWSIotClientBuilder | |
.standard() | |
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(CLIENT_TOKEN, CLIENT_SECRET))) | |
.withRegion(Regions.US_WEST_2) | |
.build(); | |
// Send the ListThingsRequest to AWS IoT synchronously | |
ListThingsResult result = iotClient.listThings(new ListThingsRequest()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.lightside.notification; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.lightside.main.AwsClientFactory; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import com.amazonaws.services.sns.model.MessageAttributeValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.lightside.demo; | |
import com.amazonaws.auth.AWSStaticCredentialsProvider; | |
import com.amazonaws.auth.BasicAWSCredentials; | |
import com.amazonaws.regions.Regions; | |
import com.amazonaws.services.iotdata.AWSIotData; | |
import com.amazonaws.services.iotdata.AWSIotDataClientBuilder; | |
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient; | |
import com.amazonaws.services.sns.AmazonSNSClient; |