1. Packages
  2. AWS Classic
  3. API Docs
  4. appsync
  5. Function

Try AWS Native preview for resources not in the classic version.

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

aws.appsync.Function

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

    Provides an AppSync Function.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new()
        {
            AuthenticationType = "API_KEY",
            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("exampleDataSource", new()
        {
            ApiId = exampleGraphQLApi.Id,
            Name = "example",
            Type = "HTTP",
            HttpConfig = new Aws.AppSync.Inputs.DataSourceHttpConfigArgs
            {
                Endpoint = "http://example.com",
            },
        });
    
        var exampleFunction = new Aws.AppSync.Function("exampleFunction", new()
        {
            ApiId = exampleGraphQLApi.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 main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/appsync"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleGraphQLApi, err := appsync.NewGraphQLApi(ctx, "exampleGraphQLApi", &appsync.GraphQLApiArgs{
    			AuthenticationType: pulumi.String("API_KEY"),
    			Schema:             pulumi.String("type Mutation {\n  putPost(id: ID!, title: String!): Post\n}\n\ntype Post {\n  id: ID!\n  title: String!\n}\n\ntype Query {\n  singlePost(id: ID!): Post\n}\n\nschema {\n  query: Query\n  mutation: Mutation\n}\n"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDataSource, err := appsync.NewDataSource(ctx, "exampleDataSource", &appsync.DataSourceArgs{
    			ApiId: exampleGraphQLApi.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, "exampleFunction", &appsync.FunctionArgs{
    			ApiId:                   exampleGraphQLApi.ID(),
    			DataSource:              exampleDataSource.Name,
    			Name:                    pulumi.String("example"),
    			RequestMappingTemplate:  pulumi.String("{\n    \"version\": \"2018-05-29\",\n    \"method\": \"GET\",\n    \"resourcePath\": \"/\",\n    \"params\":{\n        \"headers\": $utils.http.copyheaders($ctx.request.headers)\n    }\n}\n"),
    			ResponseMappingTemplate: pulumi.String("#if($ctx.result.statusCode == 200)\n    $ctx.result.body\n#else\n    $utils.appendError($ctx.result.body, $ctx.result.statusCode)\n#end\n"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 exampleGraphQLApi = new GraphQLApi("exampleGraphQLApi", GraphQLApiArgs.builder()        
                .authenticationType("API_KEY")
                .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(exampleGraphQLApi.id())
                .name("example")
                .type("HTTP")
                .httpConfig(DataSourceHttpConfigArgs.builder()
                    .endpoint("http://example.com")
                    .build())
                .build());
    
            var exampleFunction = new Function("exampleFunction", FunctionArgs.builder()        
                .apiId(exampleGraphQLApi.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());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example_graph_ql_api = aws.appsync.GraphQLApi("exampleGraphQLApi",
        authentication_type="API_KEY",
        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("exampleDataSource",
        api_id=example_graph_ql_api.id,
        name="example",
        type="HTTP",
        http_config=aws.appsync.DataSourceHttpConfigArgs(
            endpoint="http://example.com",
        ))
    example_function = aws.appsync.Function("exampleFunction",
        api_id=example_graph_ql_api.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
    """)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleGraphQLApi = new aws.appsync.GraphQLApi("exampleGraphQLApi", {
        authenticationType: "API_KEY",
        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("exampleDataSource", {
        apiId: exampleGraphQLApi.id,
        name: "example",
        type: "HTTP",
        httpConfig: {
            endpoint: "http://example.com",
        },
    });
    const exampleFunction = new aws.appsync.Function("exampleFunction", {
        apiId: exampleGraphQLApi.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
    `,
    });
    
    resources:
      exampleGraphQLApi:
        type: aws:appsync:GraphQLApi
        properties:
          authenticationType: API_KEY
          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
        properties:
          apiId: ${exampleGraphQLApi.id}
          name: example
          type: HTTP
          httpConfig:
            endpoint: http://example.com
      exampleFunction:
        type: aws:appsync:Function
        properties:
          apiId: ${exampleGraphQLApi.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

    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.AppSync.Function("example", new()
        {
            ApiId = aws_appsync_graphql_api.Example.Id,
            DataSource = aws_appsync_datasource.Example.Name,
            Name = "example",
            Code = File.ReadAllText("some-code-dir"),
            Runtime = new Aws.AppSync.Inputs.FunctionRuntimeArgs
            {
                Name = "APPSYNC_JS",
                RuntimeVersion = "1.0.0",
            },
        });
    
    });
    
    package main
    
    import (
    	"os"
    
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/appsync"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := appsync.NewFunction(ctx, "example", &appsync.FunctionArgs{
    			ApiId:      pulumi.Any(aws_appsync_graphql_api.Example.Id),
    			DataSource: pulumi.Any(aws_appsync_datasource.Example.Name),
    			Name:       pulumi.String("example"),
    			Code:       readFileOrPanic("some-code-dir"),
    			Runtime: &appsync.FunctionRuntimeArgs{
    				Name:           pulumi.String("APPSYNC_JS"),
    				RuntimeVersion: pulumi.String("1.0.0"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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(aws_appsync_graphql_api.example().id())
                .dataSource(aws_appsync_datasource.example().name())
                .name("example")
                .code(Files.readString(Paths.get("some-code-dir")))
                .runtime(FunctionRuntimeArgs.builder()
                    .name("APPSYNC_JS")
                    .runtimeVersion("1.0.0")
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.appsync.Function("example",
        api_id=aws_appsync_graphql_api["example"]["id"],
        data_source=aws_appsync_datasource["example"]["name"],
        name="example",
        code=(lambda path: open(path).read())("some-code-dir"),
        runtime=aws.appsync.FunctionRuntimeArgs(
            name="APPSYNC_JS",
            runtime_version="1.0.0",
        ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as fs from "fs";
    
    const example = new aws.appsync.Function("example", {
        apiId: aws_appsync_graphql_api.example.id,
        dataSource: aws_appsync_datasource.example.name,
        name: "example",
        code: fs.readFileSync("some-code-dir"),
        runtime: {
            name: "APPSYNC_JS",
            runtimeVersion: "1.0.0",
        },
    });
    
    resources:
      example:
        type: aws:appsync:Function
        properties:
          apiId: ${aws_appsync_graphql_api.example.id}
          dataSource: ${aws_appsync_datasource.example.name}
          name: example
          code:
            fn::readFile: some-code-dir
          runtime:
            name: APPSYNC_JS
            runtimeVersion: 1.0.0
    

    Create Function Resource

    new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
    @overload
    def Function(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 api_id: Optional[str] = None,
                 code: Optional[str] = None,
                 data_source: 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)
    @overload
    def Function(resource_name: str,
                 args: FunctionArgs,
                 opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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

    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 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.

    SyncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    SyncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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 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.

    syncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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 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.

    syncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    sync_config FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    syncConfig Property Map

    Describes a Sync configuration for a resolver. See Sync Config.

    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 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.

    SyncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    SyncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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 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.

    syncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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 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.

    syncConfig FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    sync_config FunctionSyncConfigArgs

    Describes a Sync configuration for a resolver. See Sync Config.

    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.

    syncConfig Property Map

    Describes a Sync configuration for a resolver. See Sync Config.

    Supporting Types

    FunctionRuntime

    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

    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.

    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.

    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.

    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.

    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.

    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.

    FunctionSyncConfigLambdaConflictHandlerConfig

    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

    aws_appsync_function can be imported using the AppSync API ID and Function ID separated by -, e.g.,

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

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi