ListTagsForVault与 Amazon SDK 或 CLI 配合使用 - Amazon S3 Glacier
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

此页面仅适用于使用 Vaults 和 2012 年原始 REST API 的 S3 Glacier 服务的现有客户。

如果您正在寻找档案存储解决方案,我们建议您在亚马逊 S3、S3 Glacier 即时检索、S3 Glacier 灵活检索和 S3 Glacier Deep Archive Dee p Archive 中使用 S3 Glacier 存储类。要了解有关这些存储选项的更多信息,请参阅 Amazon S3 用户指南中的 S3 Glacier 存储类和使用 S3 Glacier 存储类的长期数据存储。这些存储类别使用 Amazon S3 API,适用于所有区域,并且可以在 Amazon S3 控制台中进行管理。它们提供存储成本分析、存储镜头、包括多种加密选项在内的安全功能等功能。

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

ListTagsForVault与 Amazon SDK 或 CLI 配合使用

以下代码示例演示如何使用 ListTagsForVault

.NET
Amazon SDK for .NET
注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

/// <summary> /// List tags for an Amazon S3 Glacier vault. /// </summary> /// <param name="vaultName">The name of the vault to list tags for.</param> /// <returns>A dictionary listing the tags attached to each object in the /// vault and its tags.</returns> public async Task<Dictionary<string, string>> ListTagsForVaultAsync(string vaultName) { var request = new ListTagsForVaultRequest { // Using a hyphen "-" for the Account Id will // cause the SDK to use the Account Id associated // with the default user. AccountId = "-", VaultName = vaultName, }; var response = await _glacierService.ListTagsForVaultAsync(request); return response.Tags; }
  • 有关 API 的详细信息,请参阅 Amazon SDK for .NET API 参考ListTagsForVault中的。

CLI
Amazon CLI

以下命令列出应用于名为 my-vault 的文件库的标签:

aws glacier list-tags-for-vault --account-id - --vault-name my-vault

输出:

{ "Tags": { "date": "july2015", "id": "1234" } }

Amazon Glacier 在执行操作时需要一个账户 ID 参数,但您可以使用连字符来指定正在使用的账户。

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考ListTagsForVault中的。

有关 S Amazon DK 开发者指南和代码示例的完整列表,请参阅将 S3 Glacier 与 S Amazon DK 配。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。