55
66import org .slf4j .Logger ;
77import org .slf4j .LoggerFactory ;
8- import software .amazon .awssdk .services .iotsitewise .model .BatchPutAssetPropertyValueResponse ;
98import software .amazon .awssdk .services .iotsitewise .model .CreateAssetModelResponse ;
109import software .amazon .awssdk .services .iotsitewise .model .CreateAssetResponse ;
11- import software .amazon .awssdk .services .iotsitewise .model .CreateGatewayResponse ;
12- import software .amazon .awssdk .services .iotsitewise .model .DeleteAssetModelResponse ;
13- import software .amazon .awssdk .services .iotsitewise .model .DeleteAssetResponse ;
14- import software .amazon .awssdk .services .iotsitewise .model .DeletePortalResponse ;
15- import software .amazon .awssdk .services .iotsitewise .model .DescribeGatewayResponse ;
1610import software .amazon .awssdk .services .iotsitewise .model .IoTSiteWiseException ;
1711import software .amazon .awssdk .services .iotsitewise .model .ResourceAlreadyExistsException ;
1812import software .amazon .awssdk .services .iotsitewise .model .ResourceNotFoundException ;
19-
20- import java .util .List ;
2113import java .util .Map ;
2214import java .util .Scanner ;
2315import java .util .concurrent .CompletableFuture ;
@@ -48,18 +40,18 @@ public static void main(String[] args) throws Throwable {
4840 myThing - The name of the IoT thing or device that is connected to the IoT SiteWise gateway.
4941 """ ;
5042
51- // if (args.length != 6) {
52- // logger.info(usage);
53- // return;
54- // }
43+ if (args .length != 6 ) {
44+ logger .info (usage );
45+ return ;
46+ }
5547
5648 Scanner scanner = new Scanner (System .in );
57- String assetModelName = "MyAssetModel" ;
58- String assetName = "MyAsset" ;
59- String portalName = "MyPortal" ;
60- String contactEmail =
"[email protected] " ;
61- String gatewayName = "myGateway11" ;
62- String myThing = "myThing78" ;
49+ String assetModelName = args [ 0 ] ;
50+ String assetName = args [ 1 ] ;
51+ String portalName = args [ 2 ] ;
52+ String contactEmail = args [ 3 ] ;
53+ String gatewayName = args [ 4 ] ;
54+ String myThing = args [ 5 ] ;
6355
6456 logger .info ("""
6557 AWS IoT SiteWise is a fully managed software-as-a-service (SaaS) that
@@ -140,6 +132,8 @@ public static void runScenario(String assetModelName, String assetName, String
140132 an asset from the asset model.
141133
142134 """ );
135+ logger .info ("Let's wait 1 minute for the asset model to be ready." );
136+ countdown (1 );
143137 waitForInputToContinue (scanner );
144138 String assetId ;
145139 try {
@@ -229,7 +223,7 @@ public static void runScenario(String assetModelName, String assetName, String
229223 """ );
230224 waitForInputToContinue (scanner );
231225 try {
232- sitewiseActions .getAssetPropValueAsync ("Temperature property" , tempPropId , assetId ); // FIXME <------------------
226+ sitewiseActions .getAssetPropValueAsync ("Temperature property" , tempPropId , assetId );
233227 waitForInputToContinue (scanner );
234228 } catch (RuntimeException rt ) {
235229 Throwable cause = rt .getCause ();
@@ -246,7 +240,7 @@ public static void runScenario(String assetModelName, String assetName, String
246240 }
247241 throw cause ;
248242 }
249- sitewiseActions .getAssetPropValueAsync ("Humidity property" , humPropId , assetId ); // FIXME <------------------
243+ sitewiseActions .getAssetPropValueAsync ("Humidity property" , humPropId , assetId );
250244 waitForInputToContinue (scanner );
251245 logger .info (DASHES );
252246
@@ -257,7 +251,7 @@ public static void runScenario(String assetModelName, String assetName, String
257251 such as sensors, equipment, and control systems, into a centralized platform.
258252 """ );
259253 waitForInputToContinue (scanner );
260- String portalId = "" ;
254+ String portalId ;
261255 try {
262256 portalId = sitewiseActions .createPortalAsync (portalName , iamRole , contactEmail ).join ();
263257 logger .info ("Portal created successfully. Portal ID {}" , portalId );
0 commit comments