AWS Security ChangesHomeSearch

AWS polly documentation change

Service: polly · 2025-05-28 · Documentation low

File: polly/latest/dg/GetLexiconSample.md

Summary

Added Java V2 code example demonstrating how to use GetLexicon operation

Security assessment

The change adds a standard code sample for retrieving a lexicon. No security vulnerabilities or security features are mentioned. The code uses normal AWS credential patterns without any security-specific guidance.

Diff

diff --git a/polly/latest/dg/GetLexiconSample.md b/polly/latest/dg/GetLexiconSample.md
index b0ea104d4..d442ce4b5 100644
--- a//polly/latest/dg/GetLexiconSample.md
+++ b//polly/latest/dg/GetLexiconSample.md
@@ -11,0 +12,53 @@ For more information on this operation, see the reference for the [`GetLexicon`]
+    /*
+       Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+       SPDX-License-Identifier: Apache-2.0
+    */
+    
+    package com.example.polly;
+    
+    import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
+    import software.amazon.awssdk.regions.Region;
+    import software.amazon.awssdk.services.polly.PollyClient;
+    import software.amazon.awssdk.services.polly.model.GetLexiconRequest;
+    import software.amazon.awssdk.services.polly.model.GetLexiconResponse;
+    import software.amazon.awssdk.services.polly.model.PollyException ;
+    
+    /**
+     * Before running this Java V2 code example, set up your development environment, including your credentials.
+     *
+     * For more information, see the following documentation topic:
+     *
+     * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
+     */
+    public class GetLexiconSample {
+    
+        public static void main(String args[]) {
+    
+            PollyClient polly = PollyClient.builder()
+                    .region(Region.US_WEST_2)
+                    .credentialsProvider(ProfileCredentialsProvider.create())
+                    .build();
+    
+            getLexicon(polly) ;
+            polly.close();
+        }
+    
+        private static String LEXICON_NAME = "SampleLexicon";
+        public static void getLexicon(PollyClient client) {
+    
+            try {
+                GetLexiconRequest getLexiconRequest = GetLexiconRequest.builder()
+                        .name(LEXICON_NAME).build();
+    
+                GetLexiconResponse getLexiconResult = client.getLexicon(getLexiconRequest);
+                System.out.println("The name of the Lexicon is " + getLexiconResult.lexicon().name());
+    
+            } catch (PollyException e) {
+                System.err.println("Exception caught: " + e);
+                System.exit(1);
+            }
+        }
+    
+    }
+    
+