commit | 704fba8e0eae5714e9279dcc580115457709b594 | [log] [tgz] |
---|---|---|
author | Matt Rutkowski <mrutkows@us.ibm.com> | Sun Apr 30 21:48:05 2017 -0500 |
committer | Vincent Hou <shou@us.ibm.com> | Tue Jun 06 12:04:49 2017 -0400 |
tree | ed7a089461f9fdd68b46a92bb8015c3a2ccc8ecd | |
parent | 90dba1483c3afe811cb17cf7b7c6d620d6bcd907 [diff] |
Update Travis to clone openwhisk repo. and run scanCode (#10) * Update Travis to run scanCode from openwhisk repo. * clone openwhisk repo. to get access to common scanCode utility. * clone openwhisk repo. to get access to common scanCode utility. * chmod +x for bash scripts in tools/travis dir.
go-whisk
is a Go client library for accessing the IBM Whisk API.
import "github.ibm.com/BlueMix-Fabric/go-whisk/whisk"
Construct a new whisk client, then use various services to access different parts of the whisk api. For example to get the hello
action:
client, _ := whisk.NewClient(http.DefaultClient, nil)
action, resp, err := client.Actions.List("hello")
Some API methods have optional parameters that can be passed. For example, to list the first 30 actions, after the 30th action:
client, _ := whisk.NewClient(http.DefaultClient, nil)
options := &whisk.ActionListOptions{
Limit: 30,
Skip: 30,
}
actions, resp, err := client.Actions.List(options)
Whisk can be configured by passing in a *whisk.Config
object as the second argument to whisk.New( ... )
. For example:
u, _ := url.Parse("https://whisk.stage1.ng.bluemix.net:443/api/v1/")
config := &whisk.Config{
Namespace: "_",
AuthKey: "aaaaa-bbbbb-ccccc-ddddd-eeeee",
BaseURL: u
}
client, err := whisk.Newclient(http.DefaultClient, config)
import (
"net/http"
"net/url"
"github.ibm.com/BlueMix-Fabric/go-whisk/whisk"
)
func main() {
client, err := whisk.NewClient(http.DefaultClient, nil)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
options := &whisk.ActionListOptions{
Limit: 30,
Skip: 30,
}
actions, resp, err := client.Actions.List(options)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
fmt.Println("Returned with status: ", resp.Status)
fmt.Println("Returned actions: \n%+v", actions)
}