AWS SDK 또는 CLI와 함께 GetVaultNotifications 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

AWS SDK 또는 CLI와 함께 GetVaultNotifications 사용

다음 코드 예시는 GetVaultNotifications의 사용 방법을 보여 줍니다.

CLI
AWS CLI

다음 명령은 my-vault라는 저장소의 알림 구성 설명을 가져옵니다.

aws glacier get-vault-notifications --account-id - --vault-name my-vault

출력:

{ "vaultNotificationConfig": { "Events": [ "InventoryRetrievalCompleted", "ArchiveRetrievalCompleted" ], "SNSTopic": "arn:aws:sns:us-west-2:0123456789012:my-vault" } }

볼트에 대한 알림이 구성되지 않은 경우에는 오류가 반환됩니다. Amazon Glacier에서는 작업을 수행할 때 계정 ID 인수가 필요하지만 하이픈을 사용하여 사용 중인 계정을 지정할 수 있습니다.

Python
SDK for Python (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 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
  • API 세부 정보는 AWS SDK for Python (Boto3) API 참조GetVaultNotifications를 참조하십시오.