Documentation ¶
Overview ¶
Example ¶
package main import ( "context" "net/http" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/lambda" "github.com/shogo82148/lambtrip" ) func main() { // Initialize AWS SDK to create a service client for AWS Lambda. cfg, err := config.LoadDefaultConfig(context.Background()) if err != nil { panic(err) } svc := lambda.NewFromConfig(cfg) // Create a new HTTP transport and register the "lambda" protocol with a custom transport handler. t := &http.Transport{} t.RegisterProtocol("lambda", lambtrip.NewBufferedTransport(svc)) // Create a new HTTP client using the custom transport to handle requests to Lambda functions. c := &http.Client{Transport: t} // Make an HTTP GET request to a specific Lambda function using the custom "lambda://" protocol. resp, err := c.Get("lambda://function-name/foo/bar") if err != nil { panic(err) } defer resp.Body.Close() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedTransport ¶
type BufferedTransport struct {
// contains filtered or unexported fields
}
func NewBufferedTransport ¶
func NewBufferedTransport(c *lambda.Client) *BufferedTransport
type LambdaError ¶
LambdaError is an error returned by the lambda client.
func (*LambdaError) Error ¶
func (e *LambdaError) Error() string
type ResponseStreamError ¶
ResponseStreamError is an error during response stream.
func (*ResponseStreamError) Error ¶
func (e *ResponseStreamError) Error() string
type ResponseStreamTransport ¶
type ResponseStreamTransport struct {
// contains filtered or unexported fields
}
func NewResponseStreamTransport ¶
func NewResponseStreamTransport(c *lambda.Client) *ResponseStreamTransport
Click to show internal directories.
Click to hide internal directories.