There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeTrail
with an AWS SDK
The following code example shows how to use DescribeTrail
.
- C++
-
- SDK for C++
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. // Routine which describes the AWS CloudTrail trails in an account. /*! \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::CloudTrail::describeTrails( const Aws::Client::ClientConfiguration &clientConfig) { Aws::CloudTrail::CloudTrailClient cloudTrailClient(clientConfig); Aws::CloudTrail::Model::DescribeTrailsRequest request; auto outcome = cloudTrailClient.DescribeTrails(request); if (outcome.IsSuccess()) { const Aws::Vector<Aws::CloudTrail::Model::Trail> &trails = outcome.GetResult().GetTrailList(); std::cout << trails.size() << " trail(s) found." << std::endl; for (const Aws::CloudTrail::Model::Trail &trail: trails) { std::cout << trail.GetName() << std::endl; } } else { std::cerr << "Failed to describe trails." << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
-
For API details, see DescribeTrail in AWS SDK for C++ API Reference.
-
DeleteTrail
DescribeTrails