Skip to content
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

Simple way to get presigned URLs with Simple S3 client #862

Merged
merged 1 commit into from Nov 20, 2020
Merged

Simple way to get presigned URLs with Simple S3 client #862

merged 1 commit into from Nov 20, 2020

Conversation

rimas-kudelis
Copy link
Contributor

Hi!
I think a simpler way to get presigned S3 urls would be a good addition to the Simple S3 client, so here it is.

@Nyholm
Copy link
Member

Nyholm commented Nov 20, 2020

Thank you for this PR.
I have also found that presign() is the only method outside the SimpleS3Client that I use.

However, Im not sure it is making things more "simple", but we may want to include it for completeness. The current download() and has() is also very "thin" like this.

 $bucket = 'my-cats';
 $key => 'snowball.jpg';
 $date = new \DateTimeImmutable('+15minutes');

-$url = $client->presign(['Bucket'=>$bucket, 'Key'=>$key], $date);
+$url = $client->getPresignedUrl($bucket, $key, $date);

@Nyholm Nyholm requested a review from jderusse November 20, 2020 07:59
@rimas-kudelis
Copy link
Contributor Author

rimas-kudelis commented Nov 20, 2020

Oh, I thought instantiating a GetObjectRequest was necessary.

@jderusse
Copy link
Member

jderusse commented Nov 20, 2020

Oh, I thought instantiating a GetObjectRequest was necessary.

Yes, it is. The right diff should be, If I not mistake:

 $bucket = 'my-cats';
 $key => 'snowball.jpg';
 $date = new \DateTimeImmutable('+15minutes');

-$url = $client->presign(new GetObjectRequest(['Bucket'=>$bucket, 'Key'=>$key]), $date);
+$url = $client->getPresignedUrl($bucket, $key, $date);

@jderusse jderusse merged commit d318cd7 into async-aws:master Nov 20, 2020
@jderusse
Copy link
Member

thank you

@rimas-kudelis
Copy link
Contributor Author

Wow, this was fast. Thanks!

@rimas-kudelis rimas-kudelis deleted the presigned-urls-with-simple-s3-client branch November 20, 2020 08:09
@rimas-kudelis
Copy link
Contributor Author

May I expect a 1.0.1 release anytime soon?

@Nyholm
Copy link
Member

Nyholm commented Nov 20, 2020

It should be 1.1.0. =)

Sure. Let's do it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants