commit | b239221db78b0578518daa81d97ab66cad6d08db | [log] [tgz] |
---|---|---|
author | Brandon Lee Underwood <Brandon.Lee.Underwood@ibm.com> | Thu Aug 10 21:47:07 2017 -0400 |
committer | Carlos Santana <csantana23@gmail.com> | Thu Aug 17 10:13:28 2017 -0400 |
tree | 93baa46445a319ac0d2ef9fc5cdb282596bc27d6 | |
parent | 2117d605943465aa806f37eb485ecee5e46f8ccd [diff] |
Allow CLI to sort entities by name (#2326) - Created interfaces `Printables` and `Sortables` - Made Actions, Triggers, Packages, Rules, APIs into Printables and Sortables - Made Activations into Printables and Sortables, Sort currently undefined - Made alphabetic sorting default, sort by last update time with --time flag - Changed sorting default back to last update time, --sort flag for alphabetical sorting - Updated flag name to "--name-sort"/"-n" - Updated Docs - Fixed rule status printing for `wsk list` and `wsk namespace get`
This project openwhisk-client-go
is a Go client library to access Openwhisk API.
This project is currently on an experimental stage. We periodically synchronize the source code of this repository with the Go whisk folder in OpenWhisk. The framework of test cases is under construction for this repository. Please contribute to the Go whisk folder in OpenWhisk for any Go whisk changes, before we officially announce the separation of OpenWhisk CLI from OpenWhisk.
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)
}