class EnumType
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppSync.EnumType |
Java | software.amazon.awscdk.services.appsync.EnumType |
Python | aws_cdk.aws_appsync.EnumType |
TypeScript (source) | @aws-cdk/aws-appsync » EnumType |
Implements
IIntermediate
Enum Types are abstract types that includes a set of fields that represent the strings this type can create.
Example
declare const api: appsync.GraphqlApi;
const episode = new appsync.EnumType('Episode', {
definition: [
'NEWHOPE',
'EMPIRE',
'JEDI',
],
});
api.addType(episode);
Initializer
new EnumType(name: string, options: EnumTypeOptions)
Parameters
- name
string
- options
Enum
Type Options
Properties
Name | Type | Description |
---|---|---|
definition | { [string]: IField } | the attributes of this type. |
name | string | the name of this type. |
modes? | Authorization [] | the authorization modes for this intermediate type. |
definition
Type:
{ [string]:
IField
}
the attributes of this type.
name
Type:
string
the name of this type.
modes?
Type:
Authorization
[]
(optional)
the authorization modes for this intermediate type.
Methods
Name | Description |
---|---|
add | Add a field to this Enum Type. |
attribute(options?) | Create an GraphQL Type representing this Enum Type. |
to | Generate the string of this enum type. |
addField(options)
public addField(options: AddFieldOptions): void
Parameters
- options
Add
— the options to add a field.Field Options
Add a field to this Enum Type.
To add a field to this Enum Type, you must only configure addField with the fieldName options.
attribute(options?)
public attribute(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
Type Options
Returns
Create an GraphQL Type representing this Enum Type.
toString()
public toString(): string
Returns
string
Generate the string of this enum type.