AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

This operation configures an access policy for a vault and will overwrite an existing policy. To configure a vault access policy, send a PUT request to the access-policy subresource of the vault. An access policy is specific to a vault and is also called a vault subresource. You can set one access policy per vault and the policy can be up to 20 KB in size. For more information about vault access policies, see Amazon Glacier Access Control with Vault Access Policies.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to SetVaultAccessPolicyAsync.

Namespace: Amazon.Glacier
Assembly: AWSSDK.Glacier.dll
Version: 3.x.y.z

Syntax

C#
public abstract SetVaultAccessPolicyResponse SetVaultAccessPolicy(
         SetVaultAccessPolicyRequest request
)

Parameters

request
Type: Amazon.Glacier.Model.SetVaultAccessPolicyRequest

Container for the necessary parameters to execute the SetVaultAccessPolicy service method.

Return Value


The response from the SetVaultAccessPolicy service method, as returned by Glacier.

Exceptions

ExceptionCondition
InvalidParameterValueException Returned if a parameter of the request is incorrectly specified.
MissingParameterValueException Returned if a required header or parameter is missing from the request.
ResourceNotFoundException Returned if the specified resource (such as a vault, upload ID, or job ID) doesn't exist.
ServiceUnavailableException Returned if the service cannot complete the request.

Examples

The example configures an access policy for the vault named examplevault.

To set the access-policy on a vault


var client = new AmazonGlacierClient();
var response = client.SetVaultAccessPolicy(new SetVaultAccessPolicyRequest 
{
    AccountId = "-",
    Policy = new VaultAccessPolicy { Policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Define-owner-access-rights\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::999999999999:root\"},\"Action\":\"glacier:DeleteArchive\",\"Resource\":\"arn:aws:glacier:us-west-2:999999999999:vaults/examplevault\"}]}" },
    VaultName = "examplevault"
});


            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also