AWS sns documentation change
Summary
Removed the 'Get started' section and all associated code examples demonstrating how to list SNS topics using various AWS SDKs (.NET, C++, Go, Java, JavaScript, Kotlin, Swift).
Security assessment
The change removes introductory code examples for listing SNS topics. There is no evidence of security vulnerabilities, patches, or security-related content in the removed material. The examples focused on basic API usage without security implications.
Diff
diff --git a/sns/latest/dg/service_code_examples.md b/sns/latest/dg/service_code_examples.md index 13daec101..3c2ff41b2 100644 --- a//sns/latest/dg/service_code_examples.md +++ b//sns/latest/dg/service_code_examples.md @@ -15,521 +14,0 @@ For a complete list of AWS SDK developer guides and code examples, see [Using Am -**Get started** - -The following code examples show how to get started using Amazon SNS. - -.NET - - -**SDK for .NET** - - -###### 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/dotnetv3/cross-service/TopicsAndQueues#code-examples). - - - using Amazon.SimpleNotificationService; - using Amazon.SimpleNotificationService.Model; - - namespace SNSActions; - - public static class HelloSNS - { - static async Task Main(string[] args) - { - var snsClient = new AmazonSimpleNotificationServiceClient(); - - Console.WriteLine($"Hello Amazon SNS! Following are some of your topics:"); - Console.WriteLine(); - - // You can use await and any of the async methods to get a response. - // Let's get a list of topics. - var response = await snsClient.ListTopicsAsync( - new ListTopicsRequest()); - - foreach (var topic in response.Topics) - { - Console.WriteLine($"\tTopic ARN: {topic.TopicArn}"); - Console.WriteLine(); - } - } - } - - - - * For API details, see [ListTopics](https://docs.aws.amazon.com/goto/DotNetSDKV3/sns-2010-03-31/ListTopics) in _AWS SDK for .NET API Reference_. - - - - -C++ - - -**SDK for C++** - - -###### 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/cpp/example_code/sns/hello_sns#code-examples). - -Code for the CMakeLists.txt CMake file. - - - # Set the minimum required version of CMake for this project. - cmake_minimum_required(VERSION 3.13) - - # Set the AWS service components used by this project. - set(SERVICE_COMPONENTS sns) - - # Set this project's name. - project("hello_sns") - - # Set the C++ standard to use to build this target. - # At least C++ 11 is required for the AWS SDK for C++. - set(CMAKE_CXX_STANDARD 11) - - # Use the MSVC variable to determine if this is a Windows build. - set(WINDOWS_BUILD ${MSVC}) - - if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK. - string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all") - list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH}) - endif () - - # Find the AWS SDK for C++ package. - find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS}) - - if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS) - # Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging. - - # set(BIN_SUB_DIR "/Debug") # If you are building from the command line you may need to uncomment this - # and set the proper subdirectory to the executables' location. - - AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR}) - endif () - - add_executable(${PROJECT_NAME} - hello_sns.cpp) - - target_link_libraries(${PROJECT_NAME} - ${AWSSDK_LINK_LIBRARIES}) - - - -Code for the hello_sns.cpp source file. - - - #include <aws/core/Aws.h> - #include <aws/sns/SNSClient.h> - #include <aws/sns/model/ListTopicsRequest.h> - #include <iostream> - - /* - * A "Hello SNS" starter application which initializes an Amazon Simple Notification - * Service (Amazon SNS) client and lists the SNS topics in the current account. - * - * main function - * - * Usage: 'hello_sns' - * - */ - - int main(int argc, char **argv) { - Aws::SDKOptions options; - // Optionally change the log level for debugging. - // options.loggingOptions.logLevel = Utils::Logging::LogLevel::Debug; - Aws::InitAPI(options); // Should only be called once. - { - Aws::Client::ClientConfiguration clientConfig; - // Optional: Set to the AWS Region (overrides config file). - // clientConfig.region = "us-east-1"; - - Aws::SNS::SNSClient snsClient(clientConfig); - - Aws::Vector<Aws::SNS::Model::Topic> allTopics; - Aws::String nextToken; // Next token is used to handle a paginated response. - do { - Aws::SNS::Model::ListTopicsRequest request; - - if (!nextToken.empty()) { - request.SetNextToken(nextToken); - } - - const Aws::SNS::Model::ListTopicsOutcome outcome = snsClient.ListTopics( - request); - - if (outcome.IsSuccess()) { - const Aws::Vector<Aws::SNS::Model::Topic> &paginatedTopics = - outcome.GetResult().GetTopics(); - if (!paginatedTopics.empty()) { - allTopics.insert(allTopics.cend(), paginatedTopics.cbegin(), - paginatedTopics.cend()); - } - } - else { - std::cerr << "Error listing topics " << outcome.GetError().GetMessage() - << std::endl; - return 1; - } - - nextToken = outcome.GetResult().GetNextToken(); - } while (!nextToken.empty()); - - std::cout << "Hello Amazon SNS! You have " << allTopics.size() << " topic" - << (allTopics.size() == 1 ? "" : "s") << " in your account." - << std::endl; - - if (!allTopics.empty()) { - std::cout << "Here are your topic ARNs." << std::endl; - for (const Aws::SNS::Model::Topic &topic: allTopics) { - std::cout << " * " << topic.GetTopicArn() << std::endl; - } - } - } - - - Aws::ShutdownAPI(options); // Should only be called once. - return 0; - } - - - - * For API details, see [ListTopics](https://docs.aws.amazon.com/goto/SdkForCpp/sns-2010-03-31/ListTopics) in _AWS SDK for C++ API Reference_. - - - - -Go - - -**SDK for Go V2** - - -###### 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/gov2/sns#code-examples).