搭GetIdentityPoolRoles配 AWS SDK或使用 CLI - AWS SDK 程式碼範例

AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

GetIdentityPoolRoles配 AWS SDK或使用 CLI

下列程式碼範例會示範如何使用GetIdentityPoolRoles

CLI
AWS CLI

若要取得識別集區角色

此範例取得識別集區角色。

命令:

aws cognito-identity get-identity-pool-roles --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

輸出:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "Roles": { "authenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role", "unauthenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolUnauth_Role" } }
PowerShell
適用的工具 PowerShell

範例 1:取得特定識別集區之角色的相關資訊。

Get-CGIIdentityPoolRole -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1

輸出:

LoggedAt : 8/12/2015 4:33:51 PM IdentityPoolId : us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1 Roles : {[unauthenticated, arn:aws:iam::123456789012:role/CommonTests1Role]} ResponseMetadata : Amazon.Runtime.ResponseMetadata ContentLength : 165 HttpStatusCode : OK
  • 如需詳API細資訊,請參閱AWS Tools for PowerShell 指令程GetIdentityPoolRoles式參考中的。