

# 列出組態套件
<a name="configuration-bundles-list"></a>

列出您帳戶中的組態套件，或列出特定套件的版本。有兩個可用的操作：
+  **ListConfigurationBundles** — 使用摘要資訊傳回您帳戶中的所有套件。
+  **ListConfigurationBundleVersions** — 傳回特定套件的所有版本，並依分支或建立來源進行選用篩選。

這兩個操作都支援分頁。

## 程式碼範例
<a name="list-bundles-examples"></a>

**Example**  
列出套件的版本：  

```
agentcore config-bundle versions --name myAgentConfig
```
依分支篩選：  

```
agentcore config-bundle versions --name myAgentConfig --branch mainline
```
每個分支僅顯示最新版本：  

```
agentcore config-bundle versions --name myAgentConfig --latest-per-branch
```
依建立者篩選 （例如，建議任務建立的版本）：  

```
agentcore config-bundle versions --name myAgentConfig --created-by recommendation
```
列出具有分頁的所有套件：  

```
import boto3

client = boto3.client("bedrock-agentcore-control", region_name="us-west-2")

paginator = client.get_paginator("list_configuration_bundles")
for page in paginator.paginate(maxResults=20):
    for bundle in page["bundles"]:
        print(f"{bundle['bundleId']} - {bundle['bundleName']}")
```
列出特定套件的版本：  

```
response = client.list_configuration_bundle_versions(
    bundleId="myAgentConfig-a1b2c3d4e5",
    filter={"branchName": "mainline"},
    maxResults=20,
)

for version in response["versions"]:
    lineage = version.get("lineageMetadata", {})
    print(
        f"{version['versionId']}  "
        f"{version['versionCreatedAt']}  "
        f"{lineage.get('commitMessage', '')}"
    )
```

## 請求參數
<a name="list-bundles-params"></a>

### ListConfigurationBundles
<a name="list-bundles-params-bundles"></a>


| 參數 | Type | 必要 | 說明 | 
| --- | --- | --- | --- | 
|  `maxResults`  | Integer | 否 | 每個頁面要傳回的結果數目上限。範圍：1–100。 | 
|  `nextToken`  | String | 否 | 上一個回應的分頁字符。 | 

### ListConfigurationBundleVersions
<a name="list-bundles-params-versions"></a>


| 參數 | Type | 必要 | 描述 | 
| --- | --- | --- | --- | 
|  `bundleId`  | String | 是 | 組態套件的 ID。以路徑參數傳遞。 | 
|  `filter`  | 物件 | 否 | 選用篩選條件。請參閱以下 [版本篩選條件](#list-bundles-filter)。 | 
|  `maxResults`  | Integer | 否 | 每個頁面要傳回的結果數目上限。範圍：1–100。 | 
|  `nextToken`  | String | 否 | 上一個回應的分頁字符。 | 

### 版本篩選條件
<a name="list-bundles-filter"></a>


| 欄位 | Type | Description | 
| --- | --- | --- | 
|  `branchName`  | String | 僅傳回此分支上的版本。 | 
|  `createdByName`  | String | 僅傳回此來源名稱建立的版本 （例如 `optimization-job`或 `recommendation`)。 | 
|  `latestPerBranch`  | Boolean | 當 時`true`， 只會傳回每個分支的最新版本。可與 結合`branchName`，以取得特定分支的最新 。 | 

## 回應
<a name="list-bundles-response"></a>

### ListConfigurationBundles
<a name="list-bundles-response-bundles"></a>


| 欄位 | Type | 說明 | 
| --- | --- | --- | 
|  `bundles`  | 清單 | 套件摘要的清單。每個 都包含 `bundleArn`、`bundleName`、 `bundleId`和 `description`。 | 
|  `nextToken`  | String | 下一頁的分頁字符。當沒有更多結果時不存在。 | 

### ListConfigurationBundleVersions
<a name="list-bundles-response-versions"></a>


| 欄位 | Type | 說明 | 
| --- | --- | --- | 
|  `versions`  | 清單 | 版本摘要的清單。每個 都包含 `bundleArn`、`bundleId`、`lineageMetadata`、 `versionId`和 `versionCreatedAt`。 | 
|  `nextToken`  | String | 下一頁的分頁字符。當沒有更多結果時不存在。 | 

## 錯誤
<a name="list-bundles-errors"></a>


| 錯誤 | HTTP 狀態 | 說明 | 
| --- | --- | --- | 
|  `ValidationException`  | 400 | 無效的請求參數。 | 
|  `ResourceNotFoundException`  | 404 | 指定的 `bundleId` 不存在 （僅限ListConfigurationBundleVersions)。 | 
|  `AccessDeniedException`  | 403 | 許可不足。 | 
|  `ThrottlingException`  | 429 | 超過請求率。以指數退避重試。 | 
|  `InternalServerException`  | 500 | 服務端錯誤。重試 請求。 | 