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 ContactInput { email: String name: String url: String } type Contact { email: String name: String url: String } input ExternalDocumentationInput { description: String url: String } type ExternalDocumentation { description: String url: String! } input HeaderInput { collectionFormat: collection_format_type default: AWSJSON description: String enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: format_type items: itemsInput maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int pattern: String type: items_type uniqueItems: Boolean } type Header { collectionFormat: collection_format_type default: AWSJSON description: String enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: format_type items: items maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int pattern: String type: items_type! uniqueItems: Boolean } input InfoInput { contact: contactInput description: String license: licenseInput termsOfService: String title: String version: String } type Info { contact: contact description: String license: license termsOfService: String title: String! version: String! } input ItemsInput { collectionFormat: collection_format_type default: AWSJSON enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: format_type items: itemsInput maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int pattern: String type: items_type uniqueItems: Boolean } type Items { collectionFormat: collection_format_type default: AWSJSON enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: format_type items: items maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int pattern: String type: items_type! uniqueItems: Boolean } input LicenseInput { name: String url: String } type License { name: String! url: String } input OperationInput { consumes: [String] deprecated: Boolean description: String externalDocs: external_documentationInput operationId: String parameters: [] produces: [String] responses: [] schemes: [String] security: [[[String]]] summary: String tags: [String] } type Operation { consumes: [String] deprecated: Boolean description: String externalDocs: external_documentation operationId: String parameters: [] produces: [String] responses: []! schemes: [String] security: [[[String]]] summary: String tags: [String] } input ParameterInput { allowEmptyValue: Boolean collectionFormat: collection_format_type default: AWSJSON description: String enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: String in: parameter_in_type items: itemsInput maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int name: String pattern: String required: Boolean schema: schemaInput type: String uniqueItems: Boolean } type Parameter { allowEmptyValue: Boolean collectionFormat: collection_format_type default: AWSJSON description: String enum: [AWSJSON] exclusiveMaximum: Boolean exclusiveMinimum: Boolean format: String in: parameter_in_type! items: items maxItems: Int maxLength: Int maximum: Int minItems: Int minLength: Int minimum: Int multipleOf: Int name: String! pattern: String required: Boolean! schema: schema type: String uniqueItems: Boolean } input PathItemInput { delete: operationInput get: operationInput head: operationInput options: operationInput parameters: [] patch: operationInput post: operationInput put: operationInput ref: String } type PathItem { delete: operation get: operation head: operation options: operation parameters: [] patch: operation post: operation put: operation ref: String } input ReferenceInput { ref: String } type Reference { ref: String! } input ResponseInput { description: String examples: AWSJSON headers: [headerInput] schema: schemaInput } type Response { description: String! examples: AWSJSON headers: [header] schema: schema } input SchemaInput { additionalProperties: schemaInput allOf: [schemaInput] default: AWSJSON description: String discriminator: String enum: [AWSJSON] example: AWSJSON exclusiveMaximum: Boolean exclusiveMinimum: Boolean externalDocs: external_documentationInput format: format_type items: schemaInput maxItems: Int maxLength: Int maxProperties: Int maximum: Int minItems: Int minLength: Int minProperties: Int minimum: Int multipleOf: Int pattern: String properties: [schemaInput] readOnly: Boolean ref: String required: [String] title: String type: [String] uniqueItems: Boolean xml: xmlInput } type Schema { additionalProperties: schema allOf: [schema] default: AWSJSON description: String discriminator: String enum: [AWSJSON] example: AWSJSON exclusiveMaximum: Boolean exclusiveMinimum: Boolean externalDocs: external_documentation format: format_type items: schema maxItems: Int maxLength: Int maxProperties: Int maximum: Int minItems: Int minLength: Int minProperties: Int minimum: Int multipleOf: Int pattern: String properties: [schema] readOnly: Boolean ref: String required: [String] title: String type: [String] uniqueItems: Boolean xml: xml } input SecuritySchemeInput { authorizationUrl: String description: String flow: String in: api_key_in_type name: String scopes: [String] tokenUrl: String type: security_scheme_type } type SecurityScheme { authorizationUrl: String description: String flow: String in: api_key_in_type name: String scopes: [String] tokenUrl: String type: security_scheme_type! } input SwaggerInput { basePath: String consumes: [String] definitions: [schemaInput] externalDocs: external_documentationInput host: String info: infoInput parameters: [parameterInput] paths: [path_itemInput] produces: [String] responses: [responseInput] schemes: [String] security: [String] securityDefinitions: [security_schemeInput] swagger: String tags: [tagInput] } type Swagger { basePath: String consumes: [String] definitions: [schema] externalDocs: external_documentation host: String info: info! parameters: [parameter] paths: [path_item]! produces: [String] responses: [response] schemes: [String] security: [String] securityDefinitions: [security_scheme] swagger: String! tags: [tag] } input TagInput { description: String externalDocs: external_documentationInput name: String } type Tag { description: String externalDocs: external_documentation name: String! } input XmlInput { attribute: Boolean name: String namespace: String prefix: String wrapped: Boolean } type Xml { attribute: Boolean name: String namespace: String prefix: String wrapped: Boolean } enum ApiKeyInType { HEADER QUERY } enum CollectionFormatType { CSV PIPES SSV TSV } enum FormatType { BINARY BYTE DATE DATE-TIME DOUBLE FLOAT INT32 INT64 PASSWORD } enum ItemsType { ARRAY BOOLEAN INTEGER NUMBER STRING } enum ParameterInType { BODY FORMDATA HEADER PATH QUERY } enum SecuritySchemeType { APIKEY BASIC OAUTH2 } schema { query: Query mutation: Mutation } DependsOn: - GqlApi Outputs: ApiEndpoint: Description: The endpoint for the AppSync API. Value: !GetAtt GqlApi.GraphQLUrl