File tree Expand file tree Collapse file tree 2 files changed +55
-4
lines changed Expand file tree Collapse file tree 2 files changed +55
-4
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,23 @@ import { SchedulerClient } from '../index.js'
2
2
3
3
export const createSchedule =
4
4
( { log } ) =>
5
- async ( scheduleName ) => {
5
+ async ( scheduleName , arn , roleArn ) => {
6
6
const client = new SchedulerClient ( {
7
7
log
8
8
} )
9
- return client . createSchedule ( scheduleName , { } )
9
+ return client . createSchedule ( scheduleName , {
10
+ scheduleExpression : 'rate(1 minute)' ,
11
+ flexibleTimeWindow : { mode : 'OFF' } ,
12
+ input : { foo : 'bar' } ,
13
+ target : {
14
+ arn,
15
+ roleArn,
16
+ eventBridgeParameters : {
17
+ detailType : 'example' ,
18
+ source : 'example'
19
+ }
20
+ }
21
+ } )
10
22
}
11
23
12
24
export const deleteSchedule =
Original file line number Diff line number Diff line change @@ -7,6 +7,16 @@ import {
7
7
} from '@aws-sdk/client-scheduler'
8
8
import { v4 as uuidv4 } from 'uuid'
9
9
import { createLogger } from '@meltwater/mlabs-logger'
10
+ import {
11
+ has ,
12
+ identity ,
13
+ ifElse ,
14
+ isObjLike ,
15
+ isObjectLike ,
16
+ map ,
17
+ mapPath ,
18
+ pipe
19
+ } from '@meltwater/phi'
10
20
11
21
import { createCache } from '../cache.js'
12
22
import { keysToCamelCase , keysToPascalCase } from '../case.js'
@@ -134,5 +144,34 @@ export class SchedulerClient {
134
144
}
135
145
}
136
146
137
- const formatReq = keysToPascalCase
138
- const formatRes = keysToCamelCase
147
+ const formatReq = pipe (
148
+ keysToPascalCase ,
149
+ map ( ifElse ( isObjectLike , keysToPascalCase , identity ) ) ,
150
+ ifElse (
151
+ has ( 'Target' ) ,
152
+ mapPath (
153
+ [ 'Target' ] ,
154
+ pipe (
155
+ keysToPascalCase ,
156
+ map ( ifElse ( isObjectLike , keysToPascalCase , identity ) )
157
+ )
158
+ ) ,
159
+ identity
160
+ )
161
+ )
162
+
163
+ const formatRes = pipe (
164
+ keysToCamelCase ,
165
+ map ( ifElse ( isObjectLike , keysToCamelCase , identity ) ) ,
166
+ ifElse (
167
+ has ( 'Target' ) ,
168
+ mapPath (
169
+ [ 'Target' ] ,
170
+ pipe (
171
+ keysToCamelCase ,
172
+ map ( ifElse ( isObjectLike , keysToCamelCase , identity ) )
173
+ )
174
+ ) ,
175
+ identity
176
+ )
177
+ )
You can’t perform that action at this time.
0 commit comments