public MyStack() { var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "API_KEY", }); }
public MyStack() { var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs { AssumeRolePolicy = @"{ ""Version"": ""2012-10-17"", ""Statement"": [ { ""Effect"": ""Allow"", ""Principal"": { ""Service"": ""appsync.amazonaws.com"" }, ""Action"": ""sts:AssumeRole"" } ] } ", }); var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("exampleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs { PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs", Role = exampleRole.Name, }); var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new Aws.AppSync.GraphQLApiArgs { LogConfig = new Aws.AppSync.Inputs.GraphQLApiLogConfigArgs { CloudwatchLogsRoleArn = exampleRole.Arn, FieldLogLevel = "ERROR", }, }); }
public MyStack() { var testGraphQLApi = new Aws.AppSync.GraphQLApi("testGraphQLApi", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "API_KEY", Schema = @"type Mutation { putPost(id: ID!, title: String!): Post } type Post { id: ID! title: String! } type Query { singlePost(id: ID!): Post } schema { query: Query mutation: Mutation } ", }); var testDataSource = new Aws.AppSync.DataSource("testDataSource", new Aws.AppSync.DataSourceArgs { ApiId = testGraphQLApi.Id, HttpConfig = new Aws.AppSync.Inputs.DataSourceHttpConfigArgs { Endpoint = "http://example.com", }, Type = "HTTP", }); var testFunction = new Aws.AppSync.Function("testFunction", new Aws.AppSync.FunctionArgs { ApiId = testGraphQLApi.Id, DataSource = testDataSource.Name, Name = "tf_example", RequestMappingTemplate = @"{ ""version"": ""2018-05-29"", ""method"": ""GET"", ""resourcePath"": ""/"", ""params"":{ ""headers"": $utils.http.copyheaders($ctx.request.headers) } } ", ResponseMappingTemplate = @"#if($ctx.result.statusCode == 200) $ctx.result.body #else $utils.appendError($ctx.result.body, $ctx.result.statusCode) #end ", }); }
public MyStack() { var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "OPENID_CONNECT", OpenidConnectConfig = new Aws.AppSync.Inputs.GraphQLApiOpenidConnectConfigArgs { Issuer = "https://example.com", }, }); }
public MyStack() { var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "API_KEY", }); var exampleApiKey = new Aws.AppSync.ApiKey("exampleApiKey", new Aws.AppSync.ApiKeyArgs { ApiId = exampleGraphQLApi.Id, Expires = "2018-05-03T04:00:00Z", }); }
public MyStack() { var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "AMAZON_COGNITO_USER_POOLS", UserPoolConfig = new Aws.AppSync.Inputs.GraphQLApiUserPoolConfigArgs { AwsRegion = data.Aws_region.Current.Name, DefaultAction = "DENY", UserPoolId = aws_cognito_user_pool.Example.Id, }, }); }
public MyStack() { var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs { AdditionalAuthenticationProviders = { new Aws.AppSync.Inputs.GraphQLApiAdditionalAuthenticationProviderArgs { AuthenticationType = "AWS_IAM", }, }, AuthenticationType = "API_KEY", }); }
public MyStack() { var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "AWS_IAM", Schema = @"schema { query: Query } type Query { test: Int } ", }); }
public MyStack() { var testGraphQLApi = new Aws.AppSync.GraphQLApi("testGraphQLApi", new Aws.AppSync.GraphQLApiArgs { AuthenticationType = "API_KEY", Schema = @"type Mutation { putPost(id: ID!, title: String!): Post } type Post { id: ID! title: String! } type Query { singlePost(id: ID!): Post } schema { query: Query mutation: Mutation } ", }); var testDataSource = new Aws.AppSync.DataSource("testDataSource", new Aws.AppSync.DataSourceArgs { ApiId = testGraphQLApi.Id, HttpConfig = new Aws.AppSync.Inputs.DataSourceHttpConfigArgs { Endpoint = "http://example.com", }, Type = "HTTP", }); // UNIT type resolver (default) var testResolver = new Aws.AppSync.Resolver("testResolver", new Aws.AppSync.ResolverArgs { ApiId = testGraphQLApi.Id, CachingConfig = new Aws.AppSync.Inputs.ResolverCachingConfigArgs { CachingKeys = { "$context.identity.sub", "$context.arguments.id", }, Ttl = 60, }, DataSource = testDataSource.Name, Field = "singlePost", RequestTemplate = @"{ ""version"": ""2018-05-29"", ""method"": ""GET"", ""resourcePath"": ""/"", ""params"":{ ""headers"": $utils.http.copyheaders($ctx.request.headers) } } ", ResponseTemplate = @"#if($ctx.result.statusCode == 200) $ctx.result.body #else $utils.appendError($ctx.result.body, $ctx.result.statusCode) #end ", Type = "Query", }); // PIPELINE type resolver var mutationPipelineTest = new Aws.AppSync.Resolver("mutationPipelineTest", new Aws.AppSync.ResolverArgs { ApiId = testGraphQLApi.Id, Field = "pipelineTest", Kind = "PIPELINE", PipelineConfig = new Aws.AppSync.Inputs.ResolverPipelineConfigArgs { Functions = { aws_appsync_function.Test1.Function_id, aws_appsync_function.Test2.Function_id, aws_appsync_function.Test3.Function_id, }, }, RequestTemplate = "{}", ResponseTemplate = "$util.toJson($ctx.result)", Type = "Mutation", }); }