GetVaultAccessPolicyCommand

This operation retrieves the access-policy subresource set on the vault; for more information on setting this subresource, see Set Vault Access Policy (PUT access-policy) . If there is no access policy set on the vault, the operation returns a 404 Not found error. For more information about vault access policies, see Amazon Glacier Access Control with Vault Access Policies .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlacierClient, GetVaultAccessPolicyCommand } from "@aws-sdk/client-glacier"; // ES Modules import
// const { GlacierClient, GetVaultAccessPolicyCommand } = require("@aws-sdk/client-glacier"); // CommonJS import
const client = new GlacierClient(config);
const input = { // GetVaultAccessPolicyInput
  accountId: "STRING_VALUE", // required
  vaultName: "STRING_VALUE", // required
};
const command = new GetVaultAccessPolicyCommand(input);
const response = await client.send(command);
// { // GetVaultAccessPolicyOutput
//   policy: { // VaultAccessPolicy
//     Policy: "STRING_VALUE",
//   },
// };

Example Usage

// The example retrieves the access-policy set on the vault named example-vault.
const input = {
"accountId": "-",
"vaultName": "example-vault"
};
const command = new GetVaultAccessPolicyCommand(input);
const response = await client.send(command);
/* response ==
{
"policy": {
"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\"}]}"
}
}
*\/
// example id: to--get-the-access-policy-set-on-the-vault-1481936004590
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
JavaScriptLn 1, Col 1
Errors: 0 Warnings: 0

GetVaultAccessPolicyCommand Input

Parameter
Type
Description
accountId
Required
string | undefined

The AccountId value is the AWS account ID of the account that owns the vault. You can either specify an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3 Glacier uses the AWS account ID associated with the credentials used to sign the request. If you use an account ID, do not include any hyphens ('-') in the ID.

vaultName
Required
string | undefined

The name of the vault.

GetVaultAccessPolicyCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
policy
VaultAccessPolicy | undefined

Contains the returned vault access policy as a JSON string.

Throws

Name
Fault
Details
InvalidParameterValueException
client

Returned if a parameter of the request is incorrectly specified.

MissingParameterValueException
client

Returned if a required header or parameter is missing from the request.

ResourceNotFoundException
client

Returned if the specified resource (such as a vault, upload ID, or job ID) doesn't exist.

ServiceUnavailableException
server

Returned if the service cannot complete the request.

GlacierServiceException
Base exception class for all service exceptions from Glacier service.