

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# `DeleteVaultNotifications` 搭配 AWS SDK 或 CLI 使用
<a name="glacier_example_glacier_DeleteVaultNotifications_section"></a>

下列程式碼範例示範如何使用 `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}}
```
此命令不會產生輸出。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteVaultNotifications](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glacier/delete-vault-notifications.html)。

------
#### [ Python ]

**適用於 Python 的 SDK (Boto3)**  
 GitHub 上提供更多範例。尋找完整範例，並了解如何在 [AWS 程式碼範例儲存庫](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/glacier#code-examples)中設定和執行。

```
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
```
+  如需 API 詳細資訊，請參閱《*適用於 Python (Boto3) 的 AWS 開發套件 API 參考*》中的 [DeleteVaultNotifications](https://docs.aws.amazon.com/goto/boto3/glacier-2012-06-01/DeleteVaultNotifications)。

------