diff --git a/examples/schedule.js b/examples/schedule.js index 889d4ce..0868075 100644 --- a/examples/schedule.js +++ b/examples/schedule.js @@ -2,7 +2,7 @@ import { SchedulerClient } from '../index.js' export const createSchedule = ({ log }) => - async (scheduleName, arn, roleArn) => { + async (scheduleName, groupName, arn, roleArn) => { const client = new SchedulerClient({ log }) @@ -10,6 +10,7 @@ export const createSchedule = scheduleExpression: 'rate(1 minute)', flexibleTimeWindow: { mode: 'OFF' }, input: { foo: 'bar' }, + groupName, target: { arn, roleArn, @@ -23,27 +24,30 @@ export const createSchedule = export const deleteSchedule = ({ log }) => - async (scheduleName) => { + async (scheduleName, groupName) => { const client = new SchedulerClient({ log }) - return client.deleteSchedule(scheduleName) + return client.deleteSchedule(scheduleName, { groupName }) } export const updateSchedule = ({ log }) => - async (scheduleName) => { + async (scheduleName, groupName) => { const client = new SchedulerClient({ log }) - return client.updateSchedule(scheduleName, {}) + return client.updateSchedule(scheduleName, { + scheduleExpression: 'rate(2 minute)', + groupName + }) } export const getSchedule = ({ log }) => - async (scheduleName) => { + async (scheduleName, groupName) => { const client = new SchedulerClient({ log }) - return client.getSchedule(scheduleName) + return client.getSchedule(scheduleName, { groupName }) } diff --git a/lib/clients/scheduler.js b/lib/clients/scheduler.js index c9eb0bb..bd6b2a2 100644 --- a/lib/clients/scheduler.js +++ b/lib/clients/scheduler.js @@ -101,7 +101,7 @@ export class SchedulerClient { }) try { log.info('start') - const req = formatReq({ name: scheduleName }) + const req = formatReq({ ...params, name: scheduleName }) const command = new DeleteScheduleCommand(req) const res = await this.#client.send(command) @@ -125,7 +125,9 @@ export class SchedulerClient { }) try { log.info('start') - const schedule = await this.getSchedule(scheduleName) + const schedule = await this.getSchedule(scheduleName, { + groupName: params.groupName + }) const req = formatReq({ ...schedule, ...params, name: scheduleName }) const command = new UpdateScheduleCommand(req)