AppsyncFunction

class aws_cdk.aws_appsync.AppsyncFunction(scope, id, *, api, data_source, name, description=None, request_mapping_template=None, response_mapping_template=None)

Bases: Resource

(experimental) 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.

Stability:

experimental

Resource:

AWS::AppSync::FunctionConfiguration

ExampleMetadata:

infused

Example:

# api: appsync.GraphqlApi


appsync_function = appsync.AppsyncFunction(self, "function",
    name="appsync_function",
    api=api,
    data_source=api.add_none_data_source("none"),
    request_mapping_template=appsync.MappingTemplate.from_file("request.vtl"),
    response_mapping_template=appsync.MappingTemplate.from_file("response.vtl")
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • api (IGraphqlApi) – (experimental) the GraphQL Api linked to this AppSync Function.

  • data_source (BaseDataSource) – (experimental) the data source linked to this AppSync Function.

  • name (str) – (experimental) the name of the AppSync Function.

  • description (Optional[str]) – (experimental) the description for this AppSync Function. Default: - no description

  • request_mapping_template (Optional[MappingTemplate]) – (experimental) the request mapping template for the AppSync Function. Default: - no request mapping template

  • response_mapping_template (Optional[MappingTemplate]) – (experimental) the response mapping template for the AppSync Function. Default: - no response mapping template

Stability:

experimental

Methods

apply_removal_policy(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).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

data_source

(experimental) the data source of this AppSync Function.

Stability:

experimental

Attribute:

DataSourceName

env

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.

function_arn

(experimental) the ARN of the AppSync function.

Stability:

experimental

Attribute:

true

function_id

(experimental) the ID of the AppSync function.

Stability:

experimental

Attribute:

true

function_name

(experimental) the name of this AppSync Function.

Stability:

experimental

Attribute:

Name

node

The construct tree node associated with this construct.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_appsync_function_attributes(scope, id, *, function_arn)

(experimental) Import Appsync Function from arn.

Parameters:
  • scope (Construct) –

  • id (str) –

  • function_arn (str) – (experimental) the ARN of the AppSync function.

Stability:

experimental

Return type:

IAppsyncFunction

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool