AWSTemplateFormatVersion: 2010-09-09 Description: AppSync setup Parameters: FunctionStack: Description: The stack name that deploys the Lambda functions to invoke. Type: String Resources: DataSourceRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: appsync.amazonaws.com Policies: - PolicyName: LambdaInvoker PolicyDocument: Version: 2012-10-17 Statement: - Action: lambda:InvokeFunction Effect: Allow Resource: RoleName: !Sub '${AWS::StackName}-lambda-role' GqlApi: Type: AWS::AppSync::GraphQLApi Properties: AuthenticationType: AWS_IAM Name: !Ref AWS::StackName GqlSchema: Type: AWS::AppSync::GraphQLSchema Properties: ApiId: !GetAtt GqlApi.ApiId Definition: | type Mutation { } type Query { } input AuthInput { basic: [basic_authInput] type: auth_enum } type Auth { basic: [basic_auth] type: auth_enum! } input BasicAuthInput { key: String type: String value: String } type BasicAuth { key: String! type: String value: String! } input BodyInput { file: fileInput formdata: [form_parameterInput] mode: body_mode raw: String urlencoded: [url_encodedInput] } type Body { file: file formdata: [form_parameter] mode: body_mode raw: String urlencoded: [url_encoded] } input CollectionInput { auth: authInput event: [eventInput] info: infoInput item: [] variable: [variableInput] } type Collection { auth: auth event: [event]! info: info! item: []! variable: [variable]! } input DescriptionInput { content: String type: String } type Description { content: String type: String } input EventInput { disabled: Boolean id: String listen: event_type script: scriptInput } type Event { disabled: Boolean id: String listen: event_type! script: script } input FileInput { content: String src: String } type File { content: String src: String } input FolderInput { auth: authInput description: descriptionInput event: [eventInput] item: [itemInput] name: String variable: [variableInput] } type Folder { auth: auth description: description event: [event] item: [item]! name: String! variable: [variable] } input FormParameterInput { contentType: String description: descriptionInput disabled: Boolean key: String type: String value: String } type FormParameter { contentType: String description: description disabled: Boolean key: String! type: String value: String } input HeaderInput { description: descriptionInput disabled: Boolean key: String value: String } type Header { description: description disabled: Boolean key: String! value: String! } input InfoInput { description: descriptionInput name: String postmanId: String schema: String version: String } type Info { description: description name: String! postmanId: String schema: String! version: String } input ItemInput { description: descriptionInput event: [eventInput] id: String name: String request: requestInput response: [responseInput] variable: [variableInput] } type Item { description: description event: [event] id: String name: String request: request! response: [response] variable: [variable] } input QueryParamInput { description: descriptionInput disabled: Boolean key: String value: String } type QueryParam { description: description disabled: Boolean key: String value: String } input RequestInput { auth: authInput body: bodyInput description: descriptionInput header: [headerInput] method: method url: urlInput } type Request { auth: auth body: body description: description header: [header] method: method url: url } input ResponseInput { body: String code: Int header: [headerInput] id: String name: String originalRequest: requestInput responseTime: String status: String } type Response { body: String code: Int header: [header] id: String name: String originalRequest: request responseTime: String status: String } input ScriptInput { exec: [String] id: String name: String src: String type: String } type Script { exec: [String]! id: String name: String src: String type: String! } input UrlInput { hash: String host: [String] path: [String] port: String protocol: String query: [query_paramInput] raw: String variable: [variableInput] } type Url { hash: String host: [String] path: [String] port: String protocol: String query: [query_param] raw: String variable: [variable] } input UrlEncodedInput { description: descriptionInput disabled: Boolean key: String value: String } type UrlEncoded { description: description disabled: Boolean key: String! value: String } input VariableInput { description: descriptionInput disabled: Boolean id: String key: String name: String system: Boolean type: String value: String } type Variable { description: description disabled: Boolean id: String key: String name: String system: Boolean type: String value: String } enum AuthEnum { AWSV4 BASIC BEARER DIGEST HAWK NOAUTH NTLM OAUTH1 OAUTH2 } enum BodyMode { FILE FORMDATA RAW URLENCODED } enum EventType { PREREQUEST TEST } enum Method { COPY DELETE GET HEAD LINK LOCK OPTIONS PATCH POST PROPFIND PURGE PUT UNLINK UNLOCK VIEW } schema { query: Query mutation: Mutation } DependsOn: - GqlApi Outputs: ApiEndpoint: Description: The endpoint for the AppSync API. Value: !GetAtt GqlApi.GraphQLUrl