Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
The following code example shows how to add tags to an Amazon S3 Glacier vault.
- .NET
-
- Amazon SDK for .NET
-
/// <summary>
/// Add tags to the items in an Amazon S3 Glacier vault.
/// </summary>
/// <param name="vaultName">The name of the vault to add tags to.</param>
/// <param name="key">The name of the object to tag.</param>
/// <param name="value">The tag value to add.</param>
/// <returns>A Boolean value indicating the success of the action.</returns>
public async Task<bool> AddTagsToVaultAsync(string vaultName, string key, string value)
{
var request = new AddTagsToVaultRequest
{
Tags = new Dictionary<string, string>
{
{ key, value },
},
AccountId = "-",
VaultName = vaultName,
};
var response = await _glacierService.AddTagsToVaultAsync(request);
return response.HttpStatusCode == HttpStatusCode.NoContent;
}
For a complete list of Amazon SDK developer guides and code examples, see
Using S3 Glacier with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.