Class EventBridgeSchedulerTarget
The target that EventBridge Scheduler will invoke.
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class EventBridgeSchedulerTarget : DeputyBase
Syntax (vb)
Public Class EventBridgeSchedulerTarget Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Scheduler;
using Amazon.CDK.AWS.KMS;
Key key;
CfnScheduleGroup scheduleGroup;
Queue targetQueue;
Queue deadLetterQueue;
var schedulerRole = new Role(this, "SchedulerRole", new RoleProps {
AssumedBy = new ServicePrincipal("scheduler.amazonaws.com")
});
// To send the message to the queue
// This policy changes depending on the type of target.
schedulerRole.AddToPrincipalPolicy(new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "sqs:SendMessage" },
Resources = new [] { targetQueue.QueueArn }
}));
var createScheduleTask1 = new EventBridgeSchedulerCreateScheduleTask(this, "createSchedule", new EventBridgeSchedulerCreateScheduleTaskProps {
ScheduleName = "TestSchedule",
ActionAfterCompletion = ActionAfterCompletion.NONE,
ClientToken = "testToken",
Description = "TestDescription",
StartDate = new Date(),
EndDate = new Date(new Date().GetTime() + 1000 * 60 * 60),
FlexibleTimeWindow = Duration.Minutes(5),
GroupName = scheduleGroup.Ref,
KmsKey = key,
Schedule = Schedule.Rate(Duration.Minutes(5)),
Timezone = "UTC",
Enabled = true,
Target = new EventBridgeSchedulerTarget(new EventBridgeSchedulerTargetProps {
Arn = targetQueue.QueueArn,
Role = schedulerRole,
RetryPolicy = new RetryPolicy {
MaximumRetryAttempts = 2,
MaximumEventAge = Duration.Minutes(5)
},
DeadLetterQueue = deadLetterQueue
})
});
Synopsis
Constructors
| EventBridgeSchedulerTarget(IEventBridgeSchedulerTargetProps) | The target that EventBridge Scheduler will invoke. |
Properties
| Arn | The Amazon Resource Name (ARN) of the target. |
| DeadLetterQueue | Dead letter queue for failed events. |
| Input | The input to the target. |
| RetryPolicy | The retry policy settings. |
| Role | The IAM role that EventBridge Scheduler will use for this target when the schedule is invoked. |
Methods
| RenderTargetObject() | return the target object for the EventBridge Scheduler. |
Constructors
EventBridgeSchedulerTarget(IEventBridgeSchedulerTargetProps)
The target that EventBridge Scheduler will invoke.
public EventBridgeSchedulerTarget(IEventBridgeSchedulerTargetProps props)
Parameters
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Scheduler;
using Amazon.CDK.AWS.KMS;
Key key;
CfnScheduleGroup scheduleGroup;
Queue targetQueue;
Queue deadLetterQueue;
var schedulerRole = new Role(this, "SchedulerRole", new RoleProps {
AssumedBy = new ServicePrincipal("scheduler.amazonaws.com")
});
// To send the message to the queue
// This policy changes depending on the type of target.
schedulerRole.AddToPrincipalPolicy(new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "sqs:SendMessage" },
Resources = new [] { targetQueue.QueueArn }
}));
var createScheduleTask1 = new EventBridgeSchedulerCreateScheduleTask(this, "createSchedule", new EventBridgeSchedulerCreateScheduleTaskProps {
ScheduleName = "TestSchedule",
ActionAfterCompletion = ActionAfterCompletion.NONE,
ClientToken = "testToken",
Description = "TestDescription",
StartDate = new Date(),
EndDate = new Date(new Date().GetTime() + 1000 * 60 * 60),
FlexibleTimeWindow = Duration.Minutes(5),
GroupName = scheduleGroup.Ref,
KmsKey = key,
Schedule = Schedule.Rate(Duration.Minutes(5)),
Timezone = "UTC",
Enabled = true,
Target = new EventBridgeSchedulerTarget(new EventBridgeSchedulerTargetProps {
Arn = targetQueue.QueueArn,
Role = schedulerRole,
RetryPolicy = new RetryPolicy {
MaximumRetryAttempts = 2,
MaximumEventAge = Duration.Minutes(5)
},
DeadLetterQueue = deadLetterQueue
})
});
Properties
Arn
The Amazon Resource Name (ARN) of the target.
public virtual string Arn { get; set; }
Property Value
Remarks
ExampleMetadata: infused
DeadLetterQueue
Dead letter queue for failed events.
public virtual IQueue? DeadLetterQueue { get; set; }
Property Value
Remarks
ExampleMetadata: infused
Input
The input to the target.
public virtual string? Input { get; set; }
Property Value
Remarks
ExampleMetadata: infused
RetryPolicy
The retry policy settings.
public virtual IRetryPolicy? RetryPolicy { get; set; }
Property Value
Remarks
ExampleMetadata: infused
Role
The IAM role that EventBridge Scheduler will use for this target when the schedule is invoked.
public virtual IRole Role { get; set; }
Property Value
Remarks
ExampleMetadata: infused
Methods
RenderTargetObject()
return the target object for the EventBridge Scheduler.
public virtual object RenderTargetObject()
Returns
Remarks
ExampleMetadata: infused