ruby/example_code/s3/s3-ruby-example-find-open-buckets.rb
# Full example call:
# Replace us-west-2 with the AWS Region you're using for Amazon S3.

Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon S3.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon S3 .
def run_me
  region = 'us-west-2'
  s3_client = Aws::S3::Client.new(region: region)
  open_buckets = get_open_buckets(s3_client, region)
  if open_buckets.count.zero?
    puts 'No open buckets among accessible buckets with AWS Region specified ' \
      "as '#{region}' on initial creation."
  else
    puts 'Open buckets among accessible buckets with AWS Region specified ' \
      "as '#{region}' on initial creation:"
    open_buckets.each do |open_bucket|
      puts open_bucket
    end
  end
end
def run_me region = 'us-west-2' s3_client = Aws :: S3 :: Client . new ( region : region ) open_buckets = get_open_buckets ( s3_client , region ) if open_buckets . count . zero? puts 'No open buckets among accessible buckets with AWS Region specified ' "as '#{region}' on initial creation." else puts 'Open buckets among accessible buckets with AWS Region specified ' "as '#{region}' on initial creation:" open_buckets . each do | open_bucket | puts open_bucket end end end
Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon S3.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon S3 .