boto / boto3

AWS SDK for Python
https://aws.amazon.com/sdk-for-python/
Apache License 2.0
9.03k stars 1.87k forks source link

Request Payer for Versioned Buckets #2274

Closed comath closed 4 years ago

comath commented 4 years ago

We have a versioned bucket with requester pays enabled. We'd like to be able to get a list of all versions of objects with the list_object_versions call. Ideally this would be carried up to the paginator.

Currently there's no way to get both version info and provide "requester pays" in boto3, even though RequestPayer should be supported for all S3 calls. The only boto3 calls that support it are the ones where the core API documentation mentions it explicitly, which isn't done for any of the calls that return version info of objects.

swetashre commented 4 years ago

Thank you for your post. If i am understanding it correctly here the ask is to support request pays parameter in list_object_versions api call. In this case it will be a feature request for service team as we can't add any parameter on the sdk side until service supports it.

Please let me know if i am not understanding it correctly.

comath commented 4 years ago

The request payer docs says it can be supplied in all S3 calls. If that's the case, the S3 calls that specify it are being redundant Relevant line from https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html:

After you configure a bucket to be a Requester Pays bucket, requesters must include x-amz-request-payer in their requests either in the header, for POST, GET and HEAD requests, or as a parameter in a REST request to show that they understand that they will be charged for the request and the data download.

swetashre commented 4 years ago

Currently there is not any s3 api available which supports this parameter to use with SDK. It is an additional header that s3 will evaluate and you can pass this parameter in request header.

Currently this parameter is only available to use with certain cli command like cp, ls.

comath commented 4 years ago

RequestPayer is valid for list_object_v2 and pretty much all other boto3 S3 calls. According to the RequestPayer docs is valid for all S3 calls. The only calls where this is a missing option are the list objects calls that can return version info.

Are the RequestPayerdocs wrong?

swetashre commented 4 years ago

@comath - Sorry for the confusion. Yes, you are right. This parameter is supported for almost all boto3 s3 calls. But i don't understand why it would be redundant as it is an optional parameter and according to documentation requesters must include x-amz-request-payer in their requests either in the header, for POST, GET and HEAD requests, or as a parameter in a REST request. So if you are specifying this as a parameter in the request then you don't have to include it in the header.

comath commented 4 years ago

Awesome. Since it's a valid parameter is it possible to add the parameter to the list_object_versions call, and the other version-aware calls?

swetashre commented 4 years ago

@comath - We can't add any parameter to an api on SDK side, it has to be first supported by s3 service. So in this case whether to add or not to add should be decided by s3 team not us. It will be a feature request for s3. I would recommend contacting the s3 team either on their forum or creating a ticket to AWS Support.

swetashre commented 4 years ago

I am closing this issue as this will be a feature request for s3 service team and we can't do anything on the SDK side to fix the issue. Please reopen if you have any concerns.