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
",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.AppSync
Assembly: Pulumi.Aws.dll
Syntax
public class Function : CustomResource
Constructors
View SourceFunction(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 SourceApiId
The ID of the associated AppSync API.
Declaration
public Output<string> ApiId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Arn
The ARN of the Function object.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DataSource
The Function DataSource name.
Declaration
public Output<string> DataSource { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
The Function description.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
FunctionId
A unique ID representing the Function object.
Declaration
public Output<string> FunctionId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
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> |
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> |
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> |
ResponseMappingTemplate
The Function response mapping template.
Declaration
public Output<string> ResponseMappingTemplate { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(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 |