X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c10e9e5f3398d40a3346c7d7c1f84bf50262b8ec..53a9aa7651a9fed6d88f4ece0f8d4cd10a77a63f:/doc/sdk/go/example.html.textile.liquid diff --git a/doc/sdk/go/example.html.textile.liquid b/doc/sdk/go/example.html.textile.liquid index 903d367733..5fe202dbff 100644 --- a/doc/sdk/go/example.html.textile.liquid +++ b/doc/sdk/go/example.html.textile.liquid @@ -2,34 +2,75 @@ layout: default navsection: sdk navmenu: Python -title: Python SDK examples +title: Examples ... +See "Arvados GoDoc":https://godoc.org/git.curoverse.com/arvados.git/sdk/go for detailed documentation. + +In these examples, the site prefix is @aaaaa@. + +h2. Initialize SDK + +
+import (
+  "git.curoverse.com/arvados.git/sdk/go/arvados"
+  "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
+}
+
+func main() {
+  arv, err := arvadosclient.MakeArvadosClient()
+  if err != nil {
+    log.Fatalf("Error setting up arvados client %s", err.Error())
+  }
+}
+
+ h2. create
   var collection arvados.Collection
-  err := api.Create("collection", Dict{"collection": Dict{"name": "create example"}}, &collection)
+  err := api.Create("collections", Dict{"collection": Dict{"name": "create example"}}, &collection)
 
h2. delete
   var collection arvados.Collection
-  err := api.Delete("collection", "", Dict{"collection": Dict{"name": "create example"}}, &collection)
+  err := api.Delete("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{}, &collection)
 
h2. get
+  var collection arvados.Collection
+  err := api.Get("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{}, &collection)
 
h2. list
+  var collection arvados.Collection
+  err := api.List("collections", Dict{}, &collection)
 
h2. update
+  var collection arvados.Collection
+  err := api.Update("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{"collection": Dict{"name": "update example"}}, &collection)
+
+ +h2. Get current user + +
+  var user arvados.User
+  err := api.Get("users", "current", Dict{}, &user)
 
+ +h2. Example program + +You can save this source as a .go file and run it: + +{% code 'example_sdk_go' as go %} + +A few more usage examples can be found in the "services/keepproxy":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/services/keepproxy and "sdk/go/keepclient":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/sdk/go/keepclient directories in the arvados source tree.