

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

# 使用 Quick Sight APIs 處理 Quick Sight 主題
<a name="topic-cli-examples"></a>

下列範例會建立新的主題。

```
aws quicksight create-topic
--aws-account-id AWSACCOUNTID
--topic-id TOPICID
--topic TOPIC
```

您也可以使用 CLI 骨架檔案搭配下列命令來建立新的主題。如需 CLI 骨架檔案的詳細資訊，請參閱《*Amazon Quick Sight 開發人員指南*》中的[使用 CLI 骨架檔案](https://docs.aws.amazon.com/quicksight/latest/developerguide/cli-skeletons.html)。

```
aws quicksight create-topic
--cli-input-json file://createtopic.json
```

當您建立新主題時，資料集重新整理組態不會複製到主題。若要為新主題設定主題重新整理排程，您可以進行 `create-topic-refresh-schedule` API 呼叫。如需使用 CLI 設定主題重新整理排程的詳細資訊，請參閱 [使用 Quick Sight CLI 設定 Quick Sight 主題重新整理排程](topic-refresh-apis.md)。

建立第一個主題之後，您可以更新、刪除、列出或請求主題摘要。

下列範例會更新主題。

```
aws quicksight update-topic
--aws-account-id AWSACCOUNTID
--topic-id TOPICID
--topic TOPIC
```

您也可以使用 CLI 骨架檔案搭配下列命令來更新主題。如需 CLI 骨架檔案的詳細資訊，請參閱《*Amazon Quick Sight 開發人員指南*》中的[使用 CLI 骨架檔案](https://docs.aws.amazon.com/quicksight/latest/developerguide/cli-skeletons.html)。

```
aws quicksight update-topic
--cli-input-json file://updatetopic.json
```

下列範例提供快速帳戶中所有主題的清單。

```
aws quicksight list-topics 
--aws-account-id AWSACCOUNTID
```

下列範例會刪除主題。

```
aws quicksight delete-topic 
--aws-account-id AWSACCOUNTID 
--topic-id TOPICID
```

下列範例提供如何設定主題的資訊。

```
aws quicksight describe-topic 
--aws-account-id AWSACCOUNTID 
--topic-id TOPICID
```

下列命令會更新主題的許可。

```
aws quicksight update-topic-permissions
--aws-account-id AWSACCOUNTID
--topic-id TOPICID
--grant-permissions Principal=arn:aws:quicksight:us-east-1:AWSACCOUNTID:user/default/USERNAME,Actions=quicksight:DescribeTopic
--revoke-permissions Principal=arn:aws:quicksight:us-east-1:AWSACCOUNTID:user/default/USERNAME,Actions=quicksight:DescribeTopic
```

使用 `grant-permissions` 參數將讀取和撰寫許可授予快速帳戶使用者。若要授予帳戶使用者讀取許可，請輸入值：`"quicksight:DescribeTopic"`。若要向帳戶使用者授予許可，請輸入下列值：
+ `"quicksight:DescribeTopic"`
+ `"quicksight:DescribeTopicRefresh"`
+ `"quicksight:ListTopicRefreshSchedules"`
+ `"quicksight:DescribeTopicRefreshSchedule"`
+ `"quicksight:DeleteTopic"`
+ `"quicksight:UpdateTopic"`
+ `"quicksight:CreateTopicRefreshSchedule"`
+ `"quicksight:DeleteTopicRefreshSchedule"`
+ `"quicksight:UpdateTopicRefreshSchedule"`
+ `"quicksight:DescribeTopicPermissions"`
+ `"quicksight:UpdateTopicPermissions"`

`RevokePermissions` 參數會撤銷授予帳戶使用者的所有許可。

下列命令說明主題的所有許可。

```
aws quicksight describe-topic-permissions 
--aws-account-id AWSACCOUNTID
--topic-id TOPICID
```

建立 Quick Sight 主題之後，您可以使用 Amazon Quick Sight APIs 來[設定主題重新整理排程](https://docs.aws.amazon.com/quicksuite/latest/userguide/topic-refresh-apis)、在[帳戶內或帳戶之間遷移 Quick Sight 主題](https://docs.aws.amazon.com/quicksuite/latest/userguide/topic-cli-walkthroughs)，以及[建立檢閱過的答案](https://docs.aws.amazon.com/quicksuite/latest/userguide/topic-reviewed-answer-apis)。