Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Get Amazon S3 Glacier vault notification configuration using an Amazon SDK
The following code example shows how to get Amazon S3 Glacier vault notification configuration.
- Python
-
- SDK for Python (Boto3)
-
class GlacierWrapper:
"""Encapsulates Amazon S3 Glacier API operations."""
def __init__(self, glacier_resource):
"""
:param glacier_resource: A Boto3 Amazon S3 Glacier resource.
"""
self.glacier_resource = glacier_resource
@staticmethod
def get_notification(vault):
"""
Gets the currently notification configuration for a vault.
:param vault: The vault to query.
:return: The notification configuration for the specified vault.
"""
try:
notification = vault.Notification()
logger.info(
"Vault %s notifies %s on %s events.",
vault.name,
notification.sns_topic,
notification.events,
)
except ClientError:
logger.exception("Couldn't get notification data for %s.", vault.name)
raise
else:
return notification
For a complete list of Amazon SDK developer guides and code examples, see
Using S3 Glacier with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.