func Hello()

in openwhisk/_test/action/hello.go [30:47]


func Hello(event json.RawMessage) (json.RawMessage, error) {
	// input and output
	var input struct {
		Name string
	}
	var output struct {
		Greetings string `json:"greetings"`
	}
	// read the input event
	json.Unmarshal(event, &input)
	if input.Name != "" {
		// handle the event
		output.Greetings = "Hello, " + input.Name
		fmt.Println(output.Greetings)
		return json.Marshal(output)
	}
	return nil, fmt.Errorf("no name specified")
}