feat: Step Function + hardning
This commit is contained in:
@@ -729,6 +729,44 @@ export function createCloudRoutes(injectedService?: CloudProxyService) {
|
||||
})
|
||||
})
|
||||
|
||||
app.post('/:cloud/services/workflows/resources/:id/executions', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => {
|
||||
const body = await jsonBody<{input?: unknown; name?: unknown}>(c)
|
||||
if (typeof body.input !== 'string') throw new ValidationError('input must be a JSON string')
|
||||
try {
|
||||
JSON.parse(body.input)
|
||||
} catch {
|
||||
throw new ValidationError('input must be valid JSON')
|
||||
}
|
||||
if (body.name !== undefined && (typeof body.name !== 'string' || !body.name.trim())) throw new ValidationError('name must be a non-empty string')
|
||||
return c.json(await svc(c).startWorkflowExecution('aws', c.req.param('id'), {input: body.input, ...(typeof body.name === 'string' ? {name: body.name} : {})}), 201)
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/workflows/resources/:id/executions', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => c.json(await svc(c).listWorkflowExecutions('aws', c.req.param('id'))))
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/workflows/resources/:id/executions/:executionArn', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => c.json(await svc(c).describeWorkflowExecution('aws', c.req.param('executionArn'))))
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/workflows/resources/:id/executions/:executionArn/history', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => c.json(await svc(c).getWorkflowExecutionHistory('aws', c.req.param('executionArn'), c.req.query('nextToken'))))
|
||||
})
|
||||
|
||||
app.post('/:cloud/services/workflows/resources/:id/executions/:executionArn/stop', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => {
|
||||
await svc(c).stopWorkflowExecution('aws', c.req.param('executionArn'))
|
||||
return c.json({ok: true})
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/serverless/resources/:id/sqs-event-source-mappings', async (c) => {
|
||||
const cloud = c.req.param('cloud') as CloudProvider
|
||||
if (cloud !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
|
||||
Reference in New Issue
Block a user