# FunctionRuntime

Utility class for specifying specific appsync runtime versions.

- Source: [`aws-appsync/lib/runtime.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/runtime.ts#L29)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

```ts
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

```ts
new FunctionRuntime(family: FunctionRuntimeFamily, version: string)
```

## Properties

- `JS_1_0_0`: [FunctionRuntime](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.FunctionRuntime.html) (static) — APPSYNC_JS v1.0.0 runtime.

- `name`: string — The name of the runtime.

- `version`: string — The runtime version.

## Methods

- `toProperties(): RuntimeConfig` — Convert to Cfn runtime configuration property format.
