initiate_vault_lock
async
¶
initiate_vault_lock(
account_id: string,
vault_name: string,
*,
config_overrides: Optional[AsyncGlacierClientConfig] = None,
policy: Optional[VaultLockPolicy] = None,
) -> InitiateVaultLockOutput
This operation initiates the vault locking process by doing the following:
-
Installing a vault lock policy on the specified vault.
-
Setting the lock state of vault lock to
InProgress. -
Returning a lock ID, which is used to complete the vault locking process.
You can set one vault lock policy for each vault and this policy can be up to 20 KB in size. For more information about vault lock policies, see Amazon Glacier Access Control with Vault Lock Policies.
You must complete the vault locking process within 24 hours after the vault lock enters the InProgress state. After the 24 hour window ends, the lock ID expires, the vault automatically exits the InProgress state, and the vault lock policy is removed from the vault. You call CompleteVaultLock to complete the vault locking process by setting the state of the vault lock to Locked.
After a vault lock is in the Locked state, you cannot initiate a new vault lock for the vault.
You can abort the vault locking process by calling AbortVaultLock. You can get the state of the vault lock by calling GetVaultLock. For more information about the vault locking process, Amazon Glacier Vault Lock.
If this operation is called when the vault lock is in the InProgress state, the operation returns an AccessDeniedException error. When the vault lock is in the InProgress state you must call AbortVaultLock before you can initiate a new vault lock policy.
Parameters:
-
account_id(string) –The
AccountIdvalue is the AWS account ID. This value must match the AWS account ID associated with the credentials used to sign the request. You can either specify an AWS account ID or optionally a single '-' (hyphen), in which case Amazon Glacier uses the AWS account ID associated with the credentials used to sign the request. If you specify your account ID, do not include any hyphens ('-') in the ID. -
vault_name(string) –The name of the vault.
-
policy(Optional[VaultLockPolicy], default:None) –The vault lock policy as a JSON string, which uses "\" as an escape character.
Raises:
-
InvalidParameterValueException–Returned if a parameter of the request is incorrectly specified.
-
MissingParameterValueException–Returned if a required header or parameter is missing from the request.
-
NoLongerSupportedException–Returned if the request was made by a customer with no Amazon Glacier storage. The request is denied as the API is no longer supported for new customers. Please use Amazon S3 Glacier storage classes instead.
-
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.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To initiate the vault locking process The example initiates the vault locking process for the vault named my-vault.
>>> await client.initiate_vault_lock(account_id='-', vault_name='my-vault', policy={'Policy': '{"Version":"2012-10-17","Statement":[{"Sid":"Define-vault-lock","Effect":"Deny","Principal":{"AWS":"arn:aws:iam::999999999999:root"},"Action":"glacier:DeleteArchive","Resource":"arn:aws:glacier:us-west-2:999999999999:vaults/examplevault","Condition":{"NumericLessThanEquals":{"glacier:ArchiveAgeinDays":"365"}}}]}'})
Source code in docs_src/capo_glacier/_services/async_glacier.py
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | |