/
appsync.go
67 lines (58 loc) · 3 KB
/
appsync.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package events
import "encoding/json"
// Deprecated: AppSyncResolverTemplate does not represent resolver events sent by AppSync. Instead directly model your input schema, or use map[string]string, json.RawMessage, interface{}, etc..
type AppSyncResolverTemplate struct {
Version string `json:"version"`
Operation AppSyncOperation `json:"operation"`
Payload json.RawMessage `json:"payload"`
}
// AppSyncIAMIdentity contains information about the caller authed via IAM.
type AppSyncIAMIdentity struct {
AccountID string `json:"accountId"`
CognitoIdentityAuthProvider string `json:"cognitoIdentityAuthProvider"`
CognitoIdentityAuthType string `json:"cognitoIdentityAuthType"`
CognitoIdentityPoolID string `json:"cognitoIdentityPoolId"`
CognitoIdentityID string `json:"cognitoIdentityId"`
SourceIP []string `json:"sourceIp"`
Username string `json:"username"`
UserARN string `json:"userArn"`
}
// AppSyncCognitoIdentity contains information about the caller authed via Cognito.
type AppSyncCognitoIdentity struct {
Sub string `json:"sub"`
Issuer string `json:"issuer"`
Username string `json:"username"`
Claims map[string]interface{} `json:"claims"`
SourceIP []string `json:"sourceIp"`
DefaultAuthStrategy string `json:"defaultAuthStrategy"`
}
// Deprecated: not used by any event schema
type AppSyncOperation string
const (
// Deprecated: not used by any event schema
OperationInvoke AppSyncOperation = "Invoke"
// Deprecated: not used by any event schema
OperationBatchInvoke AppSyncOperation = "BatchInvoke"
)
// AppSyncLambdaAuthorizerRequest contains an authorization request from AppSync.
type AppSyncLambdaAuthorizerRequest struct {
AuthorizationToken string `json:"authorizationToken"`
RequestContext AppSyncLambdaAuthorizerRequestContext `json:"requestContext"`
}
// AppSyncLambdaAuthorizerRequestContext contains the parameters of the AppSync invocation which triggered
// this authorization request.
type AppSyncLambdaAuthorizerRequestContext struct {
APIID string `json:"apiId"`
AccountID string `json:"accountId"`
RequestID string `json:"requestId"`
QueryString string `json:"queryString"`
OperationName string `json:"operationName"`
Variables map[string]interface{} `json:"variables"`
}
// AppSyncLambdaAuthorizerResponse represents the expected format of an authorization response to AppSync.
type AppSyncLambdaAuthorizerResponse struct {
IsAuthorized bool `json:"isAuthorized"`
ResolverContext map[string]interface{} `json:"resolverContext,omitempty"`
DeniedFields []string `json:"deniedFields,omitempty"`
TTLOverride *int `json:"ttlOverride,omitempty"`
}