AWS AppSync

2022/11/17 - AWS AppSync - 1 new10 updated api methods

Changes  This release introduces the APPSYNC_JS runtime, and adds support for JavaScript in AppSync functions and AppSync pipeline resolvers.

EvaluateCode (new) Link ¶

Evaluates the given code and returns the response. The code definition requirements depend on the specified runtime. For APPSYNC_JS runtimes, the code defines the request and response functions. The request function takes the incoming request after a GraphQL operation is parsed and converts it into a request configuration for the selected data source operation. The response function interprets responses from the data source and maps it to the shape of the GraphQL field output type.

See also: AWS API Documentation

Request Syntax

client.evaluate_code(
    runtime={
        'name': 'APPSYNC_JS',
        'runtimeVersion': 'string'
    },
    code='string',
    context='string',
    function='string'
)
type runtime:

dict

param runtime:

[REQUIRED]

The runtime to be used when evaluating the code. Currently, only the APPSYNC_JS runtime is supported.

  • name (string) -- [REQUIRED]

    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

  • runtimeVersion (string) -- [REQUIRED]

    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

type code:

string

param code:

[REQUIRED]

The code definition to be evaluated. Note that code and runtime are both required for this action. The runtime value must be APPSYNC_JS.

type context:

string

param context:

[REQUIRED]

The map that holds all of the contextual information for your resolver invocation. A context is required for this action.

type function:

string

param function:

The function within the code to be evaluated. If provided, the valid values are request and response.

rtype:

dict

returns:

Response Syntax

