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

Add share object api #335

Merged
merged 1 commit into from
Oct 22, 2020
Merged

Add share object api #335

merged 1 commit into from
Oct 22, 2020

Conversation

cesnietor
Copy link
Collaborator

@cesnietor cesnietor commented Oct 21, 2020

This api returns an url presigned where you can get the object.
Request can be done on GET /api/v1/buckets/<bucket_name>/objects/share?prefix=<object_path>&version_id=<id>&expires=<amount+"ms|s|m|h>
Response payload example:

"http://localhost:9000/bucket2/file.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=Y6T35RZKJC3FMZEJX5N7%2F20201020%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201020T235640Z&X-Amz-Expires=30&X-Amz-Security-Token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJZNlQzNVJaS0pDM0ZNWkVKWDVONyIsImV4cCI6MzYwMDAwMDAwMDAwMCwicG9saWN5IjoiY29uc29sZUFkbWluIn0.ajYkcnZUB8b4GmglmIp373h7oJw9q155xZ7Z7vktjqd-uJ_wsmR4XN6ATnO3evNcEm5dQN5v9v0EyRlcQTE6kg&X-Amz-SignedHeaders=host&versionId=be2e946b-fa54-4a7a-9d79-f2392e221585&X-Amz-Signature=1c800a1bcf0f23d6edd2f42346f304f8a437cb4cd2fff5ab6a3befad5d0bfadb"

How To Test:

As a logged in user, list objects on the desired bucket with version flag to get the object version that you want to download:

http://localhost:{{mcsport}}/api/v1/buckets/bucket2/objects?prefix=file.txt&with_versions=true

Then just do get as in the previous example e.g.:

http://localhost:{{mcsport}}/api/v1/buckets/bucket2/objects/share?prefix=file.txt&version_id=be2e946b-fa54-4a7a-9d79-f2392e221585&expires=30s

If expires flag not defined, will default to 7h, you can verify on response e.g....X-Amz-Expires=<duration>...

  • Tests Included

@cesnietor cesnietor added the WIP This PR is WIP and cannot be merged yet label Oct 21, 2020
@cesnietor cesnietor self-assigned this Oct 21, 2020
@cesnietor cesnietor removed the WIP This PR is WIP and cannot be merged yet label Oct 21, 2020
dvaldivia
dvaldivia previously approved these changes Oct 21, 2020
@dvaldivia dvaldivia merged commit 1466632 into minio:master Oct 22, 2020
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.

3 participants