@@ -344,67 +344,6 @@ public CompletableFuture<DeleteAssetModelResponse> deleteAssetModelAsync(String
344344 }
345345 // snippet-end:[sitewise.java2.delete.asset.model.main]
346346
347- // snippet-start:[sitewise.java2.create.portal.main]
348- /**
349- * Creates a new IoT SiteWise portal.
350- *
351- * @param portalName the name of the portal to create.
352- * @param iamRole the IAM role ARN to use for the portal.
353- * @param contactEmail the email address of the portal contact.
354- * @return a {@link CompletableFuture} that represents a {@link String} result of the portal ID. The calling code
355- * can attach callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
356- * {@link CompletableFuture#get()}.
357- * <p>
358- * If any completion stage in this method throws an exception, the method logs the exception cause and keeps
359- * it available to the calling code as a {@link CompletionException}. By calling
360- * {@link CompletionException#getCause()}, the calling code can access the original exception.
361- */
362- public CompletableFuture <String > createPortalAsync (String portalName , String iamRole , String contactEmail ) {
363- CreatePortalRequest createPortalRequest = CreatePortalRequest .builder ()
364- .portalName (portalName )
365- .portalDescription ("This is my custom IoT SiteWise portal." )
366- .portalContactEmail (contactEmail )
367- .roleArn (iamRole )
368- .build ();
369-
370- return getAsyncClient ().createPortal (createPortalRequest )
371- .handle ((response , exception ) -> {
372- if (exception != null ) {
373- logger .error ("Failed to create portal: {} " , exception .getCause ().getMessage ());
374- throw (CompletionException ) exception ;
375- }
376- return response .portalId ();
377- });
378- }
379- // snippet-end:[sitewise.java2.create.portal.main]
380-
381- // snippet-start:[sitewise.java2.delete.portal.main]
382- /**
383- * Deletes a portal.
384- *
385- * @param portalId the ID of the portal to be deleted.
386- * @return a {@link CompletableFuture} that represents a {@link DeletePortalResponse}. The calling code can attach
387- * callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
388- * {@link CompletableFuture#get()}.
389- * <p>
390- * If any completion stage in this method throws an exception, the method logs the exception cause and keeps
391- * it available to the calling code as a {@link CompletionException}. By calling
392- * {@link CompletionException#getCause()}, the calling code can access the original exception.
393- */
394- public CompletableFuture <DeletePortalResponse > deletePortalAsync (String portalId ) {
395- DeletePortalRequest deletePortalRequest = DeletePortalRequest .builder ()
396- .portalId (portalId )
397- .build ();
398-
399- return getAsyncClient ().deletePortal (deletePortalRequest )
400- .whenComplete ((response , exception ) -> {
401- if (exception != null ) {
402- logger .error ("Failed to delete portal with ID: {}. Error: {}" , portalId , exception .getCause ().getMessage ());
403- }
404- });
405- }
406- // snippet-end:[sitewise.java2.delete.portal.main]
407-
408347 // snippet-start:[sitewise.java2.list.asset.model.main]
409348 /**
410349 * Retrieves the asset model ID for the given asset model name.
@@ -436,35 +375,6 @@ public CompletableFuture<String> getAssetModelIdAsync(String assetModelName) {
436375 }
437376 // snippet-end:[sitewise.java2.list.asset.model.main]
438377
439- // snippet-start:[sitewise.java2.describe.portal.main]
440- /**
441- * Retrieves a portal's description.
442- *
443- * @param portalId the ID of the portal to describe.
444- * @return a {@link CompletableFuture} that represents a {@link String} result of the portal's start URL
445- * (see: {@link DescribePortalResponse#portalStartUrl()}). The calling code can attach callbacks, then handle the
446- * result or exception by calling {@link CompletableFuture#join()} or {@link CompletableFuture#get()}.
447- * <p>
448- * If any completion stage in this method throws an exception, the method logs the exception cause and keeps
449- * it available to the calling code as a {@link CompletionException}. By calling
450- * {@link CompletionException#getCause()}, the calling code can access the original exception.
451- */
452- public CompletableFuture <String > describePortalAsync (String portalId ) {
453- DescribePortalRequest request = DescribePortalRequest .builder ()
454- .portalId (portalId )
455- .build ();
456-
457- return getAsyncClient ().describePortal (request )
458- .handle ((response , exception ) -> {
459- if (exception != null ) {
460- logger .error ("An exception occurred retrieving the portal description: {}" , exception .getCause ().getMessage ());
461- throw (CompletionException ) exception ;
462- }
463- return response .portalStartUrl ();
464- });
465- }
466- // snippet-end:[sitewise.java2.describe.portal.main]
467-
468378 // snippet-start:[sitewise.java2.create.gateway.main]
469379
470380 /**
0 commit comments