SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 221 Java
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[location.JavaScript.geofence.deleteMapV3]
import { fileURLToPath } from "node:url";
import {
DeleteMapCommand,
LocationClient,
ResourceNotFoundException,
} from "@aws-sdk/client-location";
import data from "./inputs.json" with { type: "json" };
const region = "eu-west-1";
export const main = async () => {
const deleteMapParams = {
MapName: `${data.inputs.mapName}`,
};
try {
const locationClient = new LocationClient({ region: region });
const command = new DeleteMapCommand(deleteMapParams);
const response = await locationClient.send(command);
console.log("Map deleted.");
} catch (caught) {
if (caught instanceof ResourceNotFoundException) {
console.error(`${data.inputs.mapName} map not found.`);
return;
}
}
};
// snippet-end:[location.JavaScript.geofence.deleteMapV3]
// Invoke main function if this file was run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
main();
}