Skip to content

set_vault_notifications

set_vault_notifications(
    account_id: string,
    vault_name: string,
    *,
    config_overrides: Optional[GlacierClientConfig] = None,
    vault_notification_config: Optional[VaultNotificationConfig] = None,
) -> None

This operation configures notifications that will be sent when specific events happen to a vault. By default, you don't get any notifications.

To configure vault notifications, send a PUT request to the notification-configuration subresource of the vault. The request should include a JSON document that provides an Amazon SNS topic and specific events for which you want Amazon Glacier to send notifications to the topic.

Amazon SNS topics must grant permission to the vault to be allowed to publish notifications to the topic. You can configure a vault to publish a notification for the following vault events:

  • ArchiveRetrievalCompleted This event occurs when a job that was initiated for an archive retrieval is completed (InitiateJob). The status of the completed job can be "Succeeded" or "Failed". The notification sent to the SNS topic is the same output as returned from DescribeJob.

  • InventoryRetrievalCompleted This event occurs when a job that was initiated for an inventory retrieval is completed (InitiateJob). The status of the completed job can be "Succeeded" or "Failed". The notification sent to the SNS topic is the same output as returned from DescribeJob.

An AWS account has full permission to perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access Management (IAM).

For conceptual information and underlying REST API, see Configuring Vault Notifications in Amazon Glacier and Set Vault Notification Configuration in the Amazon Glacier Developer Guide.

Parameters:

  • account_id (string) –

    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 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.

  • vault_name (string) –

    The name of the vault.

  • vault_notification_config (Optional[VaultNotificationConfig], default: None ) –

    Provides options for specifying notification configuration.

Raises:

Examples:

To configure a vault to post a message to an Amazon SNS topic when jobs complete The example sets the examplevault notification configuration.

>>> client.set_vault_notifications(account_id='-', vault_name='examplevault', vault_notification_config={'Events': ['ArchiveRetrievalCompleted', 'InventoryRetrievalCompleted'], 'SNSTopic': 'arn:aws:sns:us-west-2:012345678901:mytopic'})
Source code in docs_src/capo_glacier/_services/glacier.py
def set_vault_notifications(
    self,
    account_id: "capo_glacier.types.string.string",
    vault_name: "capo_glacier.types.string.string",
    *,
    config_overrides: Optional[GlacierClientConfig] = None,
    vault_notification_config: Optional[
        "capo_glacier.types.vault_notification_config.VaultNotificationConfig"
    ] = None,
) -> None:
    """<p>This operation configures notifications that will be sent when specific events happen to a vault. By default, you don't get any notifications.</p> <p>To configure vault notifications, send a PUT request to the <code>notification-configuration</code> subresource of the vault. The request should include a JSON document that provides an Amazon SNS topic and specific events for which you want Amazon Glacier to send notifications to the topic.</p> <p>Amazon SNS topics must grant permission to the vault to be allowed to publish notifications to the topic. You can configure a vault to publish a notification for the following vault events:</p> <ul> <li> <p> <b>ArchiveRetrievalCompleted</b> This event occurs when a job that was initiated for an archive retrieval is completed (<a>InitiateJob</a>). The status of the completed job can be "Succeeded" or "Failed". The notification sent to the SNS topic is the same output as returned from <a>DescribeJob</a>. </p> </li> <li> <p> <b>InventoryRetrievalCompleted</b> This event occurs when a job that was initiated for an inventory retrieval is completed (<a>InitiateJob</a>). The status of the completed job can be "Succeeded" or "Failed". The notification sent to the SNS topic is the same output as returned from <a>DescribeJob</a>. </p> </li> </ul> <p>An AWS account has full permission to perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them explicit permission to perform specific actions. For more information, see <a href="https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html">Access Control Using AWS Identity and Access Management (IAM)</a>.</p> <p>For conceptual information and underlying REST API, see <a href="https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html">Configuring Vault Notifications in Amazon Glacier</a> and <a href="https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-put.html">Set Vault Notification Configuration </a> in the <i>Amazon Glacier Developer Guide</i>. </p>

    Args:
        account_id: <p>The <code>AccountId</code> 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 '<code>-</code>' (hyphen), in which case Amazon 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.</p>
        vault_name: <p>The name of the vault.</p>
        vault_notification_config: <p>Provides options for specifying notification configuration.</p>

    Raises:
        capo_glacier.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>Returned if a parameter of the request is incorrectly specified.</p>
        capo_glacier.errors.missing_parameter_value_exception.MissingParameterValueException: <p>Returned if a required header or parameter is missing from the request.</p>
        capo_glacier.errors.no_longer_supported_exception.NoLongerSupportedException: <p>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.</p>
        capo_glacier.errors.resource_not_found_exception.ResourceNotFoundException: <p>Returned if the specified resource (such as a vault, upload ID, or job ID) doesn't exist.</p>
        capo_glacier.errors.service_unavailable_exception.ServiceUnavailableException: <p>Returned if the service cannot complete the request.</p>
        capo_glacier.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To configure a vault to post a message to an Amazon SNS topic when jobs complete
        The example sets the examplevault notification configuration.

        >>> client.set_vault_notifications(account_id='-', vault_name='examplevault', vault_notification_config={'Events': ['ArchiveRetrievalCompleted', 'InventoryRetrievalCompleted'], 'SNSTopic': 'arn:aws:sns:us-west-2:012345678901:mytopic'})
    """

    def _handler(
        req: "OperationRequest[capo_glacier.types.set_vault_notifications_input.SetVaultNotificationsInput]",
    ) -> OperationResponse[None]:
        import capo_glacier._operations.glacier.set_vault_notifications

        output, http_response = (
            capo_glacier._operations.glacier.set_vault_notifications.set_vault_notifications(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SetVaultNotifications")
    )
    input_: capo_glacier.types.set_vault_notifications_input.SetVaultNotificationsInput = {
        "account_id": account_id,
        "vault_name": vault_name,
    }
    if vault_notification_config is not None:
        input_["vault_notification_config"] = vault_notification_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output