commit | 1b06b752411866f91196f67600be69f9711c421d | [log] [tgz] |
---|---|---|
author | Vincent <shou@us.ibm.com> | Mon Jun 26 23:44:55 2017 -0400 |
committer | daisy-ycguo <guoyingc@cn.ibm.com> | Tue Jun 27 11:44:55 2017 +0800 |
tree | 994d19127f4554e684671dccba73d8737e1f4f60 | |
parent | f26793c94fd6883867eaa98ed8249024128cbcc6 [diff] |
Add the Travis configuration to run integration tests (#15) This repo will eventually has unit tests and integration tests writen in Go running against the openwhisk services. However, before this work item is finished, we need to at least have the existing scala tests as the goalkeeper to guarentee the code quality of new PRs. This is the reason why we use this PR as a tentative solution to fill in the gap of missing test caes. At the same time, we are working on the test cases for this repo.
This project openwhisk-client-go
is a Go client library to access Openwhisk API.
import "github.com/apache/incubator-openwhisk-client-go/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.com/apache/incubator-openwhisk-client-go/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)
}