AuthorizationType

class aws_cdk.aws_appsync.AuthorizationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

enum with all possible values for AppSync authorization type.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_iam as iam
import aws_cdk.aws_appsync as appsync


api = appsync.GraphqlApi.from_graphql_api_attributes(self, "ImportedAPI",
    graphql_api_id="<api-id>",
    graphql_api_arn="<api-arn>",
    graph_qLEndpoint_arn="<api-endpoint-arn>",
    visibility=appsync.Visibility.GLOBAL,
    modes=[appsync.AuthorizationType.IAM]
)

rule = events.Rule(self, "Rule", schedule=events.Schedule.rate(cdk.Duration.minutes(1)))
role = iam.Role(self, "Role", assumed_by=iam.ServicePrincipal("events.amazonaws.com"))

# allow EventBridge to use the `publish` mutation
api.grant_mutation(role, "publish")

rule.add_target(targets.AppSync(api,
    graph_qLOperation="mutation Publish($message: String!){ publish(message: $message) { message } }",
    variables=events.RuleTargetInput.from_object({
        "message": "hello world"
    }),
    event_role=role
))

Attributes

API_KEY

API Key authorization type.

IAM

AWS IAM authorization type.

Can be used with Cognito Identity Pool federated credentials

LAMBDA

Lambda authorization type.

OIDC

OpenID Connect authorization type.

USER_POOL

Cognito User Pool authorization type.