AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-11-25 · Documentation low

File: code-library/latest/ug/java_2_iotsitewise_code_examples.md

Summary

Removed portal creation/description/deletion steps and related code examples from AWS IoT SiteWise tutorial

Security assessment

The changes remove documentation about portal management operations but don't address security vulnerabilities or weaknesses. While portals involve IAM roles, the removal appears to be a structural simplification rather than a security fix. No evidence of security incident remediation or vulnerability disclosure.

Diff

diff --git a/code-library/latest/ug/java_2_iotsitewise_code_examples.md b/code-library/latest/ug/java_2_iotsitewise_code_examples.md
index 889aecab1..b0570fd81 100644
--- a//code-library/latest/ug/java_2_iotsitewise_code_examples.md
+++ b//code-library/latest/ug/java_2_iotsitewise_code_examples.md
@@ -314,47 +314 @@ Run an interactive scenario demonstrating AWS IoT SiteWise features.
-            logger.info("6. Create an IoT SiteWise Portal");
-            logger.info("""
-                 An IoT SiteWise Portal allows you to aggregate data from multiple industrial sources, 
-                 such as sensors, equipment, and control systems, into a centralized platform.
-                """);
-            waitForInputToContinue(scanner);
-            String portalId;
-            try {
-                portalId = sitewiseActions.createPortalAsync(portalName, iamRole, contactEmail).join();
-                logger.info("Portal created successfully. Portal ID {}", portalId);
-            } catch (CompletionException ce) {
-                Throwable cause = ce.getCause();
-                if (cause instanceof IoTSiteWiseException siteWiseEx) {
-                    logger.error("IoT SiteWise error occurred: Error message: {}, Error code {}",
-                            siteWiseEx.getMessage(), siteWiseEx.awsErrorDetails().errorCode(), siteWiseEx);
-                } else {
-                    logger.error("An unexpected error occurred: {}", cause.getMessage());
-                }
-                return;
-            }
-            waitForInputToContinue(scanner);
-            logger.info(DASHES);
-    
-            logger.info(DASHES);
-            logger.info("7. Describe the Portal");
-            logger.info("""
-                 In this step, we get a description of the portal and display the portal URL.
-                """);
-            waitForInputToContinue(scanner);
-            try {
-                String portalUrl = sitewiseActions.describePortalAsync(portalId).join();
-                logger.info("Portal URL: {}", portalUrl);
-            } catch (CompletionException ce) {
-                Throwable cause = ce.getCause();
-                if (cause instanceof ResourceNotFoundException notFoundException) {
-                    logger.error("A ResourceNotFoundException occurred: Error message: {}, Error code {}",
-                            notFoundException.getMessage(), notFoundException.awsErrorDetails().errorCode(), notFoundException);
-                } else {
-                    logger.error("An unexpected error occurred: {}", cause.getMessage());
-                }
-                return;
-            }
-            waitForInputToContinue(scanner);
-            logger.info(DASHES);
-    
-            logger.info(DASHES);
-            logger.info("8. Create an IoT SiteWise Gateway");
+            logger.info("6. Create an IoT SiteWise Gateway");
@@ -387 +341 @@ Run an interactive scenario demonstrating AWS IoT SiteWise features.
-            logger.info("9. Describe the IoT SiteWise Gateway");
+            logger.info("7. Describe the IoT SiteWise Gateway");
@@ -410 +364 @@ Run an interactive scenario demonstrating AWS IoT SiteWise features.
-            logger.info("10. Delete the AWS IoT SiteWise Assets");
+            logger.info("8. Delete the AWS IoT SiteWise Assets");
@@ -420,14 +373,0 @@ Run an interactive scenario demonstrating AWS IoT SiteWise features.
-                waitForInputToContinue(scanner);
-                try {
-                    sitewiseActions.deletePortalAsync(portalId).join();
-                    logger.info("Portal {} was deleted successfully.", portalId);
-    
-                } catch (CompletionException ce) {
-                    Throwable cause = ce.getCause();
-                    if (cause instanceof ResourceNotFoundException notFoundException) {
-                        logger.error("A ResourceNotFoundException occurred: Error message: {}, Error code {}",
-                                notFoundException.getMessage(), notFoundException.awsErrorDetails().errorCode(), notFoundException);
-                    } else {
-                        logger.error("An unexpected error occurred: {}", cause.getMessage());
-                    }
-                }
@@ -796,57 +735,0 @@ A wrapper class for AWS IoT SiteWise SDK methods.
-        /**
-         * Creates a new IoT SiteWise portal.
-         *
-         * @param portalName   the name of the portal to create.
-         * @param iamRole      the IAM role ARN to use for the portal.
-         * @param contactEmail the email address of the portal contact.
-         * @return a {@link CompletableFuture} that represents a {@link String} result of the portal ID. The calling code
-         *         can attach callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
-         *         {@link CompletableFuture#get()}.
-         *         <p>
-         *         If any completion stage in this method throws an exception, the method logs the exception cause and keeps
-         *         it available to the calling code as a {@link CompletionException}. By calling
-         *         {@link CompletionException#getCause()}, the calling code can access the original exception.
-         */
-        public CompletableFuture<String> createPortalAsync(String portalName, String iamRole, String contactEmail) {
-            CreatePortalRequest createPortalRequest = CreatePortalRequest.builder()
-                .portalName(portalName)
-                .portalDescription("This is my custom IoT SiteWise portal.")
-                .portalContactEmail(contactEmail)
-                .roleArn(iamRole)
-                .build();
-    
-            return getAsyncClient().createPortal(createPortalRequest)
-                .handle((response, exception) -> {
-                    if (exception != null) {
-                        logger.error("Failed to create portal: {} ", exception.getCause().getMessage());
-                        throw (CompletionException) exception;
-                    }
-                    return response.portalId();
-                });
-        }
-    
-        /**
-         * Deletes a portal.
-         *
-         * @param portalId the ID of the portal to be deleted.
-         * @return a {@link CompletableFuture} that represents a {@link DeletePortalResponse}. The calling code can attach
-         *         callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
-         *         {@link CompletableFuture#get()}.
-         *         <p>
-         *         If any completion stage in this method throws an exception, the method logs the exception cause and keeps
-         *         it available to the calling code as a {@link CompletionException}. By calling
-         *         {@link CompletionException#getCause()}, the calling code can access the original exception.
-         */
-        public CompletableFuture<DeletePortalResponse> deletePortalAsync(String portalId) {
-            DeletePortalRequest deletePortalRequest = DeletePortalRequest.builder()
-                .portalId(portalId)
-                .build();
-    
-            return getAsyncClient().deletePortal(deletePortalRequest)
-                .whenComplete((response, exception) -> {
-                    if (exception != null) {
-                        logger.error("Failed to delete portal with ID: {}. Error: {}", portalId, exception.getCause().getMessage());
-                    }
-                });
-        }
-    
@@ -882,27 +764,0 @@ A wrapper class for AWS IoT SiteWise SDK methods.
-        /**
-         * Retrieves a portal's description.
-         *
-         * @param portalId the ID of the portal to describe.
-         * @return a {@link CompletableFuture} that represents a {@link String} result of the portal's start URL
-         *         (see: {@link DescribePortalResponse#portalStartUrl()}). The calling code can attach callbacks, then handle the
-         *         result or exception by calling {@link CompletableFuture#join()} or {@link CompletableFuture#get()}.
-         *         <p>
-         *         If any completion stage in this method throws an exception, the method logs the exception cause and keeps
-         *         it available to the calling code as a {@link CompletionException}. By calling
-         *         {@link CompletionException#getCause()}, the calling code can access the original exception.
-         */
-        public CompletableFuture<String> describePortalAsync(String portalId) {
-            DescribePortalRequest request = DescribePortalRequest.builder()
-                .portalId(portalId)
-                .build();
-    
-            return getAsyncClient().describePortal(request)
-                .handle((response, exception) -> {
-                    if (exception != null) {
-                       logger.error("An exception occurred retrieving the portal description: {}", exception.getCause().getMessage());
-                       throw (CompletionException) exception;
-                    }
-                    return response.portalStartUrl();
-                });
-        }
-    
@@ -1261,49 +1116,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-The following code example shows how to use `CreatePortal`.
-
-**SDK for Java 2.x**
-    
-
-###### Note
-
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/iotsitewise#code-examples). 
-    
-    
-        /**
-         * Creates a new IoT SiteWise portal.
-         *
-         * @param portalName   the name of the portal to create.
-         * @param iamRole      the IAM role ARN to use for the portal.
-         * @param contactEmail the email address of the portal contact.
-         * @return a {@link CompletableFuture} that represents a {@link String} result of the portal ID. The calling code
-         *         can attach callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
-         *         {@link CompletableFuture#get()}.
-         *         <p>
-         *         If any completion stage in this method throws an exception, the method logs the exception cause and keeps
-         *         it available to the calling code as a {@link CompletionException}. By calling
-         *         {@link CompletionException#getCause()}, the calling code can access the original exception.
-         */
-        public CompletableFuture<String> createPortalAsync(String portalName, String iamRole, String contactEmail) {
-            CreatePortalRequest createPortalRequest = CreatePortalRequest.builder()
-                .portalName(portalName)
-                .portalDescription("This is my custom IoT SiteWise portal.")
-                .portalContactEmail(contactEmail)
-                .roleArn(iamRole)
-                .build();
-    
-            return getAsyncClient().createPortal(createPortalRequest)
-                .handle((response, exception) -> {
-                    if (exception != null) {
-                        logger.error("Failed to create portal: {} ", exception.getCause().getMessage());
-                        throw (CompletionException) exception;
-                    }
-                    return response.portalId();