Show / Hide Table of Contents

Class Resolver

Provides an AppSync Resolver.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
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",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Resolver
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.AppSync
Assembly: Pulumi.Aws.dll
Syntax
public class Resolver : CustomResource

Constructors

View Source

Resolver(String, ResolverArgs, CustomResourceOptions)

Create a Resolver resource with the given unique name, arguments, and options.

Declaration
public Resolver(string name, ResolverArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ResolverArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ApiId

The API ID for the GraphQL API.

Declaration
public Output<string> ApiId { get; }
Property Value
Type Description
Output<System.String>
View Source

Arn

The ARN

Declaration
public Output<string> Arn { get; }
Property Value
Type Description
Output<System.String>
View Source

CachingConfig

The CachingConfig.

Declaration
public Output<ResolverCachingConfig> CachingConfig { get; }
Property Value
Type Description
Output<ResolverCachingConfig>
View Source

DataSource

The DataSource name.

Declaration
public Output<string> DataSource { get; }
Property Value
Type Description
Output<System.String>
View Source

Field

The field name from the schema defined in the GraphQL API.

Declaration
public Output<string> Field { get; }
Property Value
Type Description
Output<System.String>
View Source

Kind

The resolver type. Valid values are UNIT and PIPELINE.

Declaration
public Output<string> Kind { get; }
Property Value
Type Description
Output<System.String>
View Source

PipelineConfig

The PipelineConfig.

Declaration
public Output<ResolverPipelineConfig> PipelineConfig { get; }
Property Value
Type Description
Output<ResolverPipelineConfig>
View Source

RequestTemplate

The request mapping template for UNIT resolver or 'before mapping template' for PIPELINE resolver.

Declaration
public Output<string> RequestTemplate { get; }
Property Value
Type Description
Output<System.String>
View Source

ResponseTemplate

The response mapping template for UNIT resolver or 'after mapping template' for PIPELINE resolver.

Declaration
public Output<string> ResponseTemplate { get; }
Property Value
Type Description
Output<System.String>
View Source

Type

The type name from the schema defined in the GraphQL API.

Declaration
public Output<string> Type { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, ResolverState, CustomResourceOptions)

Get an existing Resolver resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Resolver Get(string name, Input<string> id, ResolverState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ResolverState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Resolver
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.