class AppsyncFunction (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppSync.AppsyncFunction |
Java | software.amazon.awscdk.services.appsync.AppsyncFunction |
Python | aws_cdk.aws_appsync.AppsyncFunction |
TypeScript (source) | @aws-cdk/aws-appsync » AppsyncFunction |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IAppsync
AppSync Functions are local functions that perform certain operations onto a backend data source.
Developers can compose operations (Functions) and execute them in sequence with Pipeline Resolvers.
Example
declare const api: appsync.GraphqlApi;
const appsyncFunction = new appsync.AppsyncFunction(this, 'function', {
name: 'appsync_function',
api,
dataSource: api.addNoneDataSource('none'),
requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'),
responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'),
});
Initializer
new AppsyncFunction(scope: Construct, id: string, props: AppsyncFunctionProps)
Parameters
- scope
Construct
- id
string
- props
Appsync
Function Props
Construct Props
Name | Type | Description |
---|---|---|
api | IGraphql | the GraphQL Api linked to this AppSync Function. |
data | Base | the data source linked to this AppSync Function. |
name | string | the name of the AppSync Function. |
description? | string | the description for this AppSync Function. |
request | Mapping | the request mapping template for the AppSync Function. |
response | Mapping | the response mapping template for the AppSync Function. |
api
Type:
IGraphql
the GraphQL Api linked to this AppSync Function.
dataSource
Type:
Base
the data source linked to this AppSync Function.
name
Type:
string
the name of the AppSync Function.
description?
Type:
string
(optional, default: no description)
the description for this AppSync Function.
requestMappingTemplate?
Type:
Mapping
(optional, default: no request mapping template)
the request mapping template for the AppSync Function.
responseMappingTemplate?
Type:
Mapping
(optional, default: no response mapping template)
the response mapping template for the AppSync Function.
Properties
Name | Type | Description |
---|---|---|
data | Base | the data source of this AppSync Function. |
env | Resource | The environment this resource belongs to. |
function | string | the ARN of the AppSync function. |
function | string | the ID of the AppSync function. |
function | string | the name of this AppSync Function. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
dataSource
Type:
Base
the data source of this AppSync Function.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
functionArn
Type:
string
the ARN of the AppSync function.
functionId
Type:
string
the ID of the AppSync function.
functionName
Type:
string
the name of this AppSync Function.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import Appsync Function from arn. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
AppsyncFunctionAttributes(scope, id, attrs)
static frompublic static fromAppsyncFunctionAttributes(scope: Construct, id: string, attrs: AppsyncFunctionAttributes): IAppsyncFunction
Parameters
- scope
Construct
- id
string
- attrs
Appsync
Function Attributes
Returns
Import Appsync Function from arn.