aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-07 22:17:47 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-07 22:17:47 +0100
commita4f40bee33f2c8094d2e0315c89ded2d6b0ba95d (patch)
treeb24e1e3d49f391adcd1e2f76147d8e071ee8d958 /account.go
parent142c2d352c26c26ad0b438977a74119b994d6775 (diff)
downloadgo-schwift-a4f40bee33f2c8094d2e0315c89ded2d6b0ba95d.tar.gz
implement container listing
Tests will follow sometime later this week.
Diffstat (limited to 'account.go')
-rw-r--r--account.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/account.go b/account.go
index 5586a16..0829eb2 100644
--- a/account.go
+++ b/account.go
@@ -148,4 +148,24 @@ func (a *Account) Create(headers AccountHeaders, opts *RequestOptions) error {
return err
}
-// TODO container listing
+//Containers returns a ContainerIterator that lists the containers in this
+//account. The most common use case is:
+//
+// containers, err := account.Containers().Collect()
+//
+//You can extend this by configuring the iterator before collecting the results:
+//
+// iter := account.Containers()
+// iter.Prefix = "test-"
+// containers, err := iter.Collect()
+//
+//Or you can use a different iteration method:
+//
+// err := account.Containers().ForeachDetailed(func (ci ContainerInfo) error {
+// log.Printf("container %s contains %d objects!\n",
+// ci.Container.Name(), ci.ObjectCount)
+// })
+//
+func (a *Account) Containers() *ContainerIterator {
+ return &ContainerIterator{Account: a}
+}