ScheduleTargetBaseProps Struct
Base properties for a Schedule Target.
| Source | aws-scheduler-targets/lib/target.ts |
|---|---|
| Type last changed |
Example
ts
import * as sns from 'aws-cdk-lib/aws-sns';
const topic = new sns.Topic(this, 'Topic');
const payload = {
message: 'Hello scheduler!',
};
const target = new targets.SnsPublish(topic, {
input: ScheduleTargetInput.fromObject(payload),
});
new Schedule(this, 'Schedule', {
schedule: ScheduleExpression.rate(Duration.hours(1)),
target,
});
python
import aws_cdk.aws_sns as sns
topic = sns.Topic(self, "Topic")
payload = {
"message": "Hello scheduler!"
}
target = targets.SnsPublish(topic,
input=ScheduleTargetInput.from_object(payload)
)
Schedule(self, "Schedule",
schedule=ScheduleExpression.rate(Duration.hours(1)),
target=target
)
java
import software.amazon.awscdk.services.sns.*;
Topic topic = new Topic(this, "Topic");
Map<String, String> payload = Map.of(
"message", "Hello scheduler!");
SnsPublish target = SnsPublish.Builder.create(topic)
.input(ScheduleTargetInput.fromObject(payload))
.build();
Schedule.Builder.create(this, "Schedule")
.schedule(ScheduleExpression.rate(Duration.hours(1)))
.target(target)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.SNS;
var topic = new Topic(this, "Topic");
IDictionary<string, string> payload = new Dictionary<string, string> {
{ "message", "Hello scheduler!" }
};
var target = new SnsPublish(topic, new ScheduleTargetBaseProps {
Input = ScheduleTargetInput.FromObject(payload)
});
new Schedule(this, "Schedule", new ScheduleProps {
Schedule = ScheduleExpression.Rate(Duration.Hours(1)),
Target = target
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import sns "github.com/aws/aws-cdk-go/awscdk"
topic := sns.NewTopic(this, jsii.String("Topic"))
payload := map[string]*string{
"message": jsii.String("Hello scheduler!"),
}
target := targets.NewSnsPublish(topic, &ScheduleTargetBaseProps{
Input: awscdk.ScheduleTargetInput_FromObject(payload),
})
awscdk.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
Schedule: awscdk.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(1))),
Target: Target,
})
Properties
deadLetterQueueoptionalIQueuedead_letter_queueoptionalIQueuedeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueueDeadLetterQueueoptionalIQueue #The SQS queue to be used as deadLetterQueue.
Default: no dead-letter queue
notes
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.
inputoptionalScheduleTargetInputinputoptionalScheduleTargetInputinputoptionalScheduleTargetInputInputoptionalScheduleTargetInputInputoptionalScheduleTargetInput #Input passed to the target.
Default: no input.
maxEventAgeoptionalDurationmax_event_ageoptionalDurationmaxEventAgeoptionalDurationMaxEventAgeoptionalDurationMaxEventAgeoptionalDuration = Duration.hours(24) #The maximum age of a request that Scheduler sends to a target for processing.
Minimum value of 60. Maximum value of 86400.
retryAttemptsoptionalnumberretry_attemptsoptionalint | floatretryAttemptsoptionalNumberRetryAttemptsoptionaldoubleRetryAttemptsoptional*float64 = 185 #The maximum number of times to retry when the target returns an error.
Minimum value of 0. Maximum value of 185.
An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
Default: created by target
notes
If none provided templates target will automatically create an IAM role with all the minimum necessary permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets will grant minimal required permissions.