使用 Amazon QuickSight QuickSight 分析的預設主題 APIs - Amazon QuickSight

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

使用 Amazon QuickSight QuickSight 分析的預設主題 APIs

若要使用 API 設定預設佈景主題
  1. 確定要用作預設值的自訂佈景主題,並找到其佈景主題 ID。如果想要使用 QuickSight 入門佈景主題之一,請略過此步驟。

    若要取得自訂佈景主題的佈景主題 ID,請使用佈景主題所在區域的 ListThemes API 作業。確保佈景主題與需要使用該佈景主題的使用者或群組位於同一區域。

    下列範例顯示使用 AWS CLI中之 list-themes 命令的 Shell 指令碼。它會將 AWS 帳戶 ID 和 AWS 區域 設定為變數。如果您之前曾經用 aws configure 來設定預設區域,則將 --region 變數新增至命令會覆寫您的預設設定。

    #declare variables awsacct1='111122223333' region='us-west-2' aws quicksight list-themes \ --region $region \ --aws-account-id $awsacct1 \ --type 'CUSTOM'

  2. 使用 ListUsersListGroups API 作業,收集需要使用佈景主題作為預設值的使用者或群組的 Amazon Resource Name (ARN)。您只需要頂層 ARN。如果您的所有使用者都屬於同一群組,請使用群組 ARN。

    如需有關 QuickSight ARN 的詳細資訊,請參閱 Amazon QuickSight API 參考中的 ARN 格式

  3. 如果使用的是自訂佈景主題,請授予您在上一個步驟中收集之 ARN 的佈景主題存取權。如果使用的是入門佈景主題,請略過此步驟,因為所有使用者都可以存取入門佈景主題。

    下列範例顯示的是使用 update-theme-permissions 命令的 Shell 指令碼。grant-permissions 參數使用速記語法顯示。您可以改用 JSON 或 YAML。如需詳細資訊,請參閱《AWS Command Line Interface 使用者指南》中的指定參數值

    #declare variables awsacct1='111122223333' namespace='default' region='us-west-2' theme-id='bdb844d0-0fe9-4d9d-b520-0fe602d93639' #Find this with list-themes aws quicksight update-theme-permissions \ #Specify region if necessary: --region $region \ --aws-account-id $awsacct1 \ --theme-id $theme-id \ --grant-permissions Principal="arn:aws:quicksight:$region:$awsacct1:group/$namespace/QuickSight_Group_Name",Actions="quicksight:DescribeTheme","quicksight:ListThemeVersions","quicksight:ListThemeAliases","quicksight:DescribeThemeAlias"
  4. 將佈景主題指派為同一個或同一組 ARN 的預設值。

    #declare variables awsacct1='111122223333' namespace='default' region='us-west-2' theme-id='bdb844d0-0fe9-4d9d-b520-0fe602d93639' aws quicksight create-account-customization \ #Specify region if necessary: --region $region \ --aws-account-id $awsacct1 \ --namespace $namespace \ --account-customization DefaultTheme="arn:aws:quicksight:$region:$awsacct1:theme/$theme-id"

目前,有三個入門佈景主題:經典、午夜和海濱。它們的 ARN 是其佈景主題名稱的大寫拼字。如果您使用的是入門佈景主題而非自訂佈景主題,請使用下列佈景主題 ARN 之一:

  • arn:aws:quicksight::aws:theme/CLASSIC

  • arn:aws:quicksight::aws:theme/MIDNIGHT

  • arn:aws:quicksight::aws:theme/SEASIDE

  • arn:aws:quicksight::aws:theme/RAINIER