S3 / Client / list_parts
list_parts#
- S3.Client.list_parts(**kwargs)#
Lists the parts that have been uploaded for a specific multipart upload.
To use this operation, you must provide the
upload ID
in the request. You obtain this uploadID by sending the initiate multipart upload request through CreateMultipartUpload.The
ListParts
request returns a maximum of 1,000 uploaded parts. The limit of 1,000 parts is also the default value. You can restrict the number of parts in a response by specifying themax-parts
request parameter. If your multipart upload consists of more than 1,000 parts, the response returns anIsTruncated
field with the value oftrue
, and aNextPartNumberMarker
element. To list remaining uploaded parts, in subsequentListParts
requests, include thepart-number-marker
query string parameter and set its value to theNextPartNumberMarker
field value from the previous response.For more information on multipart uploads, see Uploading Objects Using Multipart Upload in the Amazon S3 User Guide.
Note
Directory buckets - For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format ``https://bucket_name.s3express-az_id.region.amazonaws.com/key-name ``. Path-style requests are not supported. For more information, see Regional and Zonal endpoints in the Amazon S3 User Guide.
Permissions
General purpose bucket permissions - For information about permissions required to use the multipart upload API, see Multipart Upload and Permissions in the Amazon S3 User Guide. If the upload was created using server-side encryption with Key Management Service (KMS) keys (SSE-KMS) or dual-layer server-side encryption with Amazon Web Services KMS keys (DSSE-KMS), you must have permission to the
kms:Decrypt
action for theListParts
request to succeed.Directory bucket permissions - To grant access to this API operation on a directory bucket, we recommend that you use the CreateSession API operation for session-based authorization. Specifically, you grant the
s3express:CreateSession
permission to the directory bucket in a bucket policy or an IAM identity-based policy. Then, you make theCreateSession
API call on the bucket to obtain a session token. With the session token in your request header, you can make API requests to this operation. After the session token expires, you make anotherCreateSession
API call to generate a new session token for use. Amazon Web Services CLI or SDKs create session and refresh the session token automatically to avoid service interruptions when a session expires. For more information about authorization, see CreateSession.HTTP Host header syntax
Directory buckets - The HTTP Host header syntax is
Bucket_name.s3express-az_id.region.amazonaws.com
.The following operations are related to
ListParts
:See also: AWS API Documentation
Request Syntax
response = client.list_parts( Bucket='string', Key='string', MaxParts=123, PartNumberMarker=123, UploadId='string', RequestPayer='requester', ExpectedBucketOwner='string', SSECustomerAlgorithm='string', SSECustomerKey='string', )
- Parameters:
Bucket (string) –
[REQUIRED]
The name of the bucket to which the parts are being uploaded.
Directory buckets - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format
Bucket_name.s3express-az_id.region.amazonaws.com
. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the formatbucket_base_name--az-id--x-s3
(for example,DOC-EXAMPLE-BUCKET--usw2-az1--x-s3
). For information about bucket naming restrictions, see Directory bucket naming rules in the Amazon S3 User Guide.Access points - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.*Region*.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
Note
Access points and Object Lambda access points are not supported by directory buckets.
S3 on Outposts - When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
. When you use this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts? in the Amazon S3 User Guide.Key (string) –
[REQUIRED]
Object key for which the multipart upload was initiated.
MaxParts (integer) – Sets the maximum number of parts to return.
PartNumberMarker (integer) – Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.
UploadId (string) –
[REQUIRED]
Upload ID identifying the multipart upload whose parts are being listed.
RequestPayer (string) –
Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.
Note
This functionality is not supported for directory buckets.
ExpectedBucketOwner (string) – The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).SSECustomerAlgorithm (string) –
The server-side encryption (SSE) algorithm used to encrypt the object. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
Note
This functionality is not supported for directory buckets.
SSECustomerKey (string) –
The server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
Note
This functionality is not supported for directory buckets.
SSECustomerKeyMD5 (string) –
The MD5 server-side encryption (SSE) customer managed key. This parameter is needed only when the object was created using a checksum algorithm. For more information, see Protecting data using SSE-C keys in the Amazon S3 User Guide.
Note
This functionality is not supported for directory buckets.
Please note that this parameter is automatically populated if it is not provided. Including this parameter is not required
- Return type:
dict
- Returns:
Response Syntax
{ 'AbortDate': datetime(2015, 1, 1), 'AbortRuleId': 'string', 'Bucket': 'string', 'Key': 'string', 'UploadId': 'string', 'PartNumberMarker': 123, 'NextPartNumberMarker': 123, 'MaxParts': 123, 'IsTruncated': True|False, 'Parts': [ { 'PartNumber': 123, 'LastModified': datetime(2015, 1, 1), 'ETag': 'string', 'Size': 123, 'ChecksumCRC32': 'string', 'ChecksumCRC32C': 'string', 'ChecksumSHA1': 'string', 'ChecksumSHA256': 'string' }, ], 'Initiator': { 'ID': 'string', 'DisplayName': 'string' }, 'Owner': { 'DisplayName': 'string', 'ID': 'string' }, 'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE'|'OUTPOSTS'|'GLACIER_IR'|'SNOW'|'EXPRESS_ONEZONE', 'RequestCharged': 'requester', 'ChecksumAlgorithm': 'CRC32'|'CRC32C'|'SHA1'|'SHA256' }
Response Structure
(dict) –
AbortDate (datetime) –
If the bucket has a lifecycle rule configured with an action to abort incomplete multipart uploads and the prefix in the lifecycle rule matches the object name in the request, then the response includes this header indicating when the initiated multipart upload will become eligible for abort operation. For more information, see Aborting Incomplete Multipart Uploads Using a Bucket Lifecycle Configuration.
The response will also include the
x-amz-abort-rule-id
header that will provide the ID of the lifecycle configuration rule that defines this action.Note
This functionality is not supported for directory buckets.
AbortRuleId (string) –
This header is returned along with the
x-amz-abort-date
header. It identifies applicable lifecycle configuration rule that defines the action to abort incomplete multipart uploads.Note
This functionality is not supported for directory buckets.
Bucket (string) –
The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN or access point alias if used.
Key (string) –
Object key for which the multipart upload was initiated.
UploadId (string) –
Upload ID identifying the multipart upload whose parts are being listed.
PartNumberMarker (integer) –
Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.
NextPartNumberMarker (integer) –
When a list is truncated, this element specifies the last part in the list, as well as the value to use for the
part-number-marker
request parameter in a subsequent request.MaxParts (integer) –
Maximum number of parts that were allowed in the response.
IsTruncated (boolean) –
Indicates whether the returned list of parts is truncated. A true value indicates that the list was truncated. A list can be truncated if the number of parts exceeds the limit returned in the MaxParts element.
Parts (list) –
Container for elements related to a particular part. A response can contain zero or more
Part
elements.(dict) –
Container for elements related to a part.
PartNumber (integer) –
Part number identifying the part. This is a positive integer between 1 and 10,000.
LastModified (datetime) –
Date and time at which the part was uploaded.
ETag (string) –
Entity tag returned when the part was uploaded.
Size (integer) –
Size in bytes of the uploaded part data.
ChecksumCRC32 (string) –
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 32-bit CRC-32 checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
ChecksumCRC32C (string) –
The base64-encoded, 32-bit CRC-32C checksum of the object. This will only be present if it was uploaded with the object. When you use an API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it’s a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see Checking object integrity in the Amazon S3 User Guide.
ChecksumSHA1 (string) –
The base64-encoded, 160-bit SHA-1 digest of the object. This will only be present if it was uploaded with the object. When you use the API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it’s a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see Checking object integrity in the Amazon S3 User Guide.
ChecksumSHA256 (string) –
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This header specifies the base64-encoded, 256-bit SHA-256 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
Initiator (dict) –
Container element that identifies who initiated the multipart upload. If the initiator is an Amazon Web Services account, this element provides the same information as the
Owner
element. If the initiator is an IAM User, this element provides the user ARN and display name.ID (string) –
If the principal is an Amazon Web Services account, it provides the Canonical User ID. If the principal is an IAM User, it provides a user ARN value.
Note
Directory buckets - If the principal is an Amazon Web Services account, it provides the Amazon Web Services account ID. If the principal is an IAM User, it provides a user ARN value.
DisplayName (string) –
Name of the Principal.
Note
This functionality is not supported for directory buckets.
Owner (dict) –
Container element that identifies the object owner, after the object is created. If multipart upload is initiated by an IAM user, this element provides the parent account ID and display name.
Note
Directory buckets - The bucket owner is returned as the object owner for all the parts.
DisplayName (string) –
Container for the display name of the owner. This value is only supported in the following Amazon Web Services Regions:
US East (N. Virginia)
US West (N. California)
US West (Oregon)
Asia Pacific (Singapore)
Asia Pacific (Sydney)
Asia Pacific (Tokyo)
Europe (Ireland)
South America (São Paulo)
Note
This functionality is not supported for directory buckets.
ID (string) –
Container for the ID of the owner.
StorageClass (string) –
The class of storage used to store the uploaded object.
Note
Directory buckets - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.
RequestCharged (string) –
If present, indicates that the requester was successfully charged for the request.
Note
This functionality is not supported for directory buckets.
ChecksumAlgorithm (string) –
The algorithm that was used to create a checksum of the object.
Examples
The following example lists parts uploaded for a specific multipart upload.
response = client.list_parts( Bucket='examplebucket', Key='bigobject', UploadId='example7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--', ) print(response)
Expected Output:
{ 'Initiator': { 'DisplayName': 'owner-display-name', 'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc', }, 'Owner': { 'DisplayName': 'owner-display-name', 'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc', }, 'Parts': [ { 'ETag': '"d8c2eafd90c266e19ab9dcacc479f8af"', 'LastModified': datetime(2016, 12, 16, 0, 11, 42, 4, 351, 0), 'PartNumber': '1', 'Size': 26246026, }, { 'ETag': '"d8c2eafd90c266e19ab9dcacc479f8af"', 'LastModified': datetime(2016, 12, 16, 0, 15, 1, 4, 351, 0), 'PartNumber': '2', 'Size': 26246026, }, ], 'StorageClass': 'STANDARD', 'ResponseMetadata': { '...': '...', }, }