AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-04-11 · Documentation low

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

Summary

Added Kotlin implementation for Amazon Location Service starter example

Security assessment

Standard documentation update adding language-specific implementation, no security features or issues addressed

Diff

diff --git a/code-library/latest/ug/location_example_location_Hello_section.md b/code-library/latest/ug/location_example_location_Hello_section.md
index 939e83cff..50ceac544 100644
--- a//code-library/latest/ug/location_example_location_Hello_section.md
+++ b//code-library/latest/ug/location_example_location_Hello_section.md
@@ -9 +9 @@ There are more AWS SDK examples available in the [AWS Doc SDK Examples](https://
-The following code example shows how to get started using Amazon Location Service.
+The following code examples show how to get started using Amazon Location Service.
@@ -117,0 +118,72 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+Kotlin
+    
+
+**SDK for Kotlin**
+    
+
+###### 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/kotlin/services/location#code-examples). 
+    
+    
+    /**
+    Before running this Kotlin 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-kotlin/latest/developer-guide/setup.html
+    
+    In addition, you need to create a collection using the AWS Management
+    console. For information, see the following documentation.
+    
+    https://docs.aws.amazon.com/location/latest/developerguide/geofence-gs.html
+    
+     */
+    suspend fun main(args: Array<String>) {
+        val usage = """
+    
+            Usage:
+                <colletionName>
+    
+            Where:
+                colletionName - The Amazon location collection name. 
+        """
+    
+        if (args.size != 1) {
+            println(usage)
+            exitProcess(0)
+        }
+        val colletionName = args[0]
+        listGeofences(colletionName)
+    }
+    
+    /**
+     * Lists the geofences for the specified collection name.
+     *
+     * @param collectionName the name of the geofence collection
+     */
+    suspend fun listGeofences(collectionName: String) {
+        val request = ListGeofencesRequest {
+            this.collectionName = collectionName
+        }
+    
+        LocationClient { region = "us-east-1" }.use { client ->
+            val response = client.listGeofences(request)
+            val geofences = response.entries
+            if (geofences.isNullOrEmpty()) {
+                println("No Geofences found")
+            } else {
+                geofences.forEach { geofence ->
+                    println("Geofence ID: ${geofence.geofenceId}")
+                }
+            }
+        }
+    }
+    
+    
+
+  * For API details, see [ListGeofencesPaginator](https://sdk.amazonaws.com/kotlin/api/latest/index.html) in _AWS SDK for Kotlin API reference_. 
+
+
+
+