AWS code-library documentation change
Summary
Removed Java code example demonstrating how to list member accounts in Amazon Inspector
Security assessment
The change deletes a code sample without any security-related context. The removed content was a general API usage example for listing accounts, not addressing vulnerabilities or security features. No security implications are evident in the removal.
Diff
diff --git a/code-library/latest/ug/inspector_code_examples.md b/code-library/latest/ug/inspector_code_examples.md index fb6edcc6e..215e4c689 100644 --- a//code-library/latest/ug/inspector_code_examples.md +++ b//code-library/latest/ug/inspector_code_examples.md @@ -28,85 +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 . - -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/inspector#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 HelloInspector { - private static final Logger logger = LoggerFactory.getLogger(HelloInspector.class); - - public static void main(String[] args) { - logger.info("Hello Amazon Inspector!"); - - try (Inspector2Client inspectorClient = Inspector2Client.builder().build()) { - - logger.info("Listing member accounts for this Inspector administrator account..."); - listMembers(inspectorClient); - - logger.info("The Hello Inspector example completed successfully."); - - } catch (Inspector2Exception e) { - logger.error("Error: {}", e.getMessage()); - logger.info("Troubleshooting:"); - logger.info("1. Verify AWS credentials are configured"); - logger.info("2. Check IAM permissions for Inspector2"); - logger.info("3. Ensure Inspector2 is enabled in your account"); - logger.info("4. Verify you're using a supported region"); - } - } - - /** - * Lists all member accounts associated with the current Inspector administrator account. - * - * @param inspectorClient The Inspector2Client used to interact with AWS Inspector. - */ - public static void listMembers(Inspector2Client inspectorClient) { - try { - ListMembersRequest request = ListMembersRequest.builder() - .maxResults(50) // optional: limit results - .build(); - - ListMembersResponse response = inspectorClient.listMembers(request); - List<Member> members = response.members(); - - if (members == null || members.isEmpty()) { - logger.info("No member accounts found for this Inspector administrator account."); - return; - } - - logger.info("Found {} member account(s):", members.size()); - for (Member member : members) { - logger.info(" - Account ID: {}, Status: {}", - member.accountId(), - member.relationshipStatusAsString()); - } - - } catch (Inspector2Exception e) { - logger.error("Failed to list members: {}", e.awsErrorDetails().errorMessage()); - } - } - } - - - - * For API details, see [ListMembers](https://docs.aws.amazon.com/goto/SdkForJavaV2/inspector-2016-02-16/ListMembers) in _AWS SDK for Java 2.x API Reference_. - - - -