|
| 1 | +// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | + |
| 3 | +package events |
| 4 | + |
| 5 | +// LambdaFunctionURLRequest contains data coming from the HTTP request to a Lambda Function URL. |
| 6 | +type LambdaFunctionURLRequest struct { |
| 7 | + Version string `json:"version"` // Version is expected to be `"2.0"` |
| 8 | + RawPath string `json:"rawPath"` |
| 9 | + RawQueryString string `json:"rawQueryString"` |
| 10 | + Cookies []string `json:"cookies,omitempty"` |
| 11 | + Headers map[string]string `json:"headers"` |
| 12 | + QueryStringParameters map[string]string `json:"queryStringParameters,omitempty"` |
| 13 | + RequestContext LambdaFunctionURLRequestContext `json:"requestContext"` |
| 14 | + Body string `json:"body,omitempty"` |
| 15 | + IsBase64Encoded bool `json:"isBase64Encoded"` |
| 16 | +} |
| 17 | + |
| 18 | +// LambdaFunctionURLRequestContext contains the information to identify the AWS account and resources invoking the Lambda function. |
| 19 | +type LambdaFunctionURLRequestContext struct { |
| 20 | + AccountID string `json:"accountId"` |
| 21 | + RequestID string `json:"requestId"` |
| 22 | + Authorizer *LambdaFunctionURLRequestContextAuthorizerDescription `json:"authorizer,omitempty"` |
| 23 | + APIID string `json:"apiId"` // APIID is the Lambda URL ID |
| 24 | + DomainName string `json:"domainName"` // DomainName is of the format `"<url-id>.lambda-url.<region>.on.aws"` |
| 25 | + DomainPrefix string `json:"domainPrefix"` // DomainPrefix is the Lambda URL ID |
| 26 | + Time string `json:"time"` |
| 27 | + TimeEpoch int64 `json:"timeEpoch"` |
| 28 | + HTTP LambdaFunctionURLRequestContextHTTPDescription `json:"http"` |
| 29 | +} |
| 30 | + |
| 31 | +// LambdaFunctionURLRequestContextAuthorizerDescription contains authorizer information for the request context. |
| 32 | +type LambdaFunctionURLRequestContextAuthorizerDescription struct { |
| 33 | + IAM *LambdaFunctionURLRequestContextAuthorizerIAMDescription `json:"iam,omitempty"` |
| 34 | +} |
| 35 | + |
| 36 | +// LambdaFunctionURLRequestContextAuthorizerIAMDescription contains IAM information for the request context. |
| 37 | +type LambdaFunctionURLRequestContextAuthorizerIAMDescription struct { |
| 38 | + AccessKey string `json:"accessKey"` |
| 39 | + AccountID string `json:"accountId"` |
| 40 | + CallerID string `json:"callerId"` |
| 41 | + UserARN string `json:"userArn"` |
| 42 | + UserID string `json:"userId"` |
| 43 | +} |
| 44 | + |
| 45 | +// LambdaFunctionURLRequestContextHTTPDescription contains HTTP information for the request context. |
| 46 | +type LambdaFunctionURLRequestContextHTTPDescription struct { |
| 47 | + Method string `json:"method"` |
| 48 | + Path string `json:"path"` |
| 49 | + Protocol string `json:"protocol"` |
| 50 | + SourceIP string `json:"sourceIp"` |
| 51 | + UserAgent string `json:"userAgent"` |
| 52 | +} |
| 53 | + |
| 54 | +// LambdaFunctionURLResponse configures the HTTP response to be returned by Lambda Function URL for the request. |
| 55 | +type LambdaFunctionURLResponse struct { |
| 56 | + StatusCode int `json:"statusCode"` |
| 57 | + Headers map[string]string `json:"headers"` |
| 58 | + Body string `json:"body"` |
| 59 | + IsBase64Encoded bool `json:"isBase64Encoded"` |
| 60 | + Cookies []string `json:"cookies"` |
| 61 | +} |
0 commit comments