AWS code-library documentation change
Summary
Added Python SDK example for describing S3 batch job details
Security assessment
The change provides a code example for retrieving job status information but does not contain security-related content or address vulnerabilities.
Diff
diff --git a/code-library/latest/ug/s3-control_example_s3-control_DescribeJob_section.md b/code-library/latest/ug/s3-control_example_s3-control_DescribeJob_section.md index f7ef6d78f..f259bd074 100644 --- a//code-library/latest/ug/s3-control_example_s3-control_DescribeJob_section.md +++ b//code-library/latest/ug/s3-control_example_s3-control_DescribeJob_section.md @@ -156,0 +157,46 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Python + + +**SDK for Python (Boto3)** + + +###### Note + +There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/s3/scenarios/batch#code-examples). + + + def describe_job_details(self, job_id: str, account_id: str) -> None: + """ + Describe detailed information about a batch job. + + Args: + job_id (str): ID of the batch job + account_id (str): AWS account ID + """ + try: + response = self.s3control_client.describe_job( + AccountId=account_id, + JobId=job_id + ) + job = response['Job'] + print(f"Job ID: {job['JobId']}") + print(f"Description: {job.get('Description', 'N/A')}") + print(f"Status: {job['Status']}") + print(f"Role ARN: {job['RoleArn']}") + print(f"Priority: {job['Priority']}") + if 'ProgressSummary' in job: + progress = job['ProgressSummary'] + print(f"Progress Summary: Total={progress.get('TotalNumberOfTasks', 0)}, " + f"Succeeded={progress.get('NumberOfTasksSucceeded', 0)}, " + f"Failed={progress.get('NumberOfTasksFailed', 0)}") + except ClientError as e: + print(f"Error describing job: {e}") + raise + + + + * For API details, see [DescribeJob](https://docs.aws.amazon.com/goto/boto3/s3control-2018-08-20/DescribeJob) in _AWS SDK for Python (Boto3) API Reference_. + + + +