- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
SetVaultAccessPolicyCommand
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 .
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { GlacierClient, SetVaultAccessPolicyCommand } from "@aws-sdk/client-glacier"; // ES Modules import
// const { GlacierClient, SetVaultAccessPolicyCommand } = require("@aws-sdk/client-glacier"); // CommonJS import
const client = new GlacierClient(config);
const input = { // SetVaultAccessPolicyInput
accountId: "STRING_VALUE", // required
vaultName: "STRING_VALUE", // required
policy: { // VaultAccessPolicy
Policy: "STRING_VALUE",
},
};
const command = new SetVaultAccessPolicyCommand(input);
const response = await client.send(command);
// {};
Example Usage
SetVaultAccessPolicyCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
accountId Required | string | undefined | The |
vaultName Required | string | undefined | The name of the vault. |
policy | VaultAccessPolicy | undefined | The vault access policy as a JSON string. |
SetVaultAccessPolicyCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Throws
Name | Fault | Details |
---|
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. |