Compute msec duration for whisk activations from actions.

Remove unnecessary var `boundParams` in container and inline `mergeParams` methods.

On failure where action limits are not known, omit limits:null from activation annotation.

Fix action invocation to that getting a container is wrapped in a future and can thus recover properly and not drop annotations from the action. Added test to confirm precense of limits when invoke fails.

Container pool's get action method returned None only when system was shutting down and throwing an exception otherwise. Change the type of the method accordingly to remove the Option and simplify the typing. Make invokeAction complete the transaction and ensure there is at most one completion on the path (ie if the complete transaction operation itself fails, it is not subject to the recovery clause.

Remove unnecessary promise.
1 file changed
tree: 29935879a877906b188eec8a155be0f9e761bcfb
  1. Godeps/
  2. whisk/
  3. wski18n/
  4. .gitignore
  5. CONTRIBUTING.md
  6. README.md
README.md

go-whisk

go-whisk is a Go client library for accessing the IBM Whisk API.

Usage

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)

Example

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)

}