DeleteVaultNotifications与 AWS SDK 或 CLI 配合使用 - AWS SDK 代码示例

文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DeleteVaultNotifications与 AWS SDK 或 CLI 配合使用

以下代码示例演示如何使用 DeleteVaultNotifications

CLI
AWS CLI

删除文件库的 SNS 通知

以下 delete-vault-notifications 示例演示了如何删除 Amazon Simple Notification Service (Amazon SNS) 针对指定文件库发送的通知。

aws glacier delete-vault-notifications \ --account-id 111122223333 \ --vault-name example_vault

此命令不生成任何输出。

Python
适用于 Python 的 SDK(Boto3)
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

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 stop_notifications(notification): """ Stops notifications to the configured Amazon SNS topic. :param notification: The notification configuration to remove. """ try: notification.delete() logger.info("Notifications stopped.") except ClientError: logger.exception("Couldn't stop notifications.") raise