aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-06-07 14:01:49 +0200
committerStefan Majewsky <majewsky@gmx.net>2018-06-07 14:01:49 +0200
commit0eab6bf51e2fe22de6c877e01149b49bba283792 (patch)
treed95b2e36f02977a85d6218d51235bb12a8e13f31
parentd302ac4e0f3ff52d600a32a3a0dbac056533241c (diff)
downloadgo-schwift-0eab6bf51e2fe22de6c877e01149b49bba283792.tar.gz
add URL() method also to Container, not just to Object
-rw-r--r--container.go9
-rw-r--r--object.go4
2 files changed, 12 insertions, 1 deletions
diff --git a/container.go b/container.go
index 147400d..4c94f87 100644
--- a/container.go
+++ b/container.go
@@ -201,3 +201,12 @@ func (c *Container) EnsureExists() (*Container, error) {
func (c *Container) Objects() *ObjectIterator {
return &ObjectIterator{Container: c}
}
+
+//URL returns the canonical URL for this container on the server. This is
+//particularly useful when the ReadACL on the account or container is set to
+//allow anonymous read access.
+func (c *Container) URL() (string, error) {
+ return Request{
+ ContainerName: c.name,
+ }.URL(c.a.backend, nil)
+}
diff --git a/object.go b/object.go
index ee022e3..e2cea84 100644
--- a/object.go
+++ b/object.go
@@ -581,7 +581,9 @@ func (o *Object) SymlinkHeaders() (headers ObjectHeaders, target *Object, err er
return *o.symlinkHeaders, target, nil
}
-//URL returns the canonical url for the object in the objectstore
+//URL returns the canonical URL for the object on the server. This is
+//particularly useful when the ReadACL on the account or container is set to
+//allow anonymous read access.
func (o *Object) URL() (string, error) {
return Request{
ContainerName: o.c.name,