1. Packages
  2. AWS
  3. API Docs
  4. appsync
  5. Type
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.appsync.Type

Explore with Pulumi AI

Provides an AppSync Type.

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",
});
const exampleType = new aws.appsync.Type("example", {
    apiId: example.id,
    format: "SDL",
    definition: `type Mutation

{
putPost(id: ID!,title: String! ): Post

}
`,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.appsync.GraphQLApi("example",
    authentication_type="API_KEY",
    name="example")
example_type = aws.appsync.Type("example",
    api_id=example.id,
    format="SDL",
    definition="""type Mutation

{
putPost(id: ID!,title: String! ): Post

}
""")
Copy
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"),
		})
		if err != nil {
			return err
		}
		_, err = appsync.NewType(ctx, "example", &appsync.TypeArgs{
			ApiId:  example.ID(),
			Format: pulumi.String("SDL"),
			Definition: pulumi.String(`type Mutation

{
putPost(id: ID!,title: String! ): Post

}
`),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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",
    });

    var exampleType = new Aws.AppSync.Type("example", new()
    {
        ApiId = example.Id,
        Format = "SDL",
        Definition = @"type Mutation

{
putPost(id: ID!,title: String! ): Post

}
",
    });

});
Copy
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.Type;
import com.pulumi.aws.appsync.TypeArgs;
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")
            .build());

        var exampleType = new Type("exampleType", TypeArgs.builder()
            .apiId(example.id())
            .format("SDL")
            .definition("""
type Mutation

{
putPost(id: ID!,title: String! ): Post

}
            """)
            .build());

    }
}
Copy
resources:
  example:
    type: aws:appsync:GraphQLApi
    properties:
      authenticationType: API_KEY
      name: example
  exampleType:
    type: aws:appsync:Type
    name: example
    properties:
      apiId: ${example.id}
      format: SDL
      definition: |
        type Mutation

        {
        putPost(id: ID!,title: String! ): Post

        }        
Copy

Create Type Resource

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

Constructor syntax

new Type(name: string, args: TypeArgs, opts?: CustomResourceOptions);
@overload
def Type(resource_name: str,
         args: TypeArgs,
         opts: Optional[ResourceOptions] = None)

@overload
def Type(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         api_id: Optional[str] = None,
         definition: Optional[str] = None,
         format: Optional[str] = None)
func NewType(ctx *Context, name string, args TypeArgs, opts ...ResourceOption) (*Type, error)
public Type(string name, TypeArgs args, CustomResourceOptions? opts = null)
public Type(String name, TypeArgs args)
public Type(String name, TypeArgs args, CustomResourceOptions options)
type: aws:appsync:Type
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TypeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TypeArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TypeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TypeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TypeArgs
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 typeResource = new Aws.AppSync.Type("typeResource", new()
{
    ApiId = "string",
    Definition = "string",
    Format = "string",
});
Copy
example, err := appsync.NewType(ctx, "typeResource", &appsync.TypeArgs{
	ApiId:      pulumi.String("string"),
	Definition: pulumi.String("string"),
	Format:     pulumi.String("string"),
})
Copy
var typeResource = new Type("typeResource", TypeArgs.builder()
    .apiId("string")
    .definition("string")
    .format("string")
    .build());
Copy
type_resource = aws.appsync.Type("typeResource",
    api_id="string",
    definition="string",
    format="string")
Copy
const typeResource = new aws.appsync.Type("typeResource", {
    apiId: "string",
    definition: "string",
    format: "string",
});
Copy
type: aws:appsync:Type
properties:
    apiId: string
    definition: string
    format: string
Copy

Type 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 Type resource accepts the following input properties:

ApiId
This property is required.
Changes to this property will trigger replacement.
string
GraphQL API ID.
Definition This property is required. string
The type definition.
Format This property is required. string
The type format: SDL or JSON.
ApiId
This property is required.
Changes to this property will trigger replacement.
string
GraphQL API ID.
Definition This property is required. string
The type definition.
Format This property is required. string
The type format: SDL or JSON.
apiId
This property is required.
Changes to this property will trigger replacement.
String
GraphQL API ID.
definition This property is required. String
The type definition.
format This property is required. String
The type format: SDL or JSON.
apiId
This property is required.
Changes to this property will trigger replacement.
string
GraphQL API ID.
definition This property is required. string
The type definition.
format This property is required. string
The type format: SDL or JSON.
api_id
This property is required.
Changes to this property will trigger replacement.
str
GraphQL API ID.
definition This property is required. str
The type definition.
format This property is required. str
The type format: SDL or JSON.
apiId
This property is required.
Changes to this property will trigger replacement.
String
GraphQL API ID.
definition This property is required. String
The type definition.
format This property is required. String
The type format: SDL or JSON.

Outputs

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

Arn string
The ARN of the type.
Description string
The type description.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The type name.
Arn string
The ARN of the type.
Description string
The type description.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The type name.
arn String
The ARN of the type.
description String
The type description.
id String
The provider-assigned unique ID for this managed resource.
name String
The type name.
arn string
The ARN of the type.
description string
The type description.
id string
The provider-assigned unique ID for this managed resource.
name string
The type name.
arn str
The ARN of the type.
description str
The type description.
id str
The provider-assigned unique ID for this managed resource.
name str
The type name.
arn String
The ARN of the type.
description String
The type description.
id String
The provider-assigned unique ID for this managed resource.
name String
The type name.

Look up Existing Type Resource

Get an existing Type 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?: TypeState, opts?: CustomResourceOptions): Type
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_id: Optional[str] = None,
        arn: Optional[str] = None,
        definition: Optional[str] = None,
        description: Optional[str] = None,
        format: Optional[str] = None,
        name: Optional[str] = None) -> Type
func GetType(ctx *Context, name string, id IDInput, state *TypeState, opts ...ResourceOption) (*Type, error)
public static Type Get(string name, Input<string> id, TypeState? state, CustomResourceOptions? opts = null)
public static Type get(String name, Output<String> id, TypeState state, CustomResourceOptions options)
resources:  _:    type: aws:appsync:Type    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 Changes to this property will trigger replacement. string
GraphQL API ID.
Arn string
The ARN of the type.
Definition string
The type definition.
Description string
The type description.
Format string
The type format: SDL or JSON.
Name string
The type name.
ApiId Changes to this property will trigger replacement. string
GraphQL API ID.
Arn string
The ARN of the type.
Definition string
The type definition.
Description string
The type description.
Format string
The type format: SDL or JSON.
Name string
The type name.
apiId Changes to this property will trigger replacement. String
GraphQL API ID.
arn String
The ARN of the type.
definition String
The type definition.
description String
The type description.
format String
The type format: SDL or JSON.
name String
The type name.
apiId Changes to this property will trigger replacement. string
GraphQL API ID.
arn string
The ARN of the type.
definition string
The type definition.
description string
The type description.
format string
The type format: SDL or JSON.
name string
The type name.
api_id Changes to this property will trigger replacement. str
GraphQL API ID.
arn str
The ARN of the type.
definition str
The type definition.
description str
The type description.
format str
The type format: SDL or JSON.
name str
The type name.
apiId Changes to this property will trigger replacement. String
GraphQL API ID.
arn String
The ARN of the type.
definition String
The type definition.
description String
The type description.
format String
The type format: SDL or JSON.
name String
The type name.

Import

Using pulumi import, import Appsync Types using the id. For example:

$ pulumi import aws:appsync/type:Type example api-id:format:name
Copy

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.