AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-05-03 · Documentation low

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

Summary

Added JavaScript SDK v3 code example for PutGeofence API operation

Security assessment

The change adds a standard code example demonstrating API usage without addressing security vulnerabilities or discussing security controls. The example shows basic error handling but doesn't mention authentication, authorization, or data protection mechanisms beyond standard SDK initialization.

Diff

diff --git a/code-library/latest/ug/location_example_location_PutGeofence_section.md b/code-library/latest/ug/location_example_location_PutGeofence_section.md
index bab74f688..190446d16 100644
--- a//code-library/latest/ug/location_example_location_PutGeofence_section.md
+++ b//code-library/latest/ug/location_example_location_PutGeofence_section.md
@@ -66,0 +67,57 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+JavaScript
+    
+
+**SDK for JavaScript (v3)**
+    
+
+###### 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/javascriptv3/example_code/location/actions#code-examples). 
+    
+    
+    import { fileURLToPath } from "node:url";
+    import {
+      PutGeofenceCommand,
+      LocationClient,
+      ValidationException,
+    } from "@aws-sdk/client-location";
+    import data from "./inputs.json" with { type: "json" };
+    
+    const region = "eu-west-1";
+    const locationClient = new LocationClient({ region: region });
+    export const main = async () => {
+      const geoFenceGeoParams = {
+        CollectionName: `${data.inputs.collectionName}`,
+        GeofenceId: `${data.inputs.geoId}`,
+        Geometry: {
+          Polygon: [
+            [
+              [-122.3381, 47.6101],
+              [-122.3281, 47.6101],
+              [-122.3281, 47.6201],
+              [-122.3381, 47.6201],
+              [-122.3381, 47.6101],
+            ],
+          ],
+        },
+      };
+      try {
+        const command = new PutGeofenceCommand(geoFenceGeoParams);
+        const response = await locationClient.send(command);
+        console.log("GeoFence created. GeoFence ID is: ", response.GeofenceId);
+      } catch (error) {
+        console.error(
+          `A validation error occurred while creating geofence: ${error} \n Exiting program.`,
+        );
+        return;
+      }
+    };
+    
+    
+    
+
+  * For API details, see [PutGeofence](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/command/PutGeofenceCommand) in _AWS SDK for JavaScript API Reference_. 
+
+
+
+