文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DeleteTrail
与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 DeleteTrail
。
- C++
-
- SDK for C++
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 // Routine which deletes an AWS CloudTrail trail. /*! \param trailName: The name of the CloudTrail trail. \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::CloudTrail::deleteTrail(const Aws::String trailName, const Aws::Client::ClientConfiguration &clientConfig) { Aws::CloudTrail::CloudTrailClient trailClient(clientConfig); Aws::CloudTrail::Model::DeleteTrailRequest request; request.SetName(trailName); auto outcome = trailClient.DeleteTrail(request); if (outcome.IsSuccess()) { std::cout << "Successfully deleted trail " << trailName << std::endl; } else { std::cerr << "Error deleting trail " << trailName << " " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
-
有关 API 的详细信息,请参阅 AWS SDK for C++ API 参考DeleteTrail中的。
-
- CLI
-
- AWS CLI
-
删除跟踪
以下
delete-trail
命令删除名为Trail1
的跟踪:aws cloudtrail delete-trail --name
Trail1
-
有关 API 的详细信息,请参阅AWS CLI 命令参考DeleteTrail
中的。
-
- PowerShell
-
- 用于 PowerShell
-
示例 1:删除指定的跟踪。在运行命令之前,系统将提示您进行确认。要取消确认,请添加-Force 开关参数。
Remove-CTTrail -Name "awscloudtrail-example"
-
有关 API 的详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考DeleteTrail中的。
-
- Ruby
-
- 适用于 Ruby 的 SDK
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 client.delete_trail({ name: trail_name # required }) puts "Successfully deleted trail: #{trail_name}" rescue StandardError => e puts "Got error trying to delete trail: #{trail_name}:" puts e exit 1 end
-
有关 API 的详细信息,请参阅 AWS SDK for Ruby API 参考DeleteTrail中的。
-
CreateTrail
DescribeTrail