Show / Hide Table of Contents

Interface IBaseResolverProps

Basic properties for an AppSync resolver.

Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IBaseResolverProps
Syntax (vb)
Public Interface IBaseResolverProps
Remarks

ExampleMetadata: infused

Examples
// Build a data source for AppSync to access the database.
            GraphqlApi api;
            // Create username and password secret for DB Cluster
            var secret = new DatabaseSecret(this, "AuroraSecret", new DatabaseSecretProps {
                Username = "clusteradmin"
            });

            // The VPC to place the cluster in
            var vpc = new Vpc(this, "AuroraVpc");

            // Create the serverless cluster, provide all values needed to customise the database.
            var cluster = new ServerlessCluster(this, "AuroraCluster", new ServerlessClusterProps {
                Engine = DatabaseClusterEngine.AURORA_MYSQL,
                Vpc = vpc,
                Credentials = new Dictionary<string, string> { { "username", "clusteradmin" } },
                ClusterIdentifier = "db-endpoint-test",
                DefaultDatabaseName = "demos"
            });
            var rdsDS = api.AddRdsDataSource("rds", cluster, secret, "demos");

            // Set up a resolver for an RDS query.
            rdsDS.CreateResolver("QueryGetDemosRdsResolver", new BaseResolverProps {
                TypeName = "Query",
                FieldName = "getDemosRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""version"": ""2018-05-29"",
                    ""statements"": [
                      ""SELECT * FROM demos""
                    ]
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])
                  ")
            });

            // Set up a resolver for an RDS mutation.
            rdsDS.CreateResolver("MutationAddDemoRdsResolver", new BaseResolverProps {
                TypeName = "Mutation",
                FieldName = "addDemoRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""version"": ""2018-05-29"",
                    ""statements"": [
                      ""INSERT INTO demos VALUES (:id, :version)"",
                      ""SELECT * WHERE id = :id""
                    ],
                    ""variableMap"": {
                      "":id"": $util.toJson($util.autoId()),
                      "":version"": $util.toJson($ctx.args.version)
                    }
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])
                  ")
            });

Synopsis

Properties

CachingConfig

The caching configuration for this resolver.

Code

The function code.

FieldName

name of the GraphQL field in the given type this resolver is attached to.

MaxBatchSize

The maximum number of elements per batch, when using batch invoke.

PipelineConfig

configuration of the pipeline resolver.

RequestMappingTemplate

The request mapping template for this resolver.

ResponseMappingTemplate

The response mapping template for this resolver.

Runtime

The functions runtime.

TypeName

name of the GraphQL type this resolver is attached to.

Properties

CachingConfig

The caching configuration for this resolver.

ICachingConfig? CachingConfig { get; }
Property Value

ICachingConfig

Remarks

Default: - No caching configuration

Code

The function code.

Code? Code { get; }
Property Value

Code

Remarks

Default: - no code is used

FieldName

name of the GraphQL field in the given type this resolver is attached to.

string FieldName { get; }
Property Value

string

Remarks

ExampleMetadata: infused

MaxBatchSize

The maximum number of elements per batch, when using batch invoke.

double? MaxBatchSize { get; }
Property Value

double?

Remarks

Default: - No max batch size

PipelineConfig

configuration of the pipeline resolver.

IFunctionConfigurationRef[]? PipelineConfig { get; }
Property Value

IFunctionConfigurationRef[]

Remarks

Default: - no pipeline resolver configuration An empty array | undefined sets resolver to be of kind, unit

RequestMappingTemplate

The request mapping template for this resolver.

MappingTemplate? RequestMappingTemplate { get; }
Property Value

MappingTemplate

Remarks

Default: - No mapping template

ResponseMappingTemplate

The response mapping template for this resolver.

MappingTemplate? ResponseMappingTemplate { get; }
Property Value

MappingTemplate

Remarks

Default: - No mapping template

Runtime

The functions runtime.

FunctionRuntime? Runtime { get; }
Property Value

FunctionRuntime

Remarks

Default: - no function runtime, VTL mapping templates used

TypeName

name of the GraphQL type this resolver is attached to.

string TypeName { get; }
Property Value

string

Remarks

ExampleMetadata: infused

Back to top Generated by DocFX