Class BaseResolverProps
Basic properties for an AppSync resolver.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BaseResolverProps : Object, IBaseResolverProps
Syntax (vb)
Public Class BaseResolverProps
Inherits Object
Implements 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
Constructors
Base |
Properties
Caching |
The caching configuration for this resolver. |
Code | The function code. |
Field |
name of the GraphQL field in the given type this resolver is attached to. |
Max |
The maximum number of elements per batch, when using batch invoke. |
Pipeline |
configuration of the pipeline resolver. |
Request |
The request mapping template for this resolver. |
Response |
The response mapping template for this resolver. |
Runtime | The functions runtime. |
Type |
name of the GraphQL type this resolver is attached to. |
Constructors
BaseResolverProps()
public BaseResolverProps()
Properties
CachingConfig
The caching configuration for this resolver.
public ICachingConfig CachingConfig { get; set; }
Property Value
Remarks
Default: - No caching configuration
Code
The function code.
public Code Code { get; set; }
Property Value
Remarks
Default: - no code is used
FieldName
name of the GraphQL field in the given type this resolver is attached to.
public string FieldName { get; set; }
Property Value
System.
MaxBatchSize
The maximum number of elements per batch, when using batch invoke.
public Nullable<double> MaxBatchSize { get; set; }
Property Value
System.
Remarks
Default: - No max batch size
PipelineConfig
configuration of the pipeline resolver.
public IAppsyncFunction[] PipelineConfig { get; set; }
Property Value
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.
public MappingTemplate RequestMappingTemplate { get; set; }
Property Value
Remarks
Default: - No mapping template
ResponseMappingTemplate
The response mapping template for this resolver.
public MappingTemplate ResponseMappingTemplate { get; set; }
Property Value
Remarks
Default: - No mapping template
Runtime
The functions runtime.
public FunctionRuntime Runtime { get; set; }
Property Value
Remarks
Default: - no function runtime, VTL mapping templates used
TypeName
name of the GraphQL type this resolver is attached to.
public string TypeName { get; set; }
Property Value
System.