Hay más ejemplos de AWS SDK disponibles en el repositorio de GitHub de ejemplos de AWS SDK de documentos
Cómo utilizar DeleteKey con un AWS SDK
Los siguientes ejemplos de código muestran cómo utilizar DeleteKey.
- Java
-
- SDK para Java 2.x
-
nota
Hay más en GitHub. Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. /** * Deletes the specified key from the key-value store. * * @param keyName the name of the key to be deleted * @return a {@link CompletableFuture} that completes when the key has been deleted * @throws CompletionException if the key was not found or if an error occurred during the deletion process */ public CompletableFuture<Void> deleteKey(String keyName) { DeleteKeyRequest keyRequest = DeleteKeyRequest.builder() .keyName(keyName) .build(); return getClient().deleteKey(keyRequest) .whenComplete((response, exception) -> { if (exception != null) { Throwable cause = exception.getCause(); if (cause instanceof ResourceNotFoundException) { throw new CompletionException("The key was not found.", cause); } throw new CompletionException("Failed to delete key: " + exception.getMessage(), exception); } logger.info("The key {} was deleted.", keyName); }) .thenApply(response -> null); }-
Para obtener información sobre la API, consulte DeleteKey en la Referencia de la API de AWS SDK for Java 2.x.
-
- Kotlin
-
- SDK para Kotlin
-
nota
Hay más en GitHub. Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. /** * Deletes the specified key from the key-value store. * * @param keyName the name of the key to be deleted */ suspend fun deleteKey(keyName: String) { val keyRequest = DeleteKeyRequest { this.keyName = keyName } LocationClient.fromEnvironment { region = "us-east-1" }.use { client -> client.deleteKey(keyRequest) println("The key $keyName was deleted.") } }-
Para obtener información sobre la API, consulte DeleteKey
en la Referencia de la API de AWS SDK para Kotlin.
-
DeleteGeofenceCollection
DeleteMap