.net 如何使用dotnet core在AWS事件桥调度程序中创建事件?

xt0899hw  于 2023-05-02  发布在  .NET
关注(0)|答案(1)|浏览(149)

我必须在特定的时间安排事件,我使用aws-eventbridge-scheduler用于此目的,Amazon中有nugget包。调度程序,它提供了sdk处理调度事件,但诺奥适当的例子,如果有人知道如何做到这一点,请让我知道。

ru9i0ody

ru9i0ody1#

CreateScheduleAsync操作看起来像这样:

var scheduleResult = await scheduler.CreateScheduleAsync(new CreateScheduleRequest
    {
        Name = "test schedule",
        ScheduleExpression = "at(yyyy-mm-ddThh:mm:ss)",  // for a one-time schedule.
        ScheduleExpressionTimezone = "America/Los_Angeles", // specify the timezone
        State = ScheduleState.ENABLED,
        FlexibleTimeWindow = new FlexibleTimeWindow{Mode = FlexibleTimeWindowMode.OFF},
        Target = new Target
        {
            Arn = "ARN of the target, such as a Queue",
            RoleArn = "ARN of the IAM role to use for the target",
            Input = "Test payload here"
        }
    });

您的参数可能会有所不同,但有一个很好的guide on the parameters here,并按计划表达式在这里。

相关问题