aws-cdk-lib.aws_appsync.FunctionRuntime

class FunctionRuntime

LanguageType name
.NETAmazon.CDK.AWS.AppSync.FunctionRuntime
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappsync#FunctionRuntime
Javasoftware.amazon.awscdk.services.appsync.FunctionRuntime
Pythonaws_cdk.aws_appsync.FunctionRuntime
TypeScript (source)aws-cdk-lib » aws_appsync » FunctionRuntime

Utility class for specifying specific appsync runtime versions.

Example

declare const api: appsync.GraphqlApi;

const myJsFunction = new appsync.AppsyncFunction(this, 'function', {
  name: 'my_js_function',
  api,
  dataSource: api.addNoneDataSource('none'),
  code: appsync.Code.fromAsset('directory/function_code.js'),
  runtime: appsync.FunctionRuntime.JS_1_0_0,
});

new appsync.Resolver(this, 'PipelineResolver', {
  api,
  typeName: 'typeName',
  fieldName: 'fieldName',
  code: appsync.Code.fromInline(`
    // The before step
    export function request(...args) {
      console.log(args);
      return {}
    }

    // The after step
    export function response(ctx) {
      return ctx.prev.result
    }
  `),
  runtime: appsync.FunctionRuntime.JS_1_0_0,
  pipelineConfig: [myJsFunction],
});

Initializer

new FunctionRuntime(family: FunctionRuntimeFamily, version: string)

Parameters

  • family FunctionRuntimeFamily
  • version string

Properties

NameTypeDescription
namestringThe name of the runtime.
versionstringThe runtime version.
static JS_1_0_0FunctionRuntimeAPPSYNC_JS v1.0.0 runtime.

name

Type: string

The name of the runtime.


version

Type: string

The runtime version.


static JS_1_0_0

Type: FunctionRuntime

APPSYNC_JS v1.0.0 runtime.

Methods

NameDescription
toProperties()Convert to Cfn runtime configuration property format.

toProperties()

public toProperties(): RuntimeConfig

Returns

  • RuntimeConfig

Convert to Cfn runtime configuration property format.