# InlineCode

AppSync function code from an inline string.

Extends: [Code](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Code.html) › InlineCode
Obtainable from: [Code.fromInline](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Code.html#frominline)

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

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const inlineCode = new appsync.InlineCode('code');
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync

inline_code = appsync.InlineCode("code")
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;

InlineCode inlineCode = new InlineCode("code");
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;

var inlineCode = new InlineCode("code");
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

inlineCode := awscdk.Aws_appsync.NewInlineCode(jsii.String("code"))
```

## Initializer

TypeScript:

```ts
new InlineCode(code: string)
```

Python:

```python
InlineCode(code: str)
```

Java:

```java
new InlineCode(String code)
```

C# / .NET:

```csharp
new InlineCode(string code)
```

Golang:

```go
NewInlineCode(Code *string)
```

## Methods

- `bind(_scope: Construct): CodeConfig` — Bind source code to an AppSync Function or resolver.

- `fromAsset(path: string, options?: AssetOptions): AssetCode` (static) — Loads the function code from a local disk path.

  **Parameters**

  - `path` — The path to the source code file.

- `fromInline(code: string): InlineCode // chainable` (static) — Inline code for AppSync function.

  **Parameters**

  - `code` — The actual handler code (the resulting zip file cannot exceed 4MB).

  **Returns:** `InlineCode` with inline code.
