

# 列出配置包
<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`  | 整数 | 否 | 每页返回的最大结果数。射程：1—100。 | 
|  `nextToken`  | 字符串 | 否 | 来自先前响应的分页标记。 | 

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


| 参数 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
|  `bundleId`  | 字符串 | 是 | 配置包的 ID。作为路径参数传递。 | 
|  `filter`  | 对象 | 否 | 可选过滤器。请参阅下面的[版本筛选器](#list-bundles-filter)。 | 
|  `maxResults`  | 整数 | 否 | 每页返回的最大结果数。射程：1—100。 | 
|  `nextToken`  | 字符串 | 否 | 来自先前响应的分页标记。 | 

### 版本筛选器
<a name="list-bundles-filter"></a>


| 字段 | Type | 说明 | 
| --- | --- | --- | 
|  `branchName`  | 字符串 | 仅返回此分支上的版本。 | 
|  `createdByName`  | 字符串 | 仅返回由此源名称创建的版本（例如，`optimization-job`或`recommendation`）。 | 
|  `latestPerBranch`  | 布尔值 | When`true`，仅返回每个分支的最新版本。可以与组合使用`branchName`以获取特定分支的最新信息。 | 

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

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


| 字段 | Type | 说明 | 
| --- | --- | --- | 
|  `bundles`  | 列表 | 捆绑包摘要列表。每个都包含`bundleArn``bundleId`、`bundleName`、和`description`。 | 
|  `nextToken`  | 字符串 | 下一页的分页标记。没有更多结果时不存在。 | 

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


| 字段 | Type | 说明 | 
| --- | --- | --- | 
|  `versions`  | 列表 | 版本摘要列表。每个都包含`bundleArn``bundleId`、`versionId`、`lineageMetadata`、和`versionCreatedAt`。 | 
|  `nextToken`  | 字符串 | 下一页的分页标记。没有更多结果时不存在。 | 

## 错误
<a name="list-bundles-errors"></a>


| 错误 | HTTP 状态 | 说明 | 
| --- | --- | --- | 
|  `ValidationException`  | 400 | 请求参数无效。 | 
|  `ResourceNotFoundException`  | 404 | 指定的`bundleId`不存在（ListConfigurationBundleVersions 仅限）。 | 
|  `AccessDeniedException`  | 403 | 权限不足。 | 
|  `ThrottlingException`  | 429 | 超出请求速率。使用指数回退进行重试。 | 
|  `InternalServerException`  | 500 | Service-side 错误。重试请求。 | 