

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 `GetBucketInventoryConfiguration` 与 CLI 配合使用
<a name="s3_example_s3_GetBucketInventoryConfiguration_section"></a>

以下代码示例演示如何使用 `GetBucketInventoryConfiguration`。

------
#### [ CLI ]

**AWS CLI**  
**检索存储桶的清单配置**  
以下 `get-bucket-inventory-configuration` 示例检索 ID 为 `1` 的指定存储桶的清单配置。  

```
aws s3api get-bucket-inventory-configuration \
    --bucket amzn-s3-demo-bucket \
    --id 1
```
输出：  

```
{
    "InventoryConfiguration": {
        "IsEnabled": true,
        "Destination": {
            "S3BucketDestination": {
                "Format": "ORC",
                "Bucket": "arn:aws:s3:::amzn-s3-demo-bucket",
                "AccountId": "123456789012"
            }
        },
        "IncludedObjectVersions": "Current",
        "Id": "1",
        "Schedule": {
            "Frequency": "Weekly"
        }
    }
}
```
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetBucketInventoryConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/get-bucket-inventory-configuration.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此命令返回给定 S3 存储桶的名为“testinventory”的清单的详细信息。**  

```
Get-S3BucketInventoryConfiguration -BucketName 'amzn-s3-demo-bucket' -InventoryId 'testinventory'
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [GetBucketInventoryConfiguration](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此命令返回给定 S3 存储桶的名为“testinventory”的清单的详细信息。**  

```
Get-S3BucketInventoryConfiguration -BucketName 'amzn-s3-demo-bucket' -InventoryId 'testinventory'
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [GetBucketInventoryConfiguration](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------