class Directive
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AppSync.Directive |
Java | software.amazon.awscdk.services.appsync.Directive |
Python | aws_cdk.aws_appsync.Directive |
TypeScript (source) | @aws-cdk/aws-appsync » Directive |
Directives for types.
i.e. @aws_iam or @aws_subscribe
Example
declare const api: appsync.GraphqlApi;
declare const film: appsync.InterfaceType;
api.addSubscription('addedFilm', new appsync.Field({
returnType: film.attribute(),
args: { id: appsync.GraphqlType.id({ isRequired: true }) },
directives: [appsync.Directive.subscribe('addFilm')],
}));
Properties
| Name | Type | Description |
|---|---|---|
| mode? | Authorization | The authorization type of this directive. |
| modes? | Authorization[] | the authorization modes for this intermediate type. |
| mutation | string[] | Mutation fields for a subscription directive. |
mode?
Type:
Authorization
(optional, default: not an authorization directive)
The authorization type of this directive.
modes?
Type:
Authorization[]
(optional)
the authorization modes for this intermediate type.
mutationFields?
Type:
string[]
(optional, default: not a subscription directive)
Mutation fields for a subscription directive.
Methods
| Name | Description |
|---|---|
| to | Generate the directive statement. |
| static api | Add the @aws_api_key directive. |
| static cognito(...groups) | Add the @aws_auth or @aws_cognito_user_pools directive. |
| static custom(statement) | Add a custom directive. |
| static iam() | Add the @aws_iam directive. |
| static oidc() | Add the @aws_oidc directive. |
| static subscribe(...mutations) | Add the @aws_subscribe directive. |
toString()
public toString(): string
Returns
string
Generate the directive statement.
static apiKey()
public static apiKey(): Directive
Returns
Add the @aws_api_key directive.
static cognito(...groups)
public static cognito(...groups: string[]): Directive
Parameters
- groups
string— the groups to allow access to.
Returns
Add the @aws_auth or @aws_cognito_user_pools directive.
static custom(statement)
public static custom(statement: string): Directive
Parameters
- statement
string— - the directive statement to append.
Returns
Add a custom directive.
static iam()
public static iam(): Directive
Returns
Add the @aws_iam directive.
static oidc()
public static oidc(): Directive
Returns
Add the @aws_oidc directive.
static subscribe(...mutations)
public static subscribe(...mutations: string[]): Directive
Parameters
- mutations
string— the mutation fields to link to.
Returns
Add the @aws_subscribe directive.
Only use for top level Subscription type.

.NET
Java
Python
TypeScript (