AWS 文档 SDK 示例
将 CancelExportTask 和 AWS SDK 结合使用
以下代码示例演示了如何使用 CancelExportTask。
- .NET
-
- SDK for .NET
-
注意
查看 GitHub,了解更多信息。查找完整示例,了解如何在 AWS 代码示例存储库
中进行设置和运行。 using System; using System.Threading.Tasks; using Amazon.CloudWatchLogs; using Amazon.CloudWatchLogs.Model; /// <summary> /// Shows how to cancel an Amazon CloudWatch Logs export task. /// </summary> public class CancelExportTask { public static async Task Main() { // This client object will be associated with the same AWS Region // as the default user on this system. If you need to use a // different AWS Region, pass it as a parameter to the client // constructor. var client = new AmazonCloudWatchLogsClient(); string taskId = "exampleTaskId"; var request = new CancelExportTaskRequest { TaskId = taskId, }; var response = await client.CancelExportTaskAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"{taskId} successfully canceled."); } else { Console.WriteLine($"{taskId} could not be canceled."); } } }-
有关 API 详细信息,请参阅《AWS SDK for .NET API Reference》中的 CancelExportTask。
-
AssociateKmsKey
CreateExportTask