AWS code-library documentation change
Summary
Removed 'Get started' section containing Java code example for listing OpenSearch versions
Security assessment
The change deletes basic SDK usage examples for OpenSearch version listing. No security-related content was present in the removed material, and there's no indication of security vulnerability remediation or security feature documentation in the diff.
Diff
diff --git a/code-library/latest/ug/opensearch_code_examples.md b/code-library/latest/ug/opensearch_code_examples.md index 763a3c99b..c93deeaf1 100644 --- a//code-library/latest/ug/opensearch_code_examples.md +++ b//code-library/latest/ug/opensearch_code_examples.md @@ -28,67 +27,0 @@ _Actions_ are code excerpts from larger programs and must be run in context. Whi -**Get started** - -The following code example shows how to get started using OpenSearch Service. - -Java - - -**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/opensearch#code-examples). - - - import software.amazon.awssdk.services.opensearch.OpenSearchAsyncClient; - import software.amazon.awssdk.services.opensearch.model.ListVersionsRequest; - import java.util.List; - import java.util.concurrent.CompletableFuture; - - /** - * 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 HelloOpenSearch { - public static void main(String[] args) { - try { - CompletableFuture<Void> future = listVersionsAsync(); - future.join(); - System.out.println("Versions listed successfully."); - } catch (RuntimeException e) { - System.err.println("Error occurred while listing versions: " + e.getMessage()); - } - } - - private static OpenSearchAsyncClient getAsyncClient() { - return OpenSearchAsyncClient.builder().build(); - } - - public static CompletableFuture<Void> listVersionsAsync() { - ListVersionsRequest request = ListVersionsRequest.builder() - .maxResults(10) - .build(); - - return getAsyncClient().listVersions(request).thenAccept(response -> { - List<String> versionList = response.versions(); - for (String version : versionList) { - System.out.println("Version info: " + version); - } - }).exceptionally(ex -> { - // Handle the exception, or propagate it as a RuntimeException - throw new RuntimeException("Failed to list versions", ex); - }); - } - } - - - - * For API details, see [ListVersions](https://docs.aws.amazon.com/goto/SdkForJavaV2/es-2021-01-01/ListVersions) in _AWS SDK for Java 2.x API Reference_. - - - -