Comments (5)
I'll try to get this done by today or tomorrow.
from aliyun_oss.
Oh, I didn't think of the that when I wrote the object_url
fucntion. Actually I just wanted a convenient way to expose the object URL for downloading.
I think we can add a new function signed_url
(or if you have a better name) to support all the features described in the official doc.
def signed_url(bucket, object, expires, method \\ "GET", headers \\ ${}, sub_resources \\ %{}) do
end
What do you think?
from aliyun_oss.
LGTM
Will you commit this changes?
Thanks
from aliyun_oss.
This has been implemented and merged to master. While I was coding, I realized maybe I shouldn't limit signed_url
to only objects. But I don't want to just define another Bucket.signed_url
function because I think that's a bit redundant and there should be a better way.
Eventually I decide to just release a new version with Object.signed_url
for now.
However, if you look at the implementation of Object.signed_url
, you can easilly build any signed URL for other APIs by using Request.signed_query_url
. For example:
# Signed URL for GetBucket
%{
verb: "GET",
host: "#{bucket}.#{endpoint()}",
path: "/",
resource: "/#{bucket}/",
sub_resources: %{},
headers: %{"Content-Type" => ""},
expires: expires
}
|> Request.build()
|> Request.signed_query_url()
# Signed URL for PutBucketAcl
%{
verb: "PUT",
host: "#{bucket}.#{endpoint()}",
path: "/",
resource: "/#{bucket}/",
sub_resources: %{"acl" => nil},
headers: %{"Content-Type" => "text/plain;charset=UTF-8", "x-oss-acl" => "private"},
expires: expires
}
|> Request.build()
|> Request.signed_query_url()
# Signed URL for GetBucket
%{
verb: "GET",
host: endpoint(),
path: "/",
resource: "/",
sub_resources: %{"Content-Type" => ""},
headers: %{},
expires: expires
}
|> Request.build()
|> Request.signed_query_url()
from aliyun_oss.
v0.5.0 has been released.
from aliyun_oss.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aliyun_oss.