# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX - License - Identifier: Apache - 2.0

# Purpose
# This code example demonstrates how to describe your Amazon WorkDocs users.

# snippet-start:[s3.wd_list_users.rb]

require "aws-sdk-workdocs"  # v2: require 'aws-sdk'
# Replace us-west-2 with the AWS Region you're using for Amazon WorkDocs.
client = Aws::WorkDocs::Client.new(region: "us-west-2")

# Set to the OrganizationId of your WorkDocs site
orgId = "d-123456789c"

resp = client.describe_users({
  organization_id: orgId,
  include: "ALL", # accepts ALL, ACTIVE_PENDING
  order: "ASCENDING", # accepts ASCENDING, DESCENDING
  sort: "USER_NAME", # accepts USER_NAME, FULL_NAME, STORAGE_LIMIT, USER_STATUS, STORAGE_USED
})

resp.users.each do |user|
  puts "First name:  #{user.given_name}"
  puts "Last name:   #{user.surname}"
  puts "Email:       #{user.email_address}"
  puts "Root folder: #{user.root_folder_id}"
  puts
end
# snippet-end:[s3.wd_list_users.rb]
