Use ListTrails with an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ListTrails with an AWS SDK

The following code example shows how to use ListTrails.

Ruby
SDK for Ruby
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

require 'aws-sdk-cloudtrail' # v2: require 'aws-sdk' def describe_trails_example(client) resp = client.describe_trails({}) puts "Found #{resp.trail_list.count} trail(s)." resp.trail_list.each do |trail| puts "Name: #{trail.name}" puts "S3 bucket name: #{trail.s3_bucket_name}" puts end
  • For API details, see ListTrails in AWS SDK for Ruby API Reference.