AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-06-28 · Documentation low

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

Summary

Added AWSClientRuntime imports and new ListUsers code example. Updated Package.swift configuration for listusers target.

Security assessment

Changes involve code example improvements and project configuration updates. ListUsers is a standard API operation for user management but doesn't introduce or address security vulnerabilities.

Diff

diff --git a/code-library/latest/ug/swift_1_cognito-identity-provider_code_examples.md b/code-library/latest/ug/swift_1_cognito-identity-provider_code_examples.md
index 8f088b704..2e1dca582 100644
--- a//code-library/latest/ug/swift_1_cognito-identity-provider_code_examples.md
+++ b//code-library/latest/ug/swift_1_cognito-identity-provider_code_examples.md
@@ -39,0 +40 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -89,0 +91 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -157,0 +160 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -235,0 +239 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -288,0 +293 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -327,0 +333,44 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+The following code example shows how to use `ListUsers`.
+
+**SDK for Swift**
+    
+
+###### 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/swift/example_code/cognito-identity-provider#code-examples). 
+    
+    
+            do {
+                let output = try await cognitoClient.listUsers(
+                    input: ListUsersInput(
+                        userPoolId: poolId
+                    )
+                )
+                
+                guard let users = output.users else {
+                    print("No users found.")
+                    return
+                }
+    
+                print("\(users.count) user(s) found.")
+                for user in users {
+                    print("  \(user.username ?? "<unknown>")")
+                }
+            } catch _ as NotAuthorizedException {
+                print("*** Please authenticate with AWS before using this command.")
+                return
+            } catch _ as ResourceNotFoundException {
+                print("*** The specified User Pool was not found.")
+                return
+            } catch {
+                print("*** An unexpected type of error occurred.")
+                return
+            }
+    
+    
+
+  * For API details, see [ListUsers](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/listusers\(input:\)) in _AWS SDK for Swift API reference_. 
+
+
+
+
@@ -337,0 +387 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -389,0 +440 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -455,0 +507 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+    import AWSClientRuntime
@@ -537 +589 @@ The `Package.swift` file.
-        name: "http-config",
+        name: "listusers",
@@ -558 +610 @@ The `Package.swift` file.
-                name: "cognito-scenario",
+                name: "listusers",
@@ -560 +612 @@ The `Package.swift` file.
-                    .product(name: "AWSS3", package: "aws-sdk-swift"),
+                    .product(name: "AWSCognitoIdentityProvider", package: "aws-sdk-swift"),
@@ -604 +655,0 @@ The Swift code file.
-    import AWSClientRuntime
@@ -606,0 +658 @@ The Swift code file.
+    import AWSClientRuntime