Há mais AWS SDK exemplos disponíveis no GitHub repositório AWS Doc SDK Examples
As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Use DeleteEndpoint
com um AWS SDK
Os exemplos de código a seguir mostram como usar o DeleteEndpoint
.
- Java
-
- SDKpara Java 2.x
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no Repositório de exemplos de código da AWS
. Excluir um endpoint
import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.pinpoint.PinpointClient; import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointRequest; import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointResponse; import software.amazon.awssdk.services.pinpoint.model.PinpointException; /** * Before running this Java V2 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-java/latest/developer-guide/get-started.html */ public class DeleteEndpoint { public static void main(String[] args) { final String usage = """ Usage: <appName> <endpointId > Where: appId - The id of the application to delete. endpointId - The id of the endpoint to delete. """; if (args.length != 2) { System.out.println(usage); System.exit(1); } String appId = args[0]; String endpointId = args[1]; System.out.println("Deleting an endpoint with id: " + endpointId); PinpointClient pinpoint = PinpointClient.builder() .region(Region.US_EAST_1) .build(); deletePinEncpoint(pinpoint, appId, endpointId); pinpoint.close(); } public static void deletePinEncpoint(PinpointClient pinpoint, String appId, String endpointId) { try { DeleteEndpointRequest appRequest = DeleteEndpointRequest.builder() .applicationId(appId) .endpointId(endpointId) .build(); DeleteEndpointResponse result = pinpoint.deleteEndpoint(appRequest); String id = result.endpointResponse().id(); System.out.println("The deleted endpoint id " + id); } catch (PinpointException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } System.out.println("Done"); } }
-
Para API obter detalhes, consulte DeleteEndpointem AWS SDK for Java 2.x APIReferência.
-
- Kotlin
-
- SDKpara Kotlin
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no Repositório de exemplos de código da AWS
. suspend fun deletePinEncpoint( appIdVal: String?, endpointIdVal: String?, ) { val deleteEndpointRequest = DeleteEndpointRequest { applicationId = appIdVal endpointId = endpointIdVal } PinpointClient { region = "us-west-2" }.use { pinpoint -> val result = pinpoint.deleteEndpoint(deleteEndpointRequest) val id = result.endpointResponse?.id println("The deleted endpoint is $id") } }
-
Para API obter detalhes, consulte a DeleteEndpoint
referência AWS SDKdo Kotlin API.
-