Directive

class aws_cdk.aws_appsync.Directive(*args: Any, **kwargs)

Bases: object

(experimental) Directives for types.

i.e. @aws_iam or @aws_subscribe

Stability:

experimental

ExampleMetadata:

infused

Example:

# api: appsync.GraphqlApi
# film: appsync.InterfaceType


api.add_subscription("addedFilm", appsync.Field(
    return_type=film.attribute(),
    args={"id": appsync.GraphqlType.id(is_required=True)},
    directives=[appsync.Directive.subscribe("addFilm")]
))

Methods

to_string()

(experimental) Generate the directive statement.

Stability:

experimental

Return type:

str

Attributes

mode

(experimental) The authorization type of this directive.

Default:
  • not an authorization directive

Stability:

experimental

mutation_fields

(experimental) Mutation fields for a subscription directive.

Default:
  • not a subscription directive

Stability:

experimental

Static Methods

classmethod api_key()

(experimental) Add the @aws_api_key directive.

Stability:

experimental

Return type:

Directive

classmethod cognito(*groups)

(experimental) Add the @aws_auth or @aws_cognito_user_pools directive.

Parameters:

groups (str) – the groups to allow access to.

Stability:

experimental

Return type:

Directive

classmethod custom(statement)

(experimental) Add a custom directive.

Parameters:

statement (str) –

  • the directive statement to append.

Stability:

experimental

Return type:

Directive

classmethod iam()

(experimental) Add the @aws_iam directive.

Stability:

experimental

Return type:

Directive

classmethod oidc()

(experimental) Add the @aws_oidc directive.

Stability:

experimental

Return type:

Directive

classmethod subscribe(*mutations)

(experimental) Add the @aws_subscribe directive.

Only use for top level Subscription type.

Parameters:

mutations (str) – the mutation fields to link to.

Stability:

experimental

Return type:

Directive