Skip to content

Commit

Permalink
Add schedule example
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Jun 9, 2024
1 parent e4c4cac commit ee329ea
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import path from 'path'
import { createExamples } from '@meltwater/examplr'

import { invoke } from './invoke.js'
import * as schedule from './schedule.js'

process.env.AWS_SDK_LOAD_CONFIG = 'true'

const examples = {
invoke
invoke,
...schedule
}

const envVars = ['LOG_LEVEL', 'LOG_FILTER', 'LOG_OUTPUT_MODE']
Expand Down
37 changes: 37 additions & 0 deletions examples/schedule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { SchedulerClient } from '../index.js'

export const createSchedule =
({ log }) =>
async (scheduleName) => {
const client = new SchedulerClient({
log
})
return client.createSchedule(scheduleName, {})
}

export const deleteSchedule =
({ log }) =>
async (scheduleName) => {
const client = new SchedulerClient({
log
})
return client.deleteSchedule(scheduleName)
}

export const updateSchedule =
({ log }) =>
async (scheduleName) => {
const client = new SchedulerClient({
log
})
return client.updateSchedule(scheduleName, {})
}

export const getSchedule =
({ log }) =>
async (scheduleName) => {
const client = new SchedulerClient({
log
})
return client.getSchedule(scheduleName)
}
1 change: 1 addition & 0 deletions lib/clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './dynamodb-document.js'
export * from './eventbridge.js'
export * from './lambda.js'
export * from './s3.js'
export * from './scheduler.js'
export * from './sqs.js'

0 comments on commit ee329ea

Please sign in to comment.