class AppSync
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.Targets.AppSync |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#AppSync |
Java | software.amazon.awscdk.services.events.targets.AppSync |
Python | aws_cdk.aws_events_targets.AppSync |
TypeScript (source) | aws-cdk-lib » aws_events_targets » AppSync |
Implements
IRule
Use an AppSync GraphQL API as a target for Amazon EventBridge rules.
Example
import * as appsync from 'aws-cdk-lib/aws-appsync';
const api = new appsync.GraphqlApi(this, 'api', {
name: 'api',
definition: appsync.Definition.fromFile('schema.graphql'),
authorizationConfig: {
defaultAuthorization: { authorizationType: appsync.AuthorizationType.IAM }
},
});
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
rule.addTarget(new targets.AppSync(api, {
graphQLOperation: 'mutation Publish($message: String!){ publish(message: $message) { message } }',
variables: events.RuleTargetInput.fromObject({
message: 'hello world',
}),
}));
Initializer
new AppSync(appsyncApi: IGraphqlApi, props: AppSyncGraphQLApiProps)
Parameters
- appsyncApi
IGraphql
Api - props
App
Sync Graph QLApi Props
Methods
Name | Description |
---|---|
bind(rule, _id?) | Returns a RuleTarget that can be used to trigger this AppSync GraphQL API as a result from an EventBridge event. |
bind(rule, _id?)
public bind(rule: IRule, _id?: string): RuleTargetConfig
Parameters
- rule
IRule
- _id
string
Returns
Returns a RuleTarget that can be used to trigger this AppSync GraphQL API as a result from an EventBridge event.