与 AWS SDK或DescribeUsers一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或DescribeUsers一起使用 CLI

以下代码示例演示如何使用 DescribeUsers

CLI
AWS CLI

检索指定用户的详细信息

此示例检索指定组织中所有用户的详细信息。

命令:

aws workdocs describe-users --organization-id d-926726012c

输出:

{ "Users": [ { "Id": "S-1-1-11-1111111111-2222222222-3333333333-3333&d-926726012c", "Username": "example1User", "OrganizationId": "d-926726012c", "RootFolderId": "3c0e3f849dd20a9771d937b9bbcc97e18796150ae56c26d64a4fa0320a2dedc9", "RecycleBinFolderId": "c277f4c4d647be1f5147b3184ffa96e1e2bf708278b696cacba68ba13b91f4fe", "Status": "INACTIVE", "Type": "USER", "CreatedTimestamp": 1535478999.452, "ModifiedTimestamp": 1535478999.452 }, { "Id": "S-1-1-11-1111111111-2222222222-3333333333-4444&d-926726012c", "Username": "example2User", "EmailAddress": "example2User@site.awsapps.com", "GivenName": "example2Name", "Surname": "example2Surname", "OrganizationId": "d-926726012c", "RootFolderId": "35b886cb17198cbd547655e58b025dff0cf34aaed638be52009567e23dc67390", "RecycleBinFolderId": "9858c3e9ed4c2460dde9aadb4c69fde998070dd46e5e985bd08ec6169ea249ff", "Status": "ACTIVE", "Type": "MINIMALUSER", "CreatedTimestamp": 1535478836.584, "ModifiedTimestamp": 1535478836.584 } ] }
Ruby
SDK对于 Ruby
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

# Describes users within an organization # @param [String] org_id: The ID of the org. def describe_users(org_id) resp = @client.describe_users({ organization_id: org_id, include: 'ALL', # accepts ALL, ACTIVE_PENDING order: 'ASCENDING', # accepts ASCENDING, DESCENDING sort: 'USER_NAME', # accepts USER_NAME fields: %w[FULL_NAME STORAGE_LIMIT USER_STATUS STORAGE_USED] # Corrected field names }) resp.users.each do |user| @logger.info "First name: #{user.given_name}" @logger.info "Last name: #{user.surname}" @logger.info "Email: #{user.email_address}" @logger.info "Root folder: #{user.root_folder_id}" @logger.info '' end resp.users rescue Aws::WorkDocs::Errors::ServiceError => e @logger.error "AWS WorkDocs Service Error: #{e.message}" exit(1) end
  • 有关API详细信息,请参阅 “AWS SDK for Ruby API参考 DescribeUsers” 中的。