Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke helper #14

Open
tj opened this issue Apr 11, 2016 · 0 comments
Open

Invoke helper #14

tj opened this issue Apr 11, 2016 · 0 comments

Comments

@tj
Copy link
Member

tj commented Apr 11, 2016

something similar to the following snippet, reduce boilerplate for the simple case.

// Invoke function.
func Invoke(client *lambda.Lambda, name string, in interface{}, out interface{}) error {
    b, err := json.Marshal(in)
    if err != nil {
        return err
    }

    res, err := client.Invoke(&lambda.InvokeInput{
        FunctionName: &name,
        Qualifier:    aws.String("current"),
        Payload:      b,
    })

    if err != nil {
        return err
    }

    return json.Unmarshal(res.Payload, out)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant