AWS code-library documentation change
Summary
Removed Java and JavaScript code examples demonstrating how to list matching workflows using AWS Entity Resolution SDK
Security assessment
The change removes general SDK usage examples without any security context. No vulnerabilities, security weaknesses, or incidents are referenced. The removed code showed basic API interactions (listing workflows) without security-specific features like authentication, access control, or encryption.
Diff
diff --git a/code-library/latest/ug/entityresolution_code_examples.md b/code-library/latest/ug/entityresolution_code_examples.md index fd4939e3e..8f2b3b568 100644 --- a//code-library/latest/ug/entityresolution_code_examples.md +++ b//code-library/latest/ug/entityresolution_code_examples.md @@ -28,142 +27,0 @@ _Actions_ are code excerpts from larger programs and must be run in context. Whi -**Get started** - -The following code examples show how to get started using AWS Entity Resolution. - -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/entityresolution#code-examples). - - - /** - * 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 HelloEntityResoultion { - - private static final Logger logger = LoggerFactory.getLogger(HelloEntityResoultion.class); - - private static EntityResolutionAsyncClient entityResolutionAsyncClient; - public static void main(String[] args) { - listMatchingWorkflows(); - } - - public static EntityResolutionAsyncClient getResolutionAsyncClient() { - if (entityResolutionAsyncClient == null) { - /* - The `NettyNioAsyncHttpClient` class is part of the AWS SDK for Java, version 2, - and it is designed to provide a high-performance, asynchronous HTTP client for interacting with AWS services. - It uses the Netty framework to handle the underlying network communication and the Java NIO API to - provide a non-blocking, event-driven approach to HTTP requests and responses. - */ - - SdkAsyncHttpClient httpClient = NettyNioAsyncHttpClient.builder() - .maxConcurrency(50) // Adjust as needed. - .connectionTimeout(Duration.ofSeconds(60)) // Set the connection timeout. - .readTimeout(Duration.ofSeconds(60)) // Set the read timeout. - .writeTimeout(Duration.ofSeconds(60)) // Set the write timeout. - .build(); - - ClientOverrideConfiguration overrideConfig = ClientOverrideConfiguration.builder() - .apiCallTimeout(Duration.ofMinutes(2)) // Set the overall API call timeout. - .apiCallAttemptTimeout(Duration.ofSeconds(90)) // Set the individual call attempt timeout. - .retryStrategy(RetryMode.STANDARD) - .build(); - - entityResolutionAsyncClient = EntityResolutionAsyncClient.builder() - .httpClient(httpClient) - .overrideConfiguration(overrideConfig) - .build(); - } - return entityResolutionAsyncClient; - } - - /** - * Lists all matching workflows using an asynchronous paginator. - * <p> - * This method requests a paginated list of matching workflows from the - * AWS Entity Resolution service and logs the names of the retrieved workflows. - * It uses an asynchronous approach with a paginator and waits for the operation - * to complete using {@code CompletableFuture#join()}. - * </p> - */ - public static void listMatchingWorkflows() { - ListMatchingWorkflowsRequest request = ListMatchingWorkflowsRequest.builder().build(); - - ListMatchingWorkflowsPublisher paginator = - getResolutionAsyncClient().listMatchingWorkflowsPaginator(request); - - // Iterate through the paginated results asynchronously - CompletableFuture<Void> future = paginator.subscribe(response -> { - response.workflowSummaries().forEach(workflow -> - logger.info("Matching Workflow Name: " + workflow.workflowName()) - ); - }); - - // Wait for the asynchronous operation to complete - future.join(); - } - } - - - - * For API details, see [ListMatchingWorkflows](https://docs.aws.amazon.com/goto/SdkForJavaV2/entityresolution-2018-05-10/ListMatchingWorkflows) in _AWS SDK for Java 2.x API Reference_. - - - - -JavaScript - - -**SDK for JavaScript (v3)** - - -###### 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/javascriptv3/example_code/entityresolution#code-examples). - - - import { fileURLToPath } from "node:url"; - import { - EntityResolutionClient, - ListMatchingWorkflowsCommand, - } from "@aws-sdk/client-entityresolution"; - - export const main = async () => { - const region = "eu-west-1"; - const erClient = new EntityResolutionClient({ region: region }); - try { - const command = new ListMatchingWorkflowsCommand({}); - const response = await erClient.send(command); - const workflowSummaries = response.workflowSummaries; - for (const workflowSummary of workflowSummaries) { - console.log(`Attribute name: ${workflowSummaries[0].workflowName} `); - } - if (workflowSummaries.length === 0) { - console.log("No matching workflows found."); - } - } catch (error) { - console.error( - `An error occurred in listing the workflow summaries: ${error.message} \n Exiting program.`, - ); - return; - } - }; - - - - - * For API details, see [ListMatchingWorkflows](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/entityresolution/command/ListMatchingWorkflowsCommand) in _AWS SDK for JavaScript API Reference_. - - - -