Interface BaseResolverProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
ExtendedResolverProps, ResolverProps
All Known Implementing Classes:
BaseResolverProps.Jsii$Proxy, ExtendedResolverProps.Jsii$Proxy, ResolverProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:14.591Z") @Stability(Stable) public interface BaseResolverProps extends software.amazon.jsii.JsiiSerializable
Basic properties for an AppSync resolver.

Example:

 // Build a data source for AppSync to access the database.
 GraphqlApi api;
 // Create username and password secret for DB Cluster
 DatabaseSecret secret = DatabaseSecret.Builder.create(this, "AuroraSecret")
         .username("clusteradmin")
         .build();
 // The VPC to place the cluster in
 Vpc vpc = new Vpc(this, "AuroraVpc");
 // Create the serverless cluster, provide all values needed to customise the database.
 ServerlessCluster cluster = ServerlessCluster.Builder.create(this, "AuroraCluster")
         .engine(DatabaseClusterEngine.AURORA_MYSQL)
         .vpc(vpc)
         .credentials(Map.of("username", "clusteradmin"))
         .clusterIdentifier("db-endpoint-test")
         .defaultDatabaseName("demos")
         .build();
 RdsDataSource rdsDS = api.addRdsDataSource("rds", cluster, secret, "demos");
 // Set up a resolver for an RDS query.
 rdsDS.createResolver("QueryGetDemosRdsResolver", BaseResolverProps.builder()
         .typeName("Query")
         .fieldName("getDemosRds")
         .requestMappingTemplate(MappingTemplate.fromString("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"SELECT * FROM demos\"\n    ]\n  }\n  "))
         .responseMappingTemplate(MappingTemplate.fromString("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n  "))
         .build());
 // Set up a resolver for an RDS mutation.
 rdsDS.createResolver("MutationAddDemoRdsResolver", BaseResolverProps.builder()
         .typeName("Mutation")
         .fieldName("addDemoRds")
         .requestMappingTemplate(MappingTemplate.fromString("\n  {\n    \"version\": \"2018-05-29\",\n    \"statements\": [\n      \"INSERT INTO demos VALUES (:id, :version)\",\n      \"SELECT * WHERE id = :id\"\n    ],\n    \"variableMap\": {\n      \":id\": $util.toJson($util.autoId()),\n      \":version\": $util.toJson($ctx.args.version)\n    }\n  }\n  "))
         .responseMappingTemplate(MappingTemplate.fromString("\n    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n  "))
         .build());
 
  • Method Details

    • getFieldName

      @Stability(Stable) @NotNull String getFieldName()
      name of the GraphQL field in the given type this resolver is attached to.
    • getTypeName

      @Stability(Stable) @NotNull String getTypeName()
      name of the GraphQL type this resolver is attached to.
    • getCachingConfig

      @Stability(Stable) @Nullable default CachingConfig getCachingConfig()
      The caching configuration for this resolver.

      Default: - No caching configuration

    • getCode

      @Stability(Stable) @Nullable default Code getCode()
      The function code.

      Default: - no code is used

    • getMaxBatchSize

      @Stability(Stable) @Nullable default Number getMaxBatchSize()
      The maximum number of elements per batch, when using batch invoke.

      Default: - No max batch size

    • getPipelineConfig

      @Stability(Stable) @Nullable default List<IAppsyncFunction> getPipelineConfig()
      configuration of the pipeline resolver.

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

    • getRequestMappingTemplate

      @Stability(Stable) @Nullable default MappingTemplate getRequestMappingTemplate()
      The request mapping template for this resolver.

      Default: - No mapping template

    • getResponseMappingTemplate

      @Stability(Stable) @Nullable default MappingTemplate getResponseMappingTemplate()
      The response mapping template for this resolver.

      Default: - No mapping template

    • getRuntime

      @Stability(Stable) @Nullable default FunctionRuntime getRuntime()
      The functions runtime.

      Default: - no function runtime, VTL mapping templates used

    • builder

      @Stability(Stable) static BaseResolverProps.Builder builder()
      Returns:
      a BaseResolverProps.Builder of BaseResolverProps