Show / Hide Table of Contents

Class Function

Provides an AppSync Function.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var testGraphQLApi = new Aws.AppSync.GraphQLApi("testGraphQLApi", new Aws.AppSync.GraphQLApiArgs
    {
        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 testDataSource = new Aws.AppSync.DataSource("testDataSource", new Aws.AppSync.DataSourceArgs
    {
        ApiId = testGraphQLApi.Id,
        HttpConfig = new Aws.AppSync.Inputs.DataSourceHttpConfigArgs
        {
            Endpoint = "http://example.com",
        },
        Type = "HTTP",
    });
    var testFunction = new Aws.AppSync.Function("testFunction", new Aws.AppSync.FunctionArgs
    {
        ApiId = testGraphQLApi.Id,
        DataSource = testDataSource.Name,
        Name = "tf_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

",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Function
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.AppSync
Assembly: Pulumi.Aws.dll
Syntax
public class Function : CustomResource

Constructors

View Source

Function(String, FunctionArgs, CustomResourceOptions)

Create a Function resource with the given unique name, arguments, and options.

Declaration
public Function(string name, FunctionArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

FunctionArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ApiId

The ID of the associated AppSync API.

Declaration
public Output<string> ApiId { get; }
Property Value
Type Description
Output<System.String>
View Source

Arn

The ARN of the Function object.

Declaration
public Output<string> Arn { get; }
Property Value
Type Description
Output<System.String>
View Source

DataSource

The Function DataSource name.

Declaration
public Output<string> DataSource { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

The Function description.

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

FunctionId

A unique ID representing the Function object.

Declaration
public Output<string> FunctionId { get; }
Property Value
Type Description
Output<System.String>
View Source

FunctionVersion

The version of the request mapping template. Currently the supported value is 2018-05-29.

Declaration
public Output<string> FunctionVersion { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The Function name. The function name does not have to be unique.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

RequestMappingTemplate

The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

Declaration
public Output<string> RequestMappingTemplate { get; }
Property Value
Type Description
Output<System.String>
View Source

ResponseMappingTemplate

The Function response mapping template.

Declaration
public Output<string> ResponseMappingTemplate { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, FunctionState, CustomResourceOptions)

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

Declaration
public static Function Get(string name, Input<string> id, FunctionState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

FunctionState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Function
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.