Skip to content

Commit 19fe79d

Browse files
committed
Rearrange struct definition order to match AWS Go project conventions
1 parent 92a9843 commit 19fe79d

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

events/apigw.go

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type APIGatewayProxyResponse struct {
2828
}
2929

3030
// APIGatewayProxyRequestContext contains the information to identify the AWS account and resources invoking the
31-
// Lambda function. It also includes Cognito identity information for the caller
31+
// Lambda function. It also includes Cognito identity information for the caller.
3232
type APIGatewayProxyRequestContext struct {
3333
AccountID string `json:"accountId"`
3434
ResourceID string `json:"resourceId"`
@@ -63,37 +63,6 @@ type APIGatewayV2HTTPRequest struct {
6363
IsBase64Encoded bool `json:"isBase64Encoded"`
6464
}
6565

66-
// APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity contains Cognito identity information for the request contex
67-
type APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity struct {
68-
AMR []string `json:"amr"`
69-
IdentityID string `json:"identityId"`
70-
IdentityPoolID string `json:"identityPoolId"`
71-
}
72-
73-
// APIGatewayV2HTTPRequestContextAuthorizerIAMDescription contains IAM information for the request contex
74-
type APIGatewayV2HTTPRequestContextAuthorizerIAMDescription struct {
75-
AccessKey string `json:"accessKey"`
76-
AccountID string `json:"accountId"`
77-
CallerID string `json:"callerId"`
78-
CognitoIdentity APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity `json:"cognitoIdentity,omitempty"`
79-
PrincipalOrgID string `json:"principalOrgId"`
80-
UserARN string `json:"userArn"`
81-
UserID string `json:"userId"`
82-
}
83-
84-
// APIGatewayV2HTTPRequestContextAuthorizerJWTDescription contains JWT authorizer information for the request context.
85-
type APIGatewayV2HTTPRequestContextAuthorizerJWTDescription struct {
86-
Claims map[string]string `json:"claims"`
87-
Scopes []string `json:"scopes,omitempty"`
88-
}
89-
90-
// APIGatewayV2HTTPRequestContextAuthorizerDescription contains authorizer information for the request context.
91-
type APIGatewayV2HTTPRequestContextAuthorizerDescription struct {
92-
JWT *APIGatewayV2HTTPRequestContextAuthorizerJWTDescription `json:"jwt,omitempty"`
93-
Lambda map[string]interface{} `json:"lambda,omitempty"`
94-
IAM *APIGatewayV2HTTPRequestContextAuthorizerIAMDescription `json:"iam,omitempty"`
95-
}
96-
9766
// APIGatewayV2HTTPRequestContext contains the information to identify the AWS account and resources invoking the Lambda function.
9867
type APIGatewayV2HTTPRequestContext struct {
9968
RouteKey string `json:"routeKey"`
@@ -110,6 +79,37 @@ type APIGatewayV2HTTPRequestContext struct {
11079
Authentication APIGatewayV2HTTPRequestContextAuthentication `json:"authentication"`
11180
}
11281

82+
// APIGatewayV2HTTPRequestContextAuthorizerDescription contains authorizer information for the request context.
83+
type APIGatewayV2HTTPRequestContextAuthorizerDescription struct {
84+
JWT *APIGatewayV2HTTPRequestContextAuthorizerJWTDescription `json:"jwt,omitempty"`
85+
Lambda map[string]interface{} `json:"lambda,omitempty"`
86+
IAM *APIGatewayV2HTTPRequestContextAuthorizerIAMDescription `json:"iam,omitempty"`
87+
}
88+
89+
// APIGatewayV2HTTPRequestContextAuthorizerJWTDescription contains JWT authorizer information for the request context.
90+
type APIGatewayV2HTTPRequestContextAuthorizerJWTDescription struct {
91+
Claims map[string]string `json:"claims"`
92+
Scopes []string `json:"scopes,omitempty"`
93+
}
94+
95+
// APIGatewayV2HTTPRequestContextAuthorizerIAMDescription contains IAM information for the request context.
96+
type APIGatewayV2HTTPRequestContextAuthorizerIAMDescription struct {
97+
AccessKey string `json:"accessKey"`
98+
AccountID string `json:"accountId"`
99+
CallerID string `json:"callerId"`
100+
CognitoIdentity APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity `json:"cognitoIdentity,omitempty"`
101+
PrincipalOrgID string `json:"principalOrgId"`
102+
UserARN string `json:"userArn"`
103+
UserID string `json:"userId"`
104+
}
105+
106+
// APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity contains Cognito identity information for the request context.
107+
type APIGatewayV2HTTPRequestContextAuthorizerCognitoIdentity struct {
108+
AMR []string `json:"amr"`
109+
IdentityID string `json:"identityId"`
110+
IdentityPoolID string `json:"identityPoolId"`
111+
}
112+
113113
// APIGatewayV2HTTPRequestContextHTTPDescription contains HTTP information for the request context.
114114
type APIGatewayV2HTTPRequestContextHTTPDescription struct {
115115
Method string `json:"method"`
@@ -150,7 +150,7 @@ type APIGatewayRequestIdentity struct {
150150
type APIGatewayWebsocketProxyRequest struct {
151151
Resource string `json:"resource"` // The resource path defined in API Gateway
152152
Path string `json:"path"` // The url path for the caller
153-
HTTPMethod string `json:"httpMethod,omitempty"`
153+
HTTPMethod string `json:"httpMethod"`
154154
Headers map[string]string `json:"headers"`
155155
MultiValueHeaders map[string][]string `json:"multiValueHeaders"`
156156
QueryStringParameters map[string]string `json:"queryStringParameters"`
@@ -190,12 +190,33 @@ type APIGatewayWebsocketProxyRequestContext struct {
190190
Status string `json:"status"`
191191
}
192192

193-
// APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity contains client certificate validity information for the request caller if using mTLS.
194-
type APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity struct {
193+
// APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller including certificate information if using mTLS.
194+
type APIGatewayCustomAuthorizerRequestTypeRequestIdentity struct {
195+
APIKey string `json:"apiKey"`
196+
SourceIP string `json:"sourceIp"`
197+
ClientCert APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert `json:"clientCert"`
198+
}
199+
200+
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert contains certificate information for the request caller if using mTLS..
201+
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert struct {
202+
ClientCertPem string `json:"clientCertPem"`
203+
IssuerDN string `json:"issuerDN"`
204+
SerialNumber string `json:"serialNumber"`
205+
SubjectDN string `json:"subjectDN"`
206+
Validity APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity `json:"validity"`
207+
}
208+
209+
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity contains certificate validity information for the request caller if using mTLS.
210+
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity struct {
195211
NotAfter string `json:"notAfter"`
196212
NotBefore string `json:"notBefore"`
197213
}
198214

215+
// APIGatewayV2HTTPRequestContextAuthentication contains authentication context information for the request caller including client certificate information if using mTLS.
216+
type APIGatewayV2HTTPRequestContextAuthentication struct {
217+
ClientCert APIGatewayV2HTTPRequestContextAuthenticationClientCert `json:"clientCert"`
218+
}
219+
199220
// APIGatewayV2HTTPRequestContextAuthenticationClientCert contains client certificate information for the request caller if using mTLS.
200221
type APIGatewayV2HTTPRequestContextAuthenticationClientCert struct {
201222
ClientCertPem string `json:"clientCertPem"`
@@ -205,33 +226,12 @@ type APIGatewayV2HTTPRequestContextAuthenticationClientCert struct {
205226
Validity APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity `json:"validity"`
206227
}
207228

208-
// APIGatewayV2HTTPRequestContextAuthentication contains authentication context information for the request caller including client certificate information if using mTLS..
209-
type APIGatewayV2HTTPRequestContextAuthentication struct {
210-
ClientCert APIGatewayV2HTTPRequestContextAuthenticationClientCert `json:"clientCert"`
211-
}
212-
213-
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity contains certificate validity information for the request caller if using mTLS.
214-
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity struct {
229+
// APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity contains client certificate validity information for the request caller if using mTLS.
230+
type APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity struct {
215231
NotAfter string `json:"notAfter"`
216232
NotBefore string `json:"notBefore"`
217233
}
218234

219-
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert contains certificate information for the request caller if using mTLS.
220-
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert struct {
221-
ClientCertPem string `json:"clientCertPem"`
222-
IssuerDN string `json:"issuerDN"`
223-
SerialNumber string `json:"serialNumber"`
224-
SubjectDN string `json:"subjectDN"`
225-
Validity APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity `json:"validity"`
226-
}
227-
228-
// APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller including certificate information if using mTLS.
229-
type APIGatewayCustomAuthorizerRequestTypeRequestIdentity struct {
230-
APIKey string `json:"apiKey"`
231-
SourceIP string `json:"sourceIp"`
232-
ClientCert APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert `json:"clientCert"`
233-
}
234-
235235
// APIGatewayCustomAuthorizerContext represents the expected format of an API Gateway custom authorizer response.
236236
// Deprecated. Code should be updated to use the Authorizer map from APIGatewayRequestIdentity. Ex: Authorizer["principalId"]
237237
type APIGatewayCustomAuthorizerContext struct {

0 commit comments

Comments
 (0)