AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-12-07 · Documentation low

File: code-library/latest/ug/redshift_example_redshift_ListDatabases_section.md

Summary

Added .NET SDK v4 code example for ListDatabases API with authentication parameters

Security assessment

The change demonstrates database listing with user credentials but doesn't introduce new security concepts or address vulnerabilities. It follows standard authentication patterns without adding security-specific guidance beyond basic API usage documentation.

Diff

diff --git a/code-library/latest/ug/redshift_example_redshift_ListDatabases_section.md b/code-library/latest/ug/redshift_example_redshift_ListDatabases_section.md
index 57d566b3a..964e4efbd 100644
--- a//code-library/latest/ug/redshift_example_redshift_ListDatabases_section.md
+++ b//code-library/latest/ug/redshift_example_redshift_ListDatabases_section.md
@@ -9 +9,60 @@ There are more AWS SDK examples available in the [AWS Doc SDK Examples](https://
-The following code example shows how to use `ListDatabases`.
+The following code examples show how to use `ListDatabases`.
+
+.NET
+    
+
+**SDK for .NET (v4)**
+    
+
+###### 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/dotnetv4/Redshift#code-examples). 
+    
+    
+        /// <summary>
+        /// List databases in a Redshift cluster.
+        /// </summary>
+        /// <param name="clusterIdentifier">The cluster identifier.</param>
+        /// <param name="dbUser">The database user.</param>
+        /// <param name="dbUser">The database name for authentication.</param>
+        /// <returns>A list of database names.</returns>
+        public async Task<List<string>> ListDatabasesAsync(string clusterIdentifier, string dbUser, string databaseName)
+        {
+            try
+            {
+                var request = new ListDatabasesRequest
+                {
+                    ClusterIdentifier = clusterIdentifier,
+                    DbUser = dbUser,
+                    Database = databaseName
+                };
+    
+                var response = await _redshiftDataClient.ListDatabasesAsync(request);
+                var databases = new List<string>();
+    
+                foreach (var database in response.Databases)
+                {
+                    Console.WriteLine($"The database name is : {database}");
+                    databases.Add(database);
+                }
+    
+                return databases;
+            }
+            catch (Amazon.RedshiftDataAPIService.Model.ValidationException ex)
+            {
+                Console.WriteLine($"Validation error: {ex.Message}");
+                throw;
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine($"Couldn't list databases. Here's why: {ex.Message}");
+                throw;
+            }
+        }
+    
+    
+
+  * For API details, see [ListDatabases](https://docs.aws.amazon.com/goto/DotNetSDKV4/redshift-2012-12-01/ListDatabases) in _AWS SDK for .NET API Reference_. 
+
+
+