1. Packages
  2. AWS
  3. API Docs
  4. appsync
  5. Function
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.appsync.Function

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides an AppSync Function.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.appsync.GraphQLApi("example", {
        authenticationType: "API_KEY",
        name: "example",
        schema: `type Mutation {
      putPost(id: ID!, title: String!): Post
    }
    
    type Post {
      id: ID!
      title: String!
    }
    
    type Query {
      singlePost(id: ID!): Post
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
    `,
    });
    const exampleDataSource = new aws.appsync.DataSource("example", {
        apiId: example.id,
        name: "example",
        type: "HTTP",
        httpConfig: {
            endpoint: "http://example.com",
        },
    });
    const exampleFunction = new aws.appsync.Function("example", {
        apiId: example.id,
        dataSource: exampleDataSource.name,
        name: "example",
        requestMappingTemplate: `{
        "version": "2018-05-29",
        "method": "GET",
        "resourcePath": "/",
        "params":{
            "headers": utils.http.copyheaders(ctx.request.headers)
        }
    }
    `,
        responseMappingTemplate: `#if(ctx.result.statusCode == 200)
        ctx.result.body
    #else
        utils.appendError(ctx.result.body, ctx.result.statusCode)
    #end
    `,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.appsync.GraphQLApi("example",
        authentication_type="API_KEY",
        name="example",
        schema="""type Mutation {
      putPost(id: ID!, title: String!): Post
    }
    
    type Post {
      id: ID!
      title: String!
    }
    
    type Query {
      singlePost(id: ID!): Post
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
    """)
    example_data_source = aws.appsync.DataSource("example",
        api_id=example.id,
        name="example",
        type="HTTP",
        http_config={
            "endpoint": "http://example.com",
        })
    example_function = aws.appsync.Function("example",
        api_id=example.id,
        data_source=example_data_source.name,
        name="example",
        request_mapping_template="""{
        "version": "2018-05-29",
        "method": "GET",
        "resourcePath": "/",
        "params":{
            "headers": $utils.http.copyheaders($ctx.request.headers)
        }
    }
    """,
        response_mapping_template="""#if($ctx.result.statusCode == 200)
        $ctx.result.body
    #else
        $utils.appendError($ctx.result.body, $ctx.result.statusCode)
    #end
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := appsync.NewGraphQLApi(ctx, "example", &appsync.GraphQLApiArgs{
    			AuthenticationType: pulumi.String("API_KEY"),
    			Name:               pulumi.String("example"),
    			Schema: pulumi.String(`type Mutation {
      putPost(id: ID!, title: String!): Post
    }
    
    type Post {
      id: ID!
      title: String!
    }
    
    type Query {
      singlePost(id: ID!): Post
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDataSource, err := appsync.NewDataSource(ctx, "example", &appsync.DataSourceArgs{
    			ApiId: example.ID(),
    			Name:  pulumi.String("example"),
    			Type:  pulumi.String("HTTP"),
    			HttpConfig: &appsync.DataSourceHttpConfigArgs{
    				Endpoint: pulumi.String("http://example.com"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appsync.NewFunction(ctx, "example", &appsync.FunctionArgs{
    			ApiId:      example.ID(),
    			DataSource: exampleDataSource.Name,
    			Name:       pulumi.String("example"),
    			RequestMappingTemplate: pulumi.String(`{
        "version": "2018-05-29",
        "method": "GET",
        "resourcePath": "/",
        "params":{
            "headers": $utils.http.copyheaders($ctx.request.headers)
        }
    }
    `),
    			ResponseMappingTemplate: pulumi.String(`#if($ctx.result.statusCode == 200)
        $ctx.result.body
    #else
        $utils.appendError($ctx.result.body, $ctx.result.statusCode)
    #end
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.AppSync.GraphQLApi("example", new()
        {
            AuthenticationType = "API_KEY",
            Name = "example",
            Schema = @"type Mutation {
      putPost(id: ID!, title: String!): Post
    }
    
    type Post {
      id: ID!
      title: String!
    }
    
    type Query {
      singlePost(id: ID!): Post
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
    ",
        });
    
        var exampleDataSource = new Aws.AppSync.DataSource("example", new()
        {
            ApiId = example.Id,
            Name = "example",
            Type = "HTTP",
            HttpConfig = new Aws.AppSync.Inputs.DataSourceHttpConfigArgs
            {
                Endpoint = "http://example.com",
            },
        });
    
        var exampleFunction = new Aws.AppSync.Function("example", new()
        {
            ApiId = example.Id,
            DataSource = exampleDataSource.Name,
            Name = "example",
            RequestMappingTemplate = @"{
        ""version"": ""2018-05-29"",
        ""method"": ""GET"",
        ""resourcePath"": ""/"",
        ""params"":{
            ""headers"": $utils.http.copyheaders($ctx.request.headers)
        }
    }
    ",
            ResponseMappingTemplate = @"#if($ctx.result.statusCode == 200)
        $ctx.result.body
    #else
        $utils.appendError($ctx.result.body, $ctx.result.statusCode)
    #end
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.appsync.GraphQLApi;
    import com.pulumi.aws.appsync.GraphQLApiArgs;
    import com.pulumi.aws.appsync.DataSource;
    import com.pulumi.aws.appsync.DataSourceArgs;
    import com.pulumi.aws.appsync.inputs.DataSourceHttpConfigArgs;
    import com.pulumi.aws.appsync.Function;
    import com.pulumi.aws.appsync.FunctionArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new GraphQLApi("example", GraphQLApiArgs.builder()
                .authenticationType("API_KEY")
                .name("example")
                .schema("""
    type Mutation {
      putPost(id: ID!, title: String!): Post
    }
    
    type Post {
      id: ID!
      title: String!
    }
    
    type Query {
      singlePost(id: ID!): Post
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
                """)
                .build());
    
            var exampleDataSource = new DataSource("exampleDataSource", DataSourceArgs.builder()
                .apiId(example.id())
                .name("example")
                .type("HTTP")
                .httpConfig(DataSourceHttpConfigArgs.builder()
                    .endpoint("http://example.com")
                    .build())
                .build());
    
            var exampleFunction = new Function("exampleFunction", FunctionArgs.builder()
                .apiId(example.id())
                .dataSource(exampleDataSource.name())
                .name("example")
                .requestMappingTemplate("""
    {
        "version": "2018-05-29",
        "method": "GET",
        "resourcePath": "/",
        "params":{
            "headers": $utils.http.copyheaders($ctx.request.headers)
        }
    }
                """)
                .responseMappingTemplate("""
    #if($ctx.result.statusCode == 200)
        $ctx.result.body
    #else
        $utils.appendError($ctx.result.body, $ctx.result.statusCode)
    #end
                """)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:appsync:GraphQLApi
        properties:
          authenticationType: API_KEY
          name: example
          schema: |
            type Mutation {
              putPost(id: ID!, title: String!): Post
            }
    
            type Post {
              id: ID!
              title: String!
            }
    
            type Query {
              singlePost(id: ID!): Post
            }
    
            schema {
              query: Query
              mutation: Mutation
            }        
      exampleDataSource:
        type: aws:appsync:DataSource
        name: example
        properties:
          apiId: ${example.id}
          name: example
          type: HTTP
          httpConfig:
            endpoint: http://example.com
      exampleFunction:
        type: aws:appsync:Function
        name: example
        properties:
          apiId: ${example.id}
          dataSource: ${exampleDataSource.name}
          name: example
          requestMappingTemplate: |
            {
                "version": "2018-05-29",
                "method": "GET",
                "resourcePath": "/",
                "params":{
                    "headers": $utils.http.copyheaders($ctx.request.headers)
                }
            }        
          responseMappingTemplate: |
            #if($ctx.result.statusCode == 200)
                $ctx.result.body
            #else
                $utils.appendError($ctx.result.body, $ctx.result.statusCode)
            #end        
    

    With Code

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    const example = new aws.appsync.Function("example", {
        apiId: exampleAwsAppsyncGraphqlApi.id,
        dataSource: exampleAwsAppsyncDatasource.name,
        name: "example",
        code: std.file({
            input: "some-code-dir",
        }).then(invoke => invoke.result),
        runtime: {
            name: "APPSYNC_JS",
            runtimeVersion: "1.0.0",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    example = aws.appsync.Function("example",
        api_id=example_aws_appsync_graphql_api["id"],
        data_source=example_aws_appsync_datasource["name"],
        name="example",
        code=std.file(input="some-code-dir").result,
        runtime={
            "name": "APPSYNC_JS",
            "runtime_version": "1.0.0",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "some-code-dir",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = appsync.NewFunction(ctx, "example", &appsync.FunctionArgs{
    			ApiId:      pulumi.Any(exampleAwsAppsyncGraphqlApi.Id),
    			DataSource: pulumi.Any(exampleAwsAppsyncDatasource.Name),
    			Name:       pulumi.String("example"),
    			Code:       pulumi.String(invokeFile.Result),
    			Runtime: &appsync.FunctionRuntimeArgs{
    				Name:           pulumi.String("APPSYNC_JS"),
    				RuntimeVersion: pulumi.String("1.0.0"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.AppSync.Function("example", new()
        {
            ApiId = exampleAwsAppsyncGraphqlApi.Id,
            DataSource = exampleAwsAppsyncDatasource.Name,
            Name = "example",
            Code = Std.File.Invoke(new()
            {
                Input = "some-code-dir",
            }).Apply(invoke => invoke.Result),
            Runtime = new Aws.AppSync.Inputs.FunctionRuntimeArgs
            {
                Name = "APPSYNC_JS",
                RuntimeVersion = "1.0.0",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.appsync.Function;
    import com.pulumi.aws.appsync.FunctionArgs;
    import com.pulumi.aws.appsync.inputs.FunctionRuntimeArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new Function("example", FunctionArgs.builder()
                .apiId(exampleAwsAppsyncGraphqlApi.id())
                .dataSource(exampleAwsAppsyncDatasource.name())
                .name("example")
                .code(StdFunctions.file(FileArgs.builder()
                    .input("some-code-dir")
                    .build()).result())
                .runtime(FunctionRuntimeArgs.builder()
                    .name("APPSYNC_JS")
                    .runtimeVersion("1.0.0")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:appsync:Function
        properties:
          apiId: ${exampleAwsAppsyncGraphqlApi.id}
          dataSource: ${exampleAwsAppsyncDatasource.name}
          name: example
          code:
            fn::invoke:
              Function: std:file
              Arguments:
                input: some-code-dir
              Return: result
          runtime:
            name: APPSYNC_JS
            runtimeVersion: 1.0.0
    

    Create Function Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
    @overload
    def Function(resource_name: str,
                 args: FunctionArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Function(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 api_id: Optional[str] = None,
                 data_source: Optional[str] = None,
                 code: Optional[str] = None,
                 description: Optional[str] = None,
                 function_version: Optional[str] = None,
                 max_batch_size: Optional[int] = None,
                 name: Optional[str] = None,
                 request_mapping_template: Optional[str] = None,
                 response_mapping_template: Optional[str] = None,
                 runtime: Optional[FunctionRuntimeArgs] = None,
                 sync_config: Optional[FunctionSyncConfigArgs] = None)
    func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
    public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
    public Function(String name, FunctionArgs args)
    public Function(String name, FunctionArgs args, CustomResourceOptions options)
    
    type: aws:appsync:Function
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FunctionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var functionResource = new Aws.AppSync.Function("functionResource", new()
    {
        ApiId = "string",
        DataSource = "string",
        Code = "string",
        Description = "string",
        FunctionVersion = "string",
        MaxBatchSize = 0,
        Name = "string",
        RequestMappingTemplate = "string",
        ResponseMappingTemplate = "string",
        Runtime = new Aws.AppSync.Inputs.FunctionRuntimeArgs
        {
            Name = "string",
            RuntimeVersion = "string",
        },
        SyncConfig = new Aws.AppSync.Inputs.FunctionSyncConfigArgs
        {
            ConflictDetection = "string",
            ConflictHandler = "string",
            LambdaConflictHandlerConfig = new Aws.AppSync.Inputs.FunctionSyncConfigLambdaConflictHandlerConfigArgs
            {
                LambdaConflictHandlerArn = "string",
            },
        },
    });
    
    example, err := appsync.NewFunction(ctx, "functionResource", &appsync.FunctionArgs{
    	ApiId:                   pulumi.String("string"),
    	DataSource:              pulumi.String("string"),
    	Code:                    pulumi.String("string"),
    	Description:             pulumi.String("string"),
    	FunctionVersion:         pulumi.String("string"),
    	MaxBatchSize:            pulumi.Int(0),
    	Name:                    pulumi.String("string"),
    	RequestMappingTemplate:  pulumi.String("string"),
    	ResponseMappingTemplate: pulumi.String("string"),
    	Runtime: &appsync.FunctionRuntimeArgs{
    		Name:           pulumi.String("string"),
    		RuntimeVersion: pulumi.String("string"),
    	},
    	SyncConfig: &appsync.FunctionSyncConfigArgs{
    		ConflictDetection: pulumi.String("string"),
    		ConflictHandler:   pulumi.String("string"),
    		LambdaConflictHandlerConfig: &appsync.FunctionSyncConfigLambdaConflictHandlerConfigArgs{
    			LambdaConflictHandlerArn: pulumi.String("string"),
    		},
    	},
    })
    
    var functionResource = new Function("functionResource", FunctionArgs.builder()
        .apiId("string")
        .dataSource("string")
        .code("string")
        .description("string")
        .functionVersion("string")
        .maxBatchSize(0)
        .name("string")
        .requestMappingTemplate("string")
        .responseMappingTemplate("string")
        .runtime(FunctionRuntimeArgs.builder()
            .name("string")
            .runtimeVersion("string")
            .build())
        .syncConfig(FunctionSyncConfigArgs.builder()
            .conflictDetection("string")
            .conflictHandler("string")
            .lambdaConflictHandlerConfig(FunctionSyncConfigLambdaConflictHandlerConfigArgs.builder()
                .lambdaConflictHandlerArn("string")
                .build())
            .build())
        .build());
    
    function_resource = aws.appsync.Function("functionResource",
        api_id="string",
        data_source="string",
        code="string",
        description="string",
        function_version="string",
        max_batch_size=0,
        name="string",
        request_mapping_template="string",
        response_mapping_template="string",
        runtime={
            "name": "string",
            "runtime_version": "string",
        },
        sync_config={
            "conflict_detection": "string",
            "conflict_handler": "string",
            "lambda_conflict_handler_config": {
                "lambda_conflict_handler_arn": "string",
            },
        })
    
    const functionResource = new aws.appsync.Function("functionResource", {
        apiId: "string",
        dataSource: "string",
        code: "string",
        description: "string",
        functionVersion: "string",
        maxBatchSize: 0,
        name: "string",
        requestMappingTemplate: "string",
        responseMappingTemplate: "string",
        runtime: {
            name: "string",
            runtimeVersion: "string",
        },
        syncConfig: {
            conflictDetection: "string",
            conflictHandler: "string",
            lambdaConflictHandlerConfig: {
                lambdaConflictHandlerArn: "string",
            },
        },
    });
    
    type: aws:appsync:Function
    properties:
        apiId: string
        code: string
        dataSource: string
        description: string
        functionVersion: string
        maxBatchSize: 0
        name: string
        requestMappingTemplate: string
        responseMappingTemplate: string
        runtime:
            name: string
            runtimeVersion: string
        syncConfig:
            conflictDetection: string
            conflictHandler: string
            lambdaConflictHandlerConfig:
                lambdaConflictHandlerArn: string
    

    Function Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Function resource accepts the following input properties:

    ApiId string
    ID of the associated AppSync API.
    DataSource string
    Function data source name.
    Code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    Description string
    Function description.
    FunctionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    MaxBatchSize int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    Name string
    Function name. The function name does not have to be unique.
    RequestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    ResponseMappingTemplate string
    Function response mapping template.
    Runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    SyncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    ApiId string
    ID of the associated AppSync API.
    DataSource string
    Function data source name.
    Code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    Description string
    Function description.
    FunctionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    MaxBatchSize int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    Name string
    Function name. The function name does not have to be unique.
    RequestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    ResponseMappingTemplate string
    Function response mapping template.
    Runtime FunctionRuntimeArgs
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    SyncConfig FunctionSyncConfigArgs
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId String
    ID of the associated AppSync API.
    dataSource String
    Function data source name.
    code String
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    description String
    Function description.
    functionVersion String
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize Integer
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name String
    Function name. The function name does not have to be unique.
    requestMappingTemplate String
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate String
    Function response mapping template.
    runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId string
    ID of the associated AppSync API.
    dataSource string
    Function data source name.
    code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    description string
    Function description.
    functionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize number
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name string
    Function name. The function name does not have to be unique.
    requestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate string
    Function response mapping template.
    runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    api_id str
    ID of the associated AppSync API.
    data_source str
    Function data source name.
    code str
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    description str
    Function description.
    function_version str
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    max_batch_size int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name str
    Function name. The function name does not have to be unique.
    request_mapping_template str
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    response_mapping_template str
    Function response mapping template.
    runtime FunctionRuntimeArgs
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    sync_config FunctionSyncConfigArgs
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId String
    ID of the associated AppSync API.
    dataSource String
    Function data source name.
    code String
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    description String
    Function description.
    functionVersion String
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize Number
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name String
    Function name. The function name does not have to be unique.
    requestMappingTemplate String
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate String
    Function response mapping template.
    runtime Property Map
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig Property Map
    Describes a Sync configuration for a resolver. See sync_config Block for details.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:

    Arn string
    ARN of the Function object.
    FunctionId string
    Unique ID representing the Function object.
    Id string
    The provider-assigned unique ID for this managed resource.
    Arn string
    ARN of the Function object.
    FunctionId string
    Unique ID representing the Function object.
    Id string
    The provider-assigned unique ID for this managed resource.
    arn String
    ARN of the Function object.
    functionId String
    Unique ID representing the Function object.
    id String
    The provider-assigned unique ID for this managed resource.
    arn string
    ARN of the Function object.
    functionId string
    Unique ID representing the Function object.
    id string
    The provider-assigned unique ID for this managed resource.
    arn str
    ARN of the Function object.
    function_id str
    Unique ID representing the Function object.
    id str
    The provider-assigned unique ID for this managed resource.
    arn String
    ARN of the Function object.
    functionId String
    Unique ID representing the Function object.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Function Resource

    Get an existing Function resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: FunctionState, opts?: CustomResourceOptions): Function
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_id: Optional[str] = None,
            arn: Optional[str] = None,
            code: Optional[str] = None,
            data_source: Optional[str] = None,
            description: Optional[str] = None,
            function_id: Optional[str] = None,
            function_version: Optional[str] = None,
            max_batch_size: Optional[int] = None,
            name: Optional[str] = None,
            request_mapping_template: Optional[str] = None,
            response_mapping_template: Optional[str] = None,
            runtime: Optional[FunctionRuntimeArgs] = None,
            sync_config: Optional[FunctionSyncConfigArgs] = None) -> Function
    func GetFunction(ctx *Context, name string, id IDInput, state *FunctionState, opts ...ResourceOption) (*Function, error)
    public static Function Get(string name, Input<string> id, FunctionState? state, CustomResourceOptions? opts = null)
    public static Function get(String name, Output<String> id, FunctionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiId string
    ID of the associated AppSync API.
    Arn string
    ARN of the Function object.
    Code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    DataSource string
    Function data source name.
    Description string
    Function description.
    FunctionId string
    Unique ID representing the Function object.
    FunctionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    MaxBatchSize int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    Name string
    Function name. The function name does not have to be unique.
    RequestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    ResponseMappingTemplate string
    Function response mapping template.
    Runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    SyncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    ApiId string
    ID of the associated AppSync API.
    Arn string
    ARN of the Function object.
    Code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    DataSource string
    Function data source name.
    Description string
    Function description.
    FunctionId string
    Unique ID representing the Function object.
    FunctionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    MaxBatchSize int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    Name string
    Function name. The function name does not have to be unique.
    RequestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    ResponseMappingTemplate string
    Function response mapping template.
    Runtime FunctionRuntimeArgs
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    SyncConfig FunctionSyncConfigArgs
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId String
    ID of the associated AppSync API.
    arn String
    ARN of the Function object.
    code String
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    dataSource String
    Function data source name.
    description String
    Function description.
    functionId String
    Unique ID representing the Function object.
    functionVersion String
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize Integer
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name String
    Function name. The function name does not have to be unique.
    requestMappingTemplate String
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate String
    Function response mapping template.
    runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId string
    ID of the associated AppSync API.
    arn string
    ARN of the Function object.
    code string
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    dataSource string
    Function data source name.
    description string
    Function description.
    functionId string
    Unique ID representing the Function object.
    functionVersion string
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize number
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name string
    Function name. The function name does not have to be unique.
    requestMappingTemplate string
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate string
    Function response mapping template.
    runtime FunctionRuntime
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig FunctionSyncConfig
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    api_id str
    ID of the associated AppSync API.
    arn str
    ARN of the Function object.
    code str
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    data_source str
    Function data source name.
    description str
    Function description.
    function_id str
    Unique ID representing the Function object.
    function_version str
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    max_batch_size int
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name str
    Function name. The function name does not have to be unique.
    request_mapping_template str
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    response_mapping_template str
    Function response mapping template.
    runtime FunctionRuntimeArgs
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    sync_config FunctionSyncConfigArgs
    Describes a Sync configuration for a resolver. See sync_config Block for details.
    apiId String
    ID of the associated AppSync API.
    arn String
    ARN of the Function object.
    code String
    The function code that contains the request and response functions. When code is used, the runtime is required. The runtime value must be APPSYNC_JS.
    dataSource String
    Function data source name.
    description String
    Function description.
    functionId String
    Unique ID representing the Function object.
    functionVersion String
    Version of the request mapping template. Currently the supported value is 2018-05-29. Does not apply when specifying code.
    maxBatchSize Number
    Maximum batching size for a resolver. Valid values are between 0 and 2000.
    name String
    Function name. The function name does not have to be unique.
    requestMappingTemplate String
    Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.
    responseMappingTemplate String
    Function response mapping template.
    runtime Property Map
    Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified. See runtime Block for details.
    syncConfig Property Map
    Describes a Sync configuration for a resolver. See sync_config Block for details.

    Supporting Types

    FunctionRuntime, FunctionRuntimeArgs

    Name string
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    RuntimeVersion string
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.
    Name string
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    RuntimeVersion string
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.
    name String
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    runtimeVersion String
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.
    name string
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    runtimeVersion string
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.
    name str
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    runtime_version str
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.
    name String
    The name of the runtime to use. Currently, the only allowed value is APPSYNC_JS.
    runtimeVersion String
    The version of the runtime to use. Currently, the only allowed version is 1.0.0.

    FunctionSyncConfig, FunctionSyncConfigArgs

    ConflictDetection string
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    ConflictHandler string
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    LambdaConflictHandlerConfig FunctionSyncConfigLambdaConflictHandlerConfig
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.
    ConflictDetection string
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    ConflictHandler string
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    LambdaConflictHandlerConfig FunctionSyncConfigLambdaConflictHandlerConfig
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.
    conflictDetection String
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    conflictHandler String
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    lambdaConflictHandlerConfig FunctionSyncConfigLambdaConflictHandlerConfig
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.
    conflictDetection string
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    conflictHandler string
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    lambdaConflictHandlerConfig FunctionSyncConfigLambdaConflictHandlerConfig
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.
    conflict_detection str
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    conflict_handler str
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    lambda_conflict_handler_config FunctionSyncConfigLambdaConflictHandlerConfig
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.
    conflictDetection String
    Conflict Detection strategy to use. Valid values are NONE and VERSION.
    conflictHandler String
    Conflict Resolution strategy to perform in the event of a conflict. Valid values are NONE, OPTIMISTIC_CONCURRENCY, AUTOMERGE, and LAMBDA.
    lambdaConflictHandlerConfig Property Map
    Lambda Conflict Handler Config when configuring LAMBDA as the Conflict Handler. See lambda_conflict_handler_config Block for details.

    FunctionSyncConfigLambdaConflictHandlerConfig, FunctionSyncConfigLambdaConflictHandlerConfigArgs

    LambdaConflictHandlerArn string
    ARN for the Lambda function to use as the Conflict Handler.
    LambdaConflictHandlerArn string
    ARN for the Lambda function to use as the Conflict Handler.
    lambdaConflictHandlerArn String
    ARN for the Lambda function to use as the Conflict Handler.
    lambdaConflictHandlerArn string
    ARN for the Lambda function to use as the Conflict Handler.
    lambda_conflict_handler_arn str
    ARN for the Lambda function to use as the Conflict Handler.
    lambdaConflictHandlerArn String
    ARN for the Lambda function to use as the Conflict Handler.

    Import

    Using pulumi import, import aws_appsync_function using the AppSync API ID and Function ID separated by -. For example:

    $ pulumi import aws:appsync/function:Function example xxxxx-yyyyy
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi