AuthorizationConfig

class aws_cdk.aws_appsync.AuthorizationConfig(*, additional_authorization_modes=None, default_authorization=None)

Bases: object

Configuration of the API authorization modes.

Parameters:
  • additional_authorization_modes (Optional[Sequence[Union[AuthorizationMode, Dict[str, Any]]]]) – Additional authorization modes. Default: - No other modes

  • default_authorization (Union[AuthorizationMode, Dict[str, Any], None]) – Optional authorization configuration. Default: - API Key authorization

ExampleMetadata:

infused

Example:

import aws_cdk.aws_appsync as appsync


api = appsync.GraphqlApi(self, "api",
    name="api",
    definition=appsync.Definition.from_file("schema.graphql"),
    authorization_config=appsync.AuthorizationConfig(
        default_authorization=appsync.AuthorizationMode(authorization_type=appsync.AuthorizationType.IAM)
    )
)

rule = events.Rule(self, "Rule",
    schedule=events.Schedule.rate(cdk.Duration.hours(1))
)

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

Attributes

additional_authorization_modes

Additional authorization modes.

Default:
  • No other modes

default_authorization

Optional authorization configuration.

Default:
  • API Key authorization