AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2026-01-10 · Documentation low

File: code-library/latest/ug/cognito-identity-provider_code_examples.md

Summary

Removed the 'Get started' section and all associated code examples for listing Cognito user pools in C++, Go, Java, JavaScript, Python, and Ruby.

Security assessment

The change removes general SDK usage examples for listing user pools without any security context. There's no evidence of vulnerability fixes, security advisories, or security feature documentation. The deletion appears to be routine content cleanup or reorganization.

Diff

diff --git a/code-library/latest/ug/cognito-identity-provider_code_examples.md b/code-library/latest/ug/cognito-identity-provider_code_examples.md
index b82d3937c..4ef7d94c9 100644
--- a//code-library/latest/ug/cognito-identity-provider_code_examples.md
+++ b//code-library/latest/ug/cognito-identity-provider_code_examples.md
@@ -28,401 +27,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 Amazon Cognito.
-
-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/cognito/hello_cognito#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 cognito-idp)
-    
-    # Set this project's name.
-    project("hello_cognito")
-    
-    # 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_cognito.cpp)
-    
-    target_link_libraries(${PROJECT_NAME}
-            ${AWSSDK_LINK_LIBRARIES})
-    
-    
-
-Code for the hello_cognito.cpp source file.
-    
-    
-    #include <aws/core/Aws.h>
-    #include <aws/cognito-idp/CognitoIdentityProviderClient.h>
-    #include <aws/cognito-idp/model/ListUserPoolsRequest.h>
-    #include <iostream>
-    
-    /*
-     *  A "Hello Cognito" starter application which initializes an Amazon Cognito client and lists the Amazon Cognito
-     *  user pools.
-     *
-     *  main function
-     *
-     *  Usage: 'hello_cognito'
-     *
-     */
-    
-    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.
-        int result = 0;
-        {
-            Aws::Client::ClientConfiguration clientConfig;
-            // Optional: Set to the AWS Region (overrides config file).
-            // clientConfig.region = "us-east-1";
-    
-            Aws::CognitoIdentityProvider::CognitoIdentityProviderClient cognitoClient(clientConfig);
-    
-            Aws::String nextToken; // Used for pagination.
-            std::vector<Aws::String> userPools;
-    
-            do {
-                Aws::CognitoIdentityProvider::Model::ListUserPoolsRequest listUserPoolsRequest;
-                if (!nextToken.empty()) {
-                    listUserPoolsRequest.SetNextToken(nextToken);
-                }
-    
-                Aws::CognitoIdentityProvider::Model::ListUserPoolsOutcome listUserPoolsOutcome =
-                        cognitoClient.ListUserPools(listUserPoolsRequest);
-    
-                if (listUserPoolsOutcome.IsSuccess()) {
-                    for (auto &userPool: listUserPoolsOutcome.GetResult().GetUserPools()) {
-    
-                        userPools.push_back(userPool.GetName());
-                    }
-    
-                    nextToken = listUserPoolsOutcome.GetResult().GetNextToken();
-                } else {
-                    std::cerr << "ListUserPools error: " << listUserPoolsOutcome.GetError().GetMessage() << std::endl;
-                    result = 1;
-                    break;
-                }
-    
-    
-            } while (!nextToken.empty());
-            std::cout << userPools.size() << " user pools found." << std::endl;
-            for (auto &userPool: userPools) {
-                std::cout << "   user pool: " << userPool << std::endl;
-            }
-        }
-    
-        Aws::ShutdownAPI(options); // Should only be called once.
-        return result;
-    }
-    
-    
-
-  * For API details, see [ListUserPools](https://docs.aws.amazon.com/goto/SdkForCpp/cognito-idp-2016-04-18/ListUserPools) 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/cognito#code-examples). 
-    
-    
-    package main
-    
-    import (
-    	"context"
-    	"fmt"
-    	"log"
-    
-    	"github.com/aws/aws-sdk-go-v2/aws"
-    	"github.com/aws/aws-sdk-go-v2/config"
-    	"github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider"
-    	"github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider/types"
-    )
-    
-    // main uses the AWS SDK for Go V2 to create an Amazon Simple Notification Service
-    // (Amazon SNS) client and list the topics in your account.
-    // This example uses the default settings specified in your shared credentials
-    // and config files.
-    func main() {
-    	ctx := context.Background()
-    	sdkConfig, err := config.LoadDefaultConfig(ctx)
-    	if err != nil {
-    		fmt.Println("Couldn't load default configuration. Have you set up your AWS account?")
-    		fmt.Println(err)
-    		return
-    	}
-    	cognitoClient := cognitoidentityprovider.NewFromConfig(sdkConfig)
-    	fmt.Println("Let's list the user pools for your account.")
-    	var pools []types.UserPoolDescriptionType
-    	paginator := cognitoidentityprovider.NewListUserPoolsPaginator(
-    		cognitoClient, &cognitoidentityprovider.ListUserPoolsInput{MaxResults: aws.Int32(10)})
-    	for paginator.HasMorePages() {
-    		output, err := paginator.NextPage(ctx)
-    		if err != nil {
-    			log.Printf("Couldn't get user pools. Here's why: %v\n", err)
-    		} else {
-    			pools = append(pools, output.UserPools...)
-    		}
-    	}
-    	if len(pools) == 0 {
-    		fmt.Println("You don't have any user pools!")
-    	} else {
-    		for _, pool := range pools {
-    			fmt.Printf("\t%v: %v\n", *pool.Name, *pool.Id)
-    		}
-    	}
-    }
-    
-    
-    
-
-  * For API details, see [ListUserPools](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider#Client.ListUserPools) in _AWS SDK for Go API Reference_.