Skip to content

Commit 5e1a522

Browse files
committed
Making the api gateway custom authorizer policy more generic
1 parent 08abc4f commit 5e1a522

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

events/apigw.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,8 @@ type APIGatewayCustomAuthorizerRequestTypeRequest struct {
242242

243243
// APIGatewayCustomAuthorizerResponse represents the expected format of an API Gateway authorization response.
244244
type APIGatewayCustomAuthorizerResponse struct {
245-
PrincipalID string `json:"principalId"`
246-
PolicyDocument APIGatewayCustomAuthorizerPolicy `json:"policyDocument"`
247-
Context map[string]interface{} `json:"context,omitempty"`
248-
UsageIdentifierKey string `json:"usageIdentifierKey,omitempty"`
249-
}
250-
251-
// APIGatewayCustomAuthorizerPolicy represents an IAM policy
252-
type APIGatewayCustomAuthorizerPolicy struct {
253-
Version string
254-
Statement []IAMPolicyStatement
245+
PrincipalID string `json:"principalId"`
246+
PolicyDocument CustomAuthorizerPolicy `json:"policyDocument"`
247+
Context map[string]interface{} `json:"context,omitempty"`
248+
UsageIdentifierKey string `json:"usageIdentifierKey,omitempty"`
255249
}

events/iot.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,3 @@ type IoTCustomAuthorizerResponse struct {
3232
RefreshAfterInSeconds int32 `json:"refreshAfterInSeconds"`
3333
PolicyDocuments []string `json:"policyDocuments"`
3434
}
35-
36-
// IoTCustomAuthorizerPolicy represents an IAM policy. PolicyDocuments is an array of IoTCustomAuthorizerPolicy JSON strings
37-
type IoTCustomAuthorizerPolicy struct {
38-
Version string
39-
Statement []IAMPolicyStatement
40-
}

events/policy.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package events
2+
3+
// CustomAuthorizerPolicy represents an IAM policy
4+
type CustomAuthorizerPolicy struct {
5+
Version string
6+
Statement []IAMPolicyStatement
7+
}

0 commit comments

Comments
 (0)