Class MappingTemplate

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.MappingTemplate
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:49.549Z") @Stability(Experimental) public abstract class MappingTemplate extends software.amazon.jsii.JsiiObject
(experimental) MappingTemplates for AppSync resolvers.

Example:

 GraphqlApi api;
 MappingTemplate dummyRequest;
 MappingTemplate dummyResponse;
 ObjectType info = ObjectType.Builder.create("Info")
         .definition(Map.of(
                 "node", ResolvableField.Builder.create()
                         .returnType(GraphqlType.string())
                         .args(Map.of(
                                 "id", GraphqlType.string()))
                         .dataSource(api.addNoneDataSource("none"))
                         .requestMappingTemplate(dummyRequest)
                         .responseMappingTemplate(dummyResponse)
                         .build()))
         .build();
 
  • Constructor Details

    • MappingTemplate

      protected MappingTemplate(software.amazon.jsii.JsiiObjectRef objRef)
    • MappingTemplate

      protected MappingTemplate(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • MappingTemplate

      @Stability(Experimental) protected MappingTemplate()
  • Method Details

    • dynamoDbDeleteItem

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbDeleteItem(@NotNull String keyName, @NotNull String idArg)
      (experimental) Mapping template to delete a single item from a DynamoDB table.

      Parameters:
      keyName - the name of the hash key field. This parameter is required.
      idArg - the name of the Mutation argument. This parameter is required.
    • dynamoDbGetItem

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbGetItem(@NotNull String keyName, @NotNull String idArg)
      (experimental) Mapping template to get a single item from a DynamoDB table.

      Parameters:
      keyName - the name of the hash key field. This parameter is required.
      idArg - the name of the Query argument. This parameter is required.
    • dynamoDbPutItem

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbPutItem(@NotNull PrimaryKey key, @NotNull AttributeValues values)
      (experimental) Mapping template to save a single item to a DynamoDB table.

      Parameters:
      key - the assigment of Mutation values to the primary key. This parameter is required.
      values - the assignment of Mutation values to the table attributes. This parameter is required.
    • dynamoDbQuery

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbQuery(@NotNull KeyCondition cond, @Nullable String indexName)
      (experimental) Mapping template to query a set of items from a DynamoDB table.

      Parameters:
      cond - the key condition for the query. This parameter is required.
      indexName -
    • dynamoDbQuery

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbQuery(@NotNull KeyCondition cond)
      (experimental) Mapping template to query a set of items from a DynamoDB table.

      Parameters:
      cond - the key condition for the query. This parameter is required.
    • dynamoDbResultItem

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbResultItem()
      (experimental) Mapping template for a single result item from DynamoDB.
    • dynamoDbResultList

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbResultList()
      (experimental) Mapping template for a result list from DynamoDB.
    • dynamoDbScanTable

      @Stability(Experimental) @NotNull public static MappingTemplate dynamoDbScanTable()
      (experimental) Mapping template to scan a DynamoDB table to fetch all entries.
    • fromFile

      @Stability(Experimental) @NotNull public static MappingTemplate fromFile(@NotNull String fileName)
      (experimental) Create a mapping template from the given file.

      Parameters:
      fileName - This parameter is required.
    • fromString

      @Stability(Experimental) @NotNull public static MappingTemplate fromString(@NotNull String template)
      (experimental) Create a mapping template from the given string.

      Parameters:
      template - This parameter is required.
    • lambdaRequest

      @Stability(Experimental) @NotNull public static MappingTemplate lambdaRequest(@Nullable String payload, @Nullable String operation)
      (experimental) Mapping template to invoke a Lambda function.

      Parameters:
      payload - the VTL template snippet of the payload to send to the lambda.
      operation - the type of operation AppSync should perform on the data source.
    • lambdaRequest

      @Stability(Experimental) @NotNull public static MappingTemplate lambdaRequest(@Nullable String payload)
      (experimental) Mapping template to invoke a Lambda function.

      Parameters:
      payload - the VTL template snippet of the payload to send to the lambda.
    • lambdaRequest

      @Stability(Experimental) @NotNull public static MappingTemplate lambdaRequest()
      (experimental) Mapping template to invoke a Lambda function.
    • lambdaResult

      @Stability(Experimental) @NotNull public static MappingTemplate lambdaResult()
      (experimental) Mapping template to return the Lambda result to the caller.
    • renderTemplate

      @Stability(Experimental) @NotNull public abstract String renderTemplate()
      (experimental) this is called to render the mapping template to a VTL string.