-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 restore object from intelligent tiering requires empty RestoreRequest - how to pass along? #849
Comments
Hi sorry about that, what version of |
@DyfanJones : I am using paws.common 0.7.7 on R 4.4.0 - for reference I post my session_info below
|
Do you know the equivalent code in python boto3? paws is closer to boto3 the aws cli. |
Sure, I tested the following boto3 equivalent, which works (Python 3.12.1 for windows, boto3 : 1.34.136) import boto3
client = boto3.client('s3')
response = client.restore_object(
Bucket = 'bucket_with_restore_objs',
Key = 'key_to_restore',
RestoreRequest={}
) This works like a charm and initiates recovery without any problems |
@FMKerckhof thanks for this. Long shot (I don't think it will fix the issue but want to double check), can you check if the dev version is still having this issue: install.packages('paws', repos = c(pawsr = 'https://paws-r.r-universe.dev', CRAN = 'https://cloud.r-project.org')) |
Hi @DyfanJones : I installed the dev version as instructed, restarted my session but I am seeing the same error |
Hi @FMKerckhof, sadly I haven't been able to get around to this (currently working on migrating the vendor api from aws-sdk-js to botocore). However in the mean time, I noticed that empty named lists will create "{}". jsonlite::toJSON(setNames(list(), character()))
#> {} Created on 2024-12-13 with reprex v2.1.1 Would passing one of them fix this issue? s3con$restore_object(
Bucket = bucket_with_restore_objs,
Key = key_to_restore,
RestoreRequest = setNames(list(), character())
) |
Hi @DyfanJones : I understand, I am already super grateful for you helping me look in the correct place - also: to me it is not really clear how paws' handlers serialize the argument of RestoreRequest in this case. I assumed jsonlite::toJSON was used, but sadly still s3con$restore_object(Bucket = bucket_with_restore_objs,
Key = key_to_restore,
RestoreRequest = setNames(list(),character())) just results in the same error as above: Do you have some insights into paws' R code w.r.t. handlers? Is this where I should look? How does paws serialize these arguments? I can see that the API reference actually requires an XML rather than a json for the payload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html#API_RestoreObject_RequestSyntax) so somehow the R code has to create an XML payload for the POST request? From paws/cran/paws.storage/R/s3_operations.R Line 6791 in 591fc4c
I can see that a new operation and new request are made, but from the code for new request Line 104 in 591fc4c
Kind regards, FM |
related? #537 |
Dear, I am trying to initiate an object restore from an object in Intelligent Tiering Archive Tier (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/restore-object.html) with
s3$restore_object
(https://www.paws-r-sdk.com/docs/s3_restore_object/)However, I am running into trouble to pass along an empty JSON for the
--restore-request
(RestoreRequest
) list. As per AWS documentation, for this type of restore an empty JSON{}
has to be passed along.For example, in the terminal with AWS CLI (S3 API) the following command initiates the restore just fine:
aws s3api restore-object --bucket bucketname --key objectname --restore-request '{}'
However, I tried the below iterations in R with several variations without much success
I tried to look a bit into JSON conversion/handlers (https://github.com/paws-r/paws/blob/main/paws.common/R/handlers_core.R) but I also cannot succeed myself to get the required output from
jsonlite::toJSON
orjsonlite::serializeJSON
.Any pointers in how I could tell paws to pass along
--restore-request '{}'
to the object restore operation from the S3 API are warmly welcome.The text was updated successfully, but these errors were encountered: