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).
Describe an Amazon S3 Glacier job using an Amazon SDK
The following code example shows how to describe an Amazon S3 Glacier job.
- 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_job_status(job):
"""
Gets the status of a job.
:param job: The job to query.
:return: The current status of the job.
"""
try:
job.load()
logger.info(
"Job %s is performing action %s and has status %s.",
job.id,
job.action,
job.status_code,
)
except ClientError:
logger.exception("Couldn't get status for job %s.", job.id)
raise
else:
return job.status_code
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.