AWS code-library documentation change
Summary
Removed Java and PHP code examples demonstrating how to list KMS keys using AWS SDK pagination features
Security assessment
The change removes routine code samples for listing KMS keys, which is a standard administrative operation. There's no evidence of security vulnerability remediation (no CVE reference, no security advisory, no mention of vulnerabilities in the diff). Removing documentation doesn't indicate a security fix but rather content reorganization.
Diff
diff --git a/code-library/latest/ug/kms_code_examples.md b/code-library/latest/ug/kms_code_examples.md index ebd9395e5..928625d8d 100644 --- a//code-library/latest/ug/kms_code_examples.md +++ b//code-library/latest/ug/kms_code_examples.md @@ -30,113 +29,0 @@ _Scenarios_ are code examples that show you how to accomplish specific tasks by -**Get started** - -The following code examples show how to get started using AWS Key Management 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/kms#code-examples). - - - import software.amazon.awssdk.services.kms.KmsAsyncClient; - import software.amazon.awssdk.services.kms.model.ListKeysRequest; - import software.amazon.awssdk.services.kms.paginators.ListKeysPublisher; - 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 HelloKMS { - public static void main(String[] args) { - listAllKeys(); - } - - public static void listAllKeys() { - KmsAsyncClient kmsAsyncClient = KmsAsyncClient.builder() - .build(); - ListKeysRequest listKeysRequest = ListKeysRequest.builder() - .limit(15) - .build(); - - /* - * The `subscribe` method is required when using paginator methods in the AWS SDK - * because paginator methods return an instance of a `ListKeysPublisher`, which is - * based on a reactive stream. This allows asynchronous retrieval of paginated - * results as they become available. By subscribing to the stream, we can process - * each page of results as they are emitted. - */ - ListKeysPublisher keysPublisher = kmsAsyncClient.listKeysPaginator(listKeysRequest); - CompletableFuture<Void> future = keysPublisher - .subscribe(r -> r.keys().forEach(key -> - System.out.println("The key ARN is: " + key.keyArn() + ". The key Id is: " + key.keyId()))) - .whenComplete((result, exception) -> { - if (exception != null) { - System.err.println("Error occurred: " + exception.getMessage()); - } else { - System.out.println("Successfully listed all keys."); - } - }); - - try { - future.join(); - } catch (Exception e) { - System.err.println("Failed to list keys: " + e.getMessage()); - } - } - } - - - - * For API details, see [ListKeys](https://docs.aws.amazon.com/goto/SdkForJavaV2/kms-2014-11-01/ListKeys) in _AWS SDK for Java 2.x API Reference_. - - - - -PHP - - -**SDK for PHP** - - -###### 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/php/example_code/kms#code-examples). - - - include "vendor/autoload.php"; - - use Aws\Kms\KmsClient; - - echo "This file shows how to connect to the KmsClient, uses a paginator to get the keys for the account, and lists the KeyIds for up to 10 keys.\n"; - - $client = new KmsClient([]); - - $pageLength = 10; // Change this value to change the number of records shown, or to break up the result into pages. - - $keys = []; - $keysPaginator = $client->getPaginator("ListKeys", ['Limit' => $pageLength]); - foreach($keysPaginator as $page){ - foreach($page['Keys'] as $index => $key){ - echo "The $index index Key's ID is: {$key['KeyId']}\n"; - } - echo "End of page one of results. Alter the \$pageLength variable to see more results.\n"; - break; - } - - - - - * For API details, see [ListKeys](https://docs.aws.amazon.com/goto/SdkForPHPV3/kms-2014-11-01/ListKeys) in _AWS SDK for PHP API Reference_. - - - -