本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
DeleteEndpoint
搭配 使用 AWS SDK
下列程式碼範例示範如何使用 DeleteEndpoint
。
- Java
-
- SDK 適用於 Java 2.x
-
注意
還有更多 。 GitHub尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 刪除端點。
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"); } }
-
如需API詳細資訊,請參閱 參考 DeleteEndpoint中的 。 AWS SDK for Java 2.x API
-
- Kotlin
-
- SDK 適用於 Kotlin
-
注意
還有更多 。 GitHub尋找完整範例,並了解如何在 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") } }
-
如需API詳細資訊,請參閱DeleteEndpoint
中的 AWS SDK for Kotlin API參考 。
-
如需開發人員指南和程式碼範例的完整清單 AWS SDK,請參閱 搭配 使用 Amazon Pinpoint AWS SDK。本主題也包含有關入門的資訊,以及先前SDK版本的詳細資訊。
DeleteApp
GetEndpoint