Doc AWS SDK Examples リポジトリには、他にも SDK の例があります。 AWS
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
AWS SDK を使用して Amazon S3 Glacier ボールト通知設定を取得する
次のコード例は、Amazon S3 Glacier ボールト通知の設定を取得する方法を示しています。
- 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 引数が必要ですが、ハイフンを使用して使用中のアカウントを指定できます。
-
API の詳細については、「 コマンドリファレンスGetVaultNotifications
」の「」を参照してください。 AWS CLI
-
- 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 の詳細については、GetVaultNotificationsAWS「 SDK for Python (Boto3) API リファレンス」の「」を参照してください。
-
ジョブの出力の取得
ジョブの一覧表示