github.com/apex/up@v1.7.1/internal/proxy/event.go (about)

     1  package proxy
     2  
     3  // Identity is the identity information associated with the request.
     4  type Identity struct {
     5  	APIKey                        string `json:"apiKey"`
     6  	AccountID                     string `json:"accountId"`
     7  	UserAgent                     string `json:"userAgent"`
     8  	SourceIP                      string `json:"sourceIp"`
     9  	AccessKey                     string `json:"accessKey"`
    10  	Caller                        string `json:"caller"`
    11  	User                          string `json:"user"`
    12  	UserARN                       string `json:"userARN"`
    13  	CognitoIdentityID             string `json:"cognitoIdentityId"`
    14  	CognitoIdentityPoolID         string `json:"cognitoIdentityPoolId"`
    15  	CognitoAuthenticationType     string `json:"cognitoAuthenticationType"`
    16  	CognitoAuthenticationProvider string `json:"cognitoAuthenticationProvider"`
    17  }
    18  
    19  // RequestContext is the contextual information provided by API Gateway.
    20  type RequestContext struct {
    21  	APIID        string                 `json:"apiId"`
    22  	ResourceID   string                 `json:"resourceId"`
    23  	RequestID    string                 `json:"requestId"`
    24  	HTTPMethod   string                 `json:"-"`
    25  	ResourcePath string                 `json:"-"`
    26  	AccountID    string                 `json:"accountId"`
    27  	Stage        string                 `json:"stage"`
    28  	Identity     Identity               `json:"identity"`
    29  	Authorizer   map[string]interface{} `json:"authorizer"`
    30  }
    31  
    32  // Input is the input provided by API Gateway.
    33  type Input struct {
    34  	HTTPMethod            string
    35  	Headers               map[string]string
    36  	Resource              string
    37  	PathParameters        map[string]string
    38  	Path                  string
    39  	QueryStringParameters map[string]string
    40  	Body                  string
    41  	IsBase64Encoded       bool
    42  	StageVariables        map[string]string
    43  	RequestContext        RequestContext
    44  }
    45  
    46  // Output is the output expected by API Gateway.
    47  type Output struct {
    48  	StatusCode      int               `json:"statusCode"`
    49  	Headers         map[string]string `json:"headers,omitempty"`
    50  	Body            string            `json:"body,omitempty"`
    51  	IsBase64Encoded bool              `json:"isBase64Encoded"`
    52  }