DeleteProgressUpdateStream搭配使用 AWS SDK - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DeleteProgressUpdateStream搭配使用 AWS SDK

以下代码示例演示如何使用 DeleteProgressUpdateStream

Java
SDK适用于 Java 2.x
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.migrationhub.MigrationHubClient; import software.amazon.awssdk.services.migrationhub.model.DeleteProgressUpdateStreamRequest; import software.amazon.awssdk.services.migrationhub.model.MigrationHubException; /** * 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 DeleteProgressStream { public static void main(String[] args) { final String usage = """ Usage: <progressStream>\s Where: progressStream - the name of a progress stream to delete.\s """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String progressStream = args[0]; Region region = Region.US_WEST_2; MigrationHubClient migrationClient = MigrationHubClient.builder() .region(region) .build(); deleteStream(migrationClient, progressStream); migrationClient.close(); } public static void deleteStream(MigrationHubClient migrationClient, String streamName) { try { DeleteProgressUpdateStreamRequest deleteProgressUpdateStreamRequest = DeleteProgressUpdateStreamRequest .builder() .progressUpdateStreamName(streamName) .build(); migrationClient.deleteProgressUpdateStream(deleteProgressUpdateStreamRequest); System.out.println(streamName + " is deleted"); } catch (MigrationHubException e) { System.out.println(e.getMessage()); System.exit(1); } } }