interface AppSyncGraphQLApiProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Targets.AppSyncGraphQLApiProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#AppSyncGraphQLApiProps |
![]() | software.amazon.awscdk.services.events.targets.AppSyncGraphQLApiProps |
![]() | aws_cdk.aws_events_targets.AppSyncGraphQLApiProps |
![]() | aws-cdk-lib » aws_events_targets » AppSyncGraphQLApiProps |
Customize the AppSync GraphQL API target.
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',
}),
}));
Properties
Name | Type | Description |
---|---|---|
graph | string | The GraphQL operation; |
dead | IQueue | The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue. |
event | IRole | The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered. |
max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
retry | number | The maximum number of times to retry when the function returns an error. |
variables? | Rule | The variables that are include in the GraphQL operation. |
graphQLOperation
Type:
string
The GraphQL operation;
that is, the query, mutation, or subscription to be parsed and executed by the GraphQL service.
deadLetterQueue?
Type:
IQueue
(optional, default: no dead-letter queue)
The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
eventRole?
Type:
IRole
(optional, default: a new role with permissions to access mutations will be created)
The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered.
maxEventAge?
Type:
Duration
(optional, default: Duration.hours(24))
The maximum age of a request that Lambda sends to a function for processing.
Minimum value of 60. Maximum value of 86400.
retryAttempts?
Type:
number
(optional, default: 185)
The maximum number of times to retry when the function returns an error.
Minimum value of 0. Maximum value of 185.
variables?
Type:
Rule
(optional, default: The entire event is used)
The variables that are include in the GraphQL operation.