{
    'evaluationResult': 'string',
    'error': {
        'message': 'string',
        'codeErrors': [
            {
                'errorType': 'string',
                'value': 'string',
                'location': {
                    'line': 123,
                    'column': 123,
                    'span': 123
                }
            },
        ]
    },
    'logs': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • evaluationResult (string) --

      The result of the evaluation operation.

    • error (dict) --

      Contains the payload of the response error.

      • message (string) --

        The error payload.

      • codeErrors (list) --

        Contains the list of CodeError objects.

        • (dict) --

          Describes an AppSync error.

          • errorType (string) --

            The type of code error.

            Examples include, but aren't limited to: LINT_ERROR, PARSER_ERROR.

          • value (string) --

            A user presentable error.

            Examples include, but aren't limited to: Parsing error: Unterminated string literal.

          • location (dict) --

            The line, column, and span location of the error in the code.

            • line (integer) --

              The line number in the code. Defaults to 0 if unknown.

            • column (integer) --

              The column number in the code. Defaults to 0 if unknown.

            • span (integer) --

              The span/length of the error. Defaults to -1 if unknown.

    • logs (list) --

      A list of logs that were generated by calls to util.log.info and util.log.error in the evaluated code.

      • (string) --

CreateFunction (updated) Link ¶
Changes (request, response)
Request
{'code': 'string',
 'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}
Response
{'functionConfiguration': {'code': 'string',
                           'runtime': {'name': 'APPSYNC_JS',
                                       'runtimeVersion': 'string'}}}

Creates a Function object.

A function is a reusable entity. You can use multiple functions to compose the resolver logic.

See also: AWS API Documentation

Request Syntax

client.create_function(
    apiId='string',
    name='string',
    description='string',
    dataSourceName='string',
    requestMappingTemplate='string',
    responseMappingTemplate='string',
    functionVersion='string',
    syncConfig={
        'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
        'conflictDetection': 'VERSION'|'NONE',
        'lambdaConflictHandlerConfig': {
            'lambdaConflictHandlerArn': 'string'
        }
    },
    maxBatchSize=123,
    runtime={
        'name': 'APPSYNC_JS',
        'runtimeVersion': 'string'
    },
    code='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The GraphQL API ID.

type name:

string

param name:

[REQUIRED]

The Function name. The function name does not have to be unique.

type description:

string

param description:

The Function description.

type dataSourceName:

string

param dataSourceName:

[REQUIRED]

The Function DataSource name.

type requestMappingTemplate:

string

param requestMappingTemplate:

The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

type responseMappingTemplate:

string

param responseMappingTemplate:

The Function response mapping template.

type functionVersion:

string

param functionVersion:

The version of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the functionVersion is required.

type syncConfig:

dict

param syncConfig:

Describes a Sync configuration for a resolver.

Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

  • conflictHandler (string) --

    The Conflict Resolution strategy to perform in the event of a conflict.

    • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

    • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

    • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

  • conflictDetection (string) --

    The Conflict Detection strategy to use.

    • VERSION: Detect conflicts based on object versions for this resolver.

    • NONE: Do not detect conflicts when invoking this resolver.

  • lambdaConflictHandlerConfig (dict) --

    The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

    • lambdaConflictHandlerArn (string) --

      The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

type maxBatchSize:

integer

param maxBatchSize:

The maximum batching size for a resolver.

type runtime:

dict

param runtime:

Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

  • name (string) -- [REQUIRED]

    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

  • runtimeVersion (string) -- [REQUIRED]

    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

type code:

string

param code:

The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

rtype:

dict

returns:

Response Syntax

{
    'functionConfiguration': {
        'functionId': 'string',
        'functionArn': 'string',
        'name': 'string',
        'description': 'string',
        'dataSourceName': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'functionVersion': 'string',
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • functionConfiguration (dict) --

      The Function object.

      • functionId (string) --

        A unique ID representing the Function object.

      • functionArn (string) --

        The Amazon Resource Name (ARN) of the Function object.

      • name (string) --

        The name of the Function object.

      • description (string) --

        The Function description.

      • dataSourceName (string) --

        The name of the DataSource.

      • requestMappingTemplate (string) --

        The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

      • responseMappingTemplate (string) --

        The Function response mapping template.

      • functionVersion (string) --

        The version of the request mapping template. Currently, only the 2018-05-29 version of the template is supported.

      • syncConfig (dict) --

        Describes a Sync configuration for a resolver.

        Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

CreateResolver (updated) Link ¶
Changes (request, response)
Request
{'code': 'string',
 'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}
Response
{'resolver': {'code': 'string',
              'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

Creates a Resolver object.

A resolver converts incoming requests into a format that a data source can understand, and converts the data source's responses into GraphQL.

See also: AWS API Documentation

Request Syntax

client.create_resolver(
    apiId='string',
    typeName='string',
    fieldName='string',
    dataSourceName='string',
    requestMappingTemplate='string',
    responseMappingTemplate='string',
    kind='UNIT'|'PIPELINE',
    pipelineConfig={
        'functions': [
            'string',
        ]
    },
    syncConfig={
        'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
        'conflictDetection': 'VERSION'|'NONE',
        'lambdaConflictHandlerConfig': {
            'lambdaConflictHandlerArn': 'string'
        }
    },
    cachingConfig={
        'ttl': 123,
        'cachingKeys': [
            'string',
        ]
    },
    maxBatchSize=123,
    runtime={
        'name': 'APPSYNC_JS',
        'runtimeVersion': 'string'
    },
    code='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The ID for the GraphQL API for which the resolver is being created.

type typeName:

string

param typeName:

[REQUIRED]

The name of the Type.

type fieldName:

string

param fieldName:

[REQUIRED]

The name of the field to attach the resolver to.

type dataSourceName:

string

param dataSourceName:

The name of the data source for which the resolver is being created.

type requestMappingTemplate:

string

param requestMappingTemplate:

The mapping template to use for requests.

A resolver uses a request mapping template to convert a GraphQL expression into a format that a data source can understand. Mapping templates are written in Apache Velocity Template Language (VTL).

VTL request mapping templates are optional when using an Lambda data source. For all other data sources, VTL request and response mapping templates are required.

type responseMappingTemplate:

string

param responseMappingTemplate:

The mapping template to use for responses from the data source.

type kind:

string

param kind:

The resolver type.

  • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

  • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

type pipelineConfig:

dict

param pipelineConfig:

The PipelineConfig.

  • functions (list) --

    A list of Function objects.

    • (string) --

type syncConfig:

dict

param syncConfig:

The SyncConfig for a resolver attached to a versioned data source.

  • conflictHandler (string) --

    The Conflict Resolution strategy to perform in the event of a conflict.

    • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

    • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

    • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

  • conflictDetection (string) --

    The Conflict Detection strategy to use.

    • VERSION: Detect conflicts based on object versions for this resolver.

    • NONE: Do not detect conflicts when invoking this resolver.

  • lambdaConflictHandlerConfig (dict) --

    The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

    • lambdaConflictHandlerArn (string) --

      The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

type cachingConfig:

dict

param cachingConfig:

The caching configuration for the resolver.

  • ttl (integer) -- [REQUIRED]

    The TTL in seconds for a resolver that has caching activated.

    Valid values are 1–3,600 seconds.

  • cachingKeys (list) --

    The caching keys for a resolver that has caching activated.

    Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

    • (string) --

type maxBatchSize:

integer

param maxBatchSize:

The maximum batching size for a resolver.

type runtime:

dict

param runtime:

Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

  • name (string) -- [REQUIRED]

    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

  • runtimeVersion (string) -- [REQUIRED]

    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

type code:

string

param code:

The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

rtype:

dict

returns:

Response Syntax

{
    'resolver': {
        'typeName': 'string',
        'fieldName': 'string',
        'dataSourceName': 'string',
        'resolverArn': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'kind': 'UNIT'|'PIPELINE',
        'pipelineConfig': {
            'functions': [
                'string',
            ]
        },
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'cachingConfig': {
            'ttl': 123,
            'cachingKeys': [
                'string',
            ]
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • resolver (dict) --

      The Resolver object.

      • typeName (string) --

        The resolver type name.

      • fieldName (string) --

        The resolver field name.

      • dataSourceName (string) --

        The resolver data source name.

      • resolverArn (string) --

        The resolver Amazon Resource Name (ARN).

      • requestMappingTemplate (string) --

        The request mapping template.

      • responseMappingTemplate (string) --

        The response mapping template.

      • kind (string) --

        The resolver type.

        • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

        • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

      • pipelineConfig (dict) --

        The PipelineConfig.

        • functions (list) --

          A list of Function objects.

          • (string) --

      • syncConfig (dict) --

        The SyncConfig for a resolver attached to a versioned data source.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • cachingConfig (dict) --

        The caching configuration for the resolver.

        • ttl (integer) --

          The TTL in seconds for a resolver that has caching activated.

          Valid values are 1–3,600 seconds.

        • cachingKeys (list) --

          The caching keys for a resolver that has caching activated.

          Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

          • (string) --

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

EvaluateMappingTemplate (updated) Link ¶
Changes (response)
{'logs': ['string']}

Evaluates a given template and returns the response. The mapping template can be a request or response template.

Request templates take the incoming request after a GraphQL operation is parsed and convert it into a request configuration for the selected data source operation. Response templates interpret responses from the data source and map it to the shape of the GraphQL field output type.

Mapping templates are written in the Apache Velocity Template Language (VTL).

See also: AWS API Documentation

Request Syntax

client.evaluate_mapping_template(
    template='string',
    context='string'
)
type template:

string

param template:

[REQUIRED]

The mapping template; this can be a request or response template. A template is required for this action.

type context:

string

param context:

[REQUIRED]

The map that holds all of the contextual information for your resolver invocation. A context is required for this action.

rtype:

dict

returns:

Response Syntax

{
    'evaluationResult': 'string',
    'error': {
        'message': 'string'
    },
    'logs': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • evaluationResult (string) --

      The mapping template; this can be a request or response template.

    • error (dict) --

      The ErrorDetail object.

      • message (string) --

        The error payload.

    • logs (list) --

      A list of logs that were generated by calls to util.log.info and util.log.error in the evaluated code.

      • (string) --

GetFunction (updated) Link ¶
Changes (response)
{'functionConfiguration': {'code': 'string',
                           'runtime': {'name': 'APPSYNC_JS',
                                       'runtimeVersion': 'string'}}}

Get a Function.

See also: AWS API Documentation

Request Syntax

client.get_function(
    apiId='string',
    functionId='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The GraphQL API ID.

type functionId:

string

param functionId:

[REQUIRED]

The Function ID.

rtype:

dict

returns:

Response Syntax

{
    'functionConfiguration': {
        'functionId': 'string',
        'functionArn': 'string',
        'name': 'string',
        'description': 'string',
        'dataSourceName': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'functionVersion': 'string',
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • functionConfiguration (dict) --

      The Function object.

      • functionId (string) --

        A unique ID representing the Function object.

      • functionArn (string) --

        The Amazon Resource Name (ARN) of the Function object.

      • name (string) --

        The name of the Function object.

      • description (string) --

        The Function description.

      • dataSourceName (string) --

        The name of the DataSource.

      • requestMappingTemplate (string) --

        The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

      • responseMappingTemplate (string) --

        The Function response mapping template.

      • functionVersion (string) --

        The version of the request mapping template. Currently, only the 2018-05-29 version of the template is supported.

      • syncConfig (dict) --

        Describes a Sync configuration for a resolver.

        Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

GetResolver (updated) Link ¶
Changes (response)
{'resolver': {'code': 'string',
              'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

Retrieves a Resolver object.

See also: AWS API Documentation

Request Syntax

client.get_resolver(
    apiId='string',
    typeName='string',
    fieldName='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The API ID.

type typeName:

string

param typeName:

[REQUIRED]

The resolver type name.

type fieldName:

string

param fieldName:

[REQUIRED]

The resolver field name.

rtype:

dict

returns:

Response Syntax

{
    'resolver': {
        'typeName': 'string',
        'fieldName': 'string',
        'dataSourceName': 'string',
        'resolverArn': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'kind': 'UNIT'|'PIPELINE',
        'pipelineConfig': {
            'functions': [
                'string',
            ]
        },
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'cachingConfig': {
            'ttl': 123,
            'cachingKeys': [
                'string',
            ]
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • resolver (dict) --

      The Resolver object.

      • typeName (string) --

        The resolver type name.

      • fieldName (string) --

        The resolver field name.

      • dataSourceName (string) --

        The resolver data source name.

      • resolverArn (string) --

        The resolver Amazon Resource Name (ARN).

      • requestMappingTemplate (string) --

        The request mapping template.

      • responseMappingTemplate (string) --

        The response mapping template.

      • kind (string) --

        The resolver type.

        • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

        • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

      • pipelineConfig (dict) --

        The PipelineConfig.

        • functions (list) --

          A list of Function objects.

          • (string) --

      • syncConfig (dict) --

        The SyncConfig for a resolver attached to a versioned data source.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • cachingConfig (dict) --

        The caching configuration for the resolver.

        • ttl (integer) --

          The TTL in seconds for a resolver that has caching activated.

          Valid values are 1–3,600 seconds.

        • cachingKeys (list) --

          The caching keys for a resolver that has caching activated.

          Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

          • (string) --

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

ListFunctions (updated) Link ¶
Changes (response)
{'functions': {'code': 'string',
               'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

List multiple functions.

See also: AWS API Documentation

Request Syntax

client.list_functions(
    apiId='string',
    nextToken='string',
    maxResults=123
)
type apiId:

string

param apiId:

[REQUIRED]

The GraphQL API ID.

type nextToken:

string

param nextToken:

An identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list.

type maxResults:

integer

param maxResults:

The maximum number of results that you want the request to return.

rtype:

dict

returns:

Response Syntax

{
    'functions': [
        {
            'functionId': 'string',
            'functionArn': 'string',
            'name': 'string',
            'description': 'string',
            'dataSourceName': 'string',
            'requestMappingTemplate': 'string',
            'responseMappingTemplate': 'string',
            'functionVersion': 'string',
            'syncConfig': {
                'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
                'conflictDetection': 'VERSION'|'NONE',
                'lambdaConflictHandlerConfig': {
                    'lambdaConflictHandlerArn': 'string'
                }
            },
            'maxBatchSize': 123,
            'runtime': {
                'name': 'APPSYNC_JS',
                'runtimeVersion': 'string'
            },
            'code': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • functions (list) --

      A list of Function objects.

      • (dict) --

        A function is a reusable entity. You can use multiple functions to compose the resolver logic.

        • functionId (string) --

          A unique ID representing the Function object.

        • functionArn (string) --

          The Amazon Resource Name (ARN) of the Function object.

        • name (string) --

          The name of the Function object.

        • description (string) --

          The Function description.

        • dataSourceName (string) --

          The name of the DataSource.

        • requestMappingTemplate (string) --

          The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

        • responseMappingTemplate (string) --

          The Function response mapping template.

        • functionVersion (string) --

          The version of the request mapping template. Currently, only the 2018-05-29 version of the template is supported.

        • syncConfig (dict) --

          Describes a Sync configuration for a resolver.

          Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

          • conflictHandler (string) --

            The Conflict Resolution strategy to perform in the event of a conflict.

            • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

            • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

            • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

          • conflictDetection (string) --

            The Conflict Detection strategy to use.

            • VERSION: Detect conflicts based on object versions for this resolver.

            • NONE: Do not detect conflicts when invoking this resolver.

          • lambdaConflictHandlerConfig (dict) --

            The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

            • lambdaConflictHandlerArn (string) --

              The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

        • maxBatchSize (integer) --

          The maximum batching size for a resolver.

        • runtime (dict) --

          Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

          • name (string) --

            The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

          • runtimeVersion (string) --

            The version of the runtime to use. Currently, the only allowed version is 1.0.0.

        • code (string) --

          The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

    • nextToken (string) --

      An identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list.

ListResolvers (updated) Link ¶
Changes (response)
{'resolvers': {'code': 'string',
               'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

Lists the resolvers for a given API and type.

See also: AWS API Documentation

Request Syntax

client.list_resolvers(
    apiId='string',
    typeName='string',
    nextToken='string',
    maxResults=123
)
type apiId:

string

param apiId:

[REQUIRED]

The API ID.

type typeName:

string

param typeName:

[REQUIRED]

The type name.

type nextToken:

string

param nextToken:

An identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list.

type maxResults:

integer

param maxResults:

The maximum number of results that you want the request to return.

rtype:

dict

returns:

Response Syntax

{
    'resolvers': [
        {
            'typeName': 'string',
            'fieldName': 'string',
            'dataSourceName': 'string',
            'resolverArn': 'string',
            'requestMappingTemplate': 'string',
            'responseMappingTemplate': 'string',
            'kind': 'UNIT'|'PIPELINE',
            'pipelineConfig': {
                'functions': [
                    'string',
                ]
            },
            'syncConfig': {
                'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
                'conflictDetection': 'VERSION'|'NONE',
                'lambdaConflictHandlerConfig': {
                    'lambdaConflictHandlerArn': 'string'
                }
            },
            'cachingConfig': {
                'ttl': 123,
                'cachingKeys': [
                    'string',
                ]
            },
            'maxBatchSize': 123,
            'runtime': {
                'name': 'APPSYNC_JS',
                'runtimeVersion': 'string'
            },
            'code': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • resolvers (list) --

      The Resolver objects.

      • (dict) --

        Describes a resolver.

        • typeName (string) --

          The resolver type name.

        • fieldName (string) --

          The resolver field name.

        • dataSourceName (string) --

          The resolver data source name.

        • resolverArn (string) --

          The resolver Amazon Resource Name (ARN).

        • requestMappingTemplate (string) --

          The request mapping template.

        • responseMappingTemplate (string) --

          The response mapping template.

        • kind (string) --

          The resolver type.

          • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

          • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

        • pipelineConfig (dict) --

          The PipelineConfig.

          • functions (list) --

            A list of Function objects.

            • (string) --

        • syncConfig (dict) --

          The SyncConfig for a resolver attached to a versioned data source.

          • conflictHandler (string) --

            The Conflict Resolution strategy to perform in the event of a conflict.

            • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

            • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

            • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

          • conflictDetection (string) --

            The Conflict Detection strategy to use.

            • VERSION: Detect conflicts based on object versions for this resolver.

            • NONE: Do not detect conflicts when invoking this resolver.

          • lambdaConflictHandlerConfig (dict) --

            The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

            • lambdaConflictHandlerArn (string) --

              The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

        • cachingConfig (dict) --

          The caching configuration for the resolver.

          • ttl (integer) --

            The TTL in seconds for a resolver that has caching activated.

            Valid values are 1–3,600 seconds.

          • cachingKeys (list) --

            The caching keys for a resolver that has caching activated.

            Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

            • (string) --

        • maxBatchSize (integer) --

          The maximum batching size for a resolver.

        • runtime (dict) --

          Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

          • name (string) --

            The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

          • runtimeVersion (string) --

            The version of the runtime to use. Currently, the only allowed version is 1.0.0.

        • code (string) --

          The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

    • nextToken (string) --

      An identifier to pass in the next request to this operation to return the next set of items in the list.

ListResolversByFunction (updated) Link ¶
Changes (response)
{'resolvers': {'code': 'string',
               'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

List the resolvers that are associated with a specific function.

See also: AWS API Documentation

Request Syntax

client.list_resolvers_by_function(
    apiId='string',
    functionId='string',
    nextToken='string',
    maxResults=123
)
type apiId:

string

param apiId:

[REQUIRED]

The API ID.

type functionId:

string

param functionId:

[REQUIRED]

The function ID.

type nextToken:

string

param nextToken:

An identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list.

type maxResults:

integer

param maxResults:

The maximum number of results that you want the request to return.

rtype:

dict

returns:

Response Syntax

{
    'resolvers': [
        {
            'typeName': 'string',
            'fieldName': 'string',
            'dataSourceName': 'string',
            'resolverArn': 'string',
            'requestMappingTemplate': 'string',
            'responseMappingTemplate': 'string',
            'kind': 'UNIT'|'PIPELINE',
            'pipelineConfig': {
                'functions': [
                    'string',
                ]
            },
            'syncConfig': {
                'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
                'conflictDetection': 'VERSION'|'NONE',
                'lambdaConflictHandlerConfig': {
                    'lambdaConflictHandlerArn': 'string'
                }
            },
            'cachingConfig': {
                'ttl': 123,
                'cachingKeys': [
                    'string',
                ]
            },
            'maxBatchSize': 123,
            'runtime': {
                'name': 'APPSYNC_JS',
                'runtimeVersion': 'string'
            },
            'code': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • resolvers (list) --

      The list of resolvers.

      • (dict) --

        Describes a resolver.

        • typeName (string) --

          The resolver type name.

        • fieldName (string) --

          The resolver field name.

        • dataSourceName (string) --

          The resolver data source name.

        • resolverArn (string) --

          The resolver Amazon Resource Name (ARN).

        • requestMappingTemplate (string) --

          The request mapping template.

        • responseMappingTemplate (string) --

          The response mapping template.

        • kind (string) --

          The resolver type.

          • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

          • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

        • pipelineConfig (dict) --

          The PipelineConfig.

          • functions (list) --

            A list of Function objects.

            • (string) --

        • syncConfig (dict) --

          The SyncConfig for a resolver attached to a versioned data source.

          • conflictHandler (string) --

            The Conflict Resolution strategy to perform in the event of a conflict.

            • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

            • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

            • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

          • conflictDetection (string) --

            The Conflict Detection strategy to use.

            • VERSION: Detect conflicts based on object versions for this resolver.

            • NONE: Do not detect conflicts when invoking this resolver.

          • lambdaConflictHandlerConfig (dict) --

            The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

            • lambdaConflictHandlerArn (string) --

              The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

        • cachingConfig (dict) --

          The caching configuration for the resolver.

          • ttl (integer) --

            The TTL in seconds for a resolver that has caching activated.

            Valid values are 1–3,600 seconds.

          • cachingKeys (list) --

            The caching keys for a resolver that has caching activated.

            Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

            • (string) --

        • maxBatchSize (integer) --

          The maximum batching size for a resolver.

        • runtime (dict) --

          Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

          • name (string) --

            The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

          • runtimeVersion (string) --

            The version of the runtime to use. Currently, the only allowed version is 1.0.0.

        • code (string) --

          The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

    • nextToken (string) --

      An identifier that you can use to return the next set of items in the list.

UpdateFunction (updated) Link ¶
Changes (request, response)
Request
{'code': 'string',
 'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}
Response
{'functionConfiguration': {'code': 'string',
                           'runtime': {'name': 'APPSYNC_JS',
                                       'runtimeVersion': 'string'}}}

Updates a Function object.

See also: AWS API Documentation

Request Syntax

client.update_function(
    apiId='string',
    name='string',
    description='string',
    functionId='string',
    dataSourceName='string',
    requestMappingTemplate='string',
    responseMappingTemplate='string',
    functionVersion='string',
    syncConfig={
        'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
        'conflictDetection': 'VERSION'|'NONE',
        'lambdaConflictHandlerConfig': {
            'lambdaConflictHandlerArn': 'string'
        }
    },
    maxBatchSize=123,
    runtime={
        'name': 'APPSYNC_JS',
        'runtimeVersion': 'string'
    },
    code='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The GraphQL API ID.

type name:

string

param name:

[REQUIRED]

The Function name.

type description:

string

param description:

The Function description.

type functionId:

string

param functionId:

[REQUIRED]

The function ID.

type dataSourceName:

string

param dataSourceName:

[REQUIRED]

The Function DataSource name.

type requestMappingTemplate:

string

param requestMappingTemplate:

The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

type responseMappingTemplate:

string

param responseMappingTemplate:

The Function request mapping template.

type functionVersion:

string

param functionVersion:

The version of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the functionVersion is required.

type syncConfig:

dict

param syncConfig:

Describes a Sync configuration for a resolver.

Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

  • conflictHandler (string) --

    The Conflict Resolution strategy to perform in the event of a conflict.

    • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

    • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

    • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

  • conflictDetection (string) --

    The Conflict Detection strategy to use.

    • VERSION: Detect conflicts based on object versions for this resolver.

    • NONE: Do not detect conflicts when invoking this resolver.

  • lambdaConflictHandlerConfig (dict) --

    The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

    • lambdaConflictHandlerArn (string) --

      The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

type maxBatchSize:

integer

param maxBatchSize:

The maximum batching size for a resolver.

type runtime:

dict

param runtime:

Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

  • name (string) -- [REQUIRED]

    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

  • runtimeVersion (string) -- [REQUIRED]

    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

type code:

string

param code:

The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

rtype:

dict

returns:

Response Syntax

{
    'functionConfiguration': {
        'functionId': 'string',
        'functionArn': 'string',
        'name': 'string',
        'description': 'string',
        'dataSourceName': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'functionVersion': 'string',
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • functionConfiguration (dict) --

      The Function object.

      • functionId (string) --

        A unique ID representing the Function object.

      • functionArn (string) --

        The Amazon Resource Name (ARN) of the Function object.

      • name (string) --

        The name of the Function object.

      • description (string) --

        The Function description.

      • dataSourceName (string) --

        The name of the DataSource.

      • requestMappingTemplate (string) --

        The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

      • responseMappingTemplate (string) --

        The Function response mapping template.

      • functionVersion (string) --

        The version of the request mapping template. Currently, only the 2018-05-29 version of the template is supported.

      • syncConfig (dict) --

        Describes a Sync configuration for a resolver.

        Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

UpdateResolver (updated) Link ¶
Changes (request, response)
Request
{'code': 'string',
 'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}
Response
{'resolver': {'code': 'string',
              'runtime': {'name': 'APPSYNC_JS', 'runtimeVersion': 'string'}}}

Updates a Resolver object.

See also: AWS API Documentation

Request Syntax

client.update_resolver(
    apiId='string',
    typeName='string',
    fieldName='string',
    dataSourceName='string',
    requestMappingTemplate='string',
    responseMappingTemplate='string',
    kind='UNIT'|'PIPELINE',
    pipelineConfig={
        'functions': [
            'string',
        ]
    },
    syncConfig={
        'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
        'conflictDetection': 'VERSION'|'NONE',
        'lambdaConflictHandlerConfig': {
            'lambdaConflictHandlerArn': 'string'
        }
    },
    cachingConfig={
        'ttl': 123,
        'cachingKeys': [
            'string',
        ]
    },
    maxBatchSize=123,
    runtime={
        'name': 'APPSYNC_JS',
        'runtimeVersion': 'string'
    },
    code='string'
)
type apiId:

string

param apiId:

[REQUIRED]

The API ID.

type typeName:

string

param typeName:

[REQUIRED]

The new type name.

type fieldName:

string

param fieldName:

[REQUIRED]

The new field name.

type dataSourceName:

string

param dataSourceName:

The new data source name.

type requestMappingTemplate:

string

param requestMappingTemplate:

The new request mapping template.

A resolver uses a request mapping template to convert a GraphQL expression into a format that a data source can understand. Mapping templates are written in Apache Velocity Template Language (VTL).

VTL request mapping templates are optional when using an Lambda data source. For all other data sources, VTL request and response mapping templates are required.

type responseMappingTemplate:

string

param responseMappingTemplate:

The new response mapping template.

type kind:

string

param kind:

The resolver type.

  • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

  • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

type pipelineConfig:

dict

param pipelineConfig:

The PipelineConfig.

  • functions (list) --

    A list of Function objects.

    • (string) --

type syncConfig:

dict

param syncConfig:

The SyncConfig for a resolver attached to a versioned data source.

  • conflictHandler (string) --

    The Conflict Resolution strategy to perform in the event of a conflict.

    • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

    • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

    • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

  • conflictDetection (string) --

    The Conflict Detection strategy to use.

    • VERSION: Detect conflicts based on object versions for this resolver.

    • NONE: Do not detect conflicts when invoking this resolver.

  • lambdaConflictHandlerConfig (dict) --

    The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

    • lambdaConflictHandlerArn (string) --

      The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

type cachingConfig:

dict

param cachingConfig:

The caching configuration for the resolver.

  • ttl (integer) -- [REQUIRED]

    The TTL in seconds for a resolver that has caching activated.

    Valid values are 1–3,600 seconds.

  • cachingKeys (list) --

    The caching keys for a resolver that has caching activated.

    Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

    • (string) --

type maxBatchSize:

integer

param maxBatchSize:

The maximum batching size for a resolver.

type runtime:

dict

param runtime:

Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

  • name (string) -- [REQUIRED]

    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

  • runtimeVersion (string) -- [REQUIRED]

    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

type code:

string

param code:

The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.

rtype:

dict

returns:

Response Syntax

{
    'resolver': {
        'typeName': 'string',
        'fieldName': 'string',
        'dataSourceName': 'string',
        'resolverArn': 'string',
        'requestMappingTemplate': 'string',
        'responseMappingTemplate': 'string',
        'kind': 'UNIT'|'PIPELINE',
        'pipelineConfig': {
            'functions': [
                'string',
            ]
        },
        'syncConfig': {
            'conflictHandler': 'OPTIMISTIC_CONCURRENCY'|'LAMBDA'|'AUTOMERGE'|'NONE',
            'conflictDetection': 'VERSION'|'NONE',
            'lambdaConflictHandlerConfig': {
                'lambdaConflictHandlerArn': 'string'
            }
        },
        'cachingConfig': {
            'ttl': 123,
            'cachingKeys': [
                'string',
            ]
        },
        'maxBatchSize': 123,
        'runtime': {
            'name': 'APPSYNC_JS',
            'runtimeVersion': 'string'
        },
        'code': 'string'
    }
}

Response Structure

  • (dict) --

    • resolver (dict) --

      The updated Resolver object.

      • typeName (string) --

        The resolver type name.

      • fieldName (string) --

        The resolver field name.

      • dataSourceName (string) --

        The resolver data source name.

      • resolverArn (string) --

        The resolver Amazon Resource Name (ARN).

      • requestMappingTemplate (string) --

        The request mapping template.

      • responseMappingTemplate (string) --

        The response mapping template.

      • kind (string) --

        The resolver type.

        • UNIT: A UNIT resolver type. A UNIT resolver is the default resolver type. You can use a UNIT resolver to run a GraphQL query against a single data source.

        • PIPELINE: A PIPELINE resolver type. You can use a PIPELINE resolver to invoke a series of Function objects in a serial manner. You can use a pipeline resolver to run a GraphQL query against multiple data sources.

      • pipelineConfig (dict) --

        The PipelineConfig.

        • functions (list) --

          A list of Function objects.

          • (string) --

      • syncConfig (dict) --

        The SyncConfig for a resolver attached to a versioned data source.

        • conflictHandler (string) --

          The Conflict Resolution strategy to perform in the event of a conflict.

          • OPTIMISTIC_CONCURRENCY: Resolve conflicts by rejecting mutations when versions don't match the latest version at the server.

          • AUTOMERGE: Resolve conflicts with the Automerge conflict resolution strategy.

          • LAMBDA: Resolve conflicts with an Lambda function supplied in the LambdaConflictHandlerConfig.

        • conflictDetection (string) --

          The Conflict Detection strategy to use.

          • VERSION: Detect conflicts based on object versions for this resolver.

          • NONE: Do not detect conflicts when invoking this resolver.

        • lambdaConflictHandlerConfig (dict) --

          The LambdaConflictHandlerConfig when configuring LAMBDA as the Conflict Handler.

          • lambdaConflictHandlerArn (string) --

            The Amazon Resource Name (ARN) for the Lambda function to use as the Conflict Handler.

      • cachingConfig (dict) --

        The caching configuration for the resolver.

        • ttl (integer) --

          The TTL in seconds for a resolver that has caching activated.

          Valid values are 1–3,600 seconds.

        • cachingKeys (list) --

          The caching keys for a resolver that has caching activated.

          Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

          • (string) --

      • maxBatchSize (integer) --

        The maximum batching size for a resolver.

      • runtime (dict) --

        Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.

        • name (string) --

          The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.

        • runtimeVersion (string) --

          The version of the runtime to use. Currently, the only allowed version is 1.0.0.

      • code (string) --

        The resolver code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.