feat: MSK, MSK CONNECT and SES
This commit is contained in:
@@ -963,6 +963,64 @@ export function createCloudRoutes(injectedService?: CloudProxyService) {
|
||||
})
|
||||
})
|
||||
|
||||
app.post('/:cloud/services/kinesis/resources/:id/records', async (c) => {
|
||||
const cloud = c.req.param('cloud') as CloudProvider
|
||||
if (cloud !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => {
|
||||
const input = await jsonBody<{partitionKey?: unknown; data?: unknown}>(c)
|
||||
return c.json(await svc(c).putKinesisRecord(cloud, c.req.param('id'), {
|
||||
partitionKey: typeof input.partitionKey === 'string' ? input.partitionKey : '',
|
||||
data: typeof input.data === 'string' ? input.data : '',
|
||||
}), 201)
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/kinesis/resources/:id/records', async (c) => {
|
||||
const cloud = c.req.param('cloud') as CloudProvider
|
||||
if (cloud !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => c.json(await svc(c).listKinesisRecords(cloud, c.req.param('id'))))
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/serverless/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)
|
||||
return withRuntime(c, async () => c.json(await svc(c).listLambdaEventSourceMappings(cloud, {
|
||||
functionName: c.req.query('functionName'), eventSourceArn: c.req.query('eventSourceArn'),
|
||||
})))
|
||||
})
|
||||
|
||||
app.post('/:cloud/services/serverless/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)
|
||||
return withRuntime(c, async () => {
|
||||
const input = await jsonBody<{functionName?: unknown; eventSourceArn?: unknown; batchSize?: unknown; startingPosition?: unknown}>(c)
|
||||
return c.json(await svc(c).createLambdaEventSourceMapping(cloud, {
|
||||
functionName: typeof input.functionName === 'string' ? input.functionName : '',
|
||||
eventSourceArn: typeof input.eventSourceArn === 'string' ? input.eventSourceArn : '',
|
||||
batchSize: typeof input.batchSize === 'number' ? input.batchSize : undefined,
|
||||
startingPosition: input.startingPosition === 'TRIM_HORIZON' || input.startingPosition === 'LATEST' ? input.startingPosition : undefined,
|
||||
}), 201)
|
||||
})
|
||||
})
|
||||
|
||||
app.patch('/:cloud/services/serverless/event-source-mappings/:mappingId', async (c) => {
|
||||
const cloud = c.req.param('cloud') as CloudProvider
|
||||
if (cloud !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => {
|
||||
const input = await jsonBody<{batchSize?: unknown; enabled?: unknown}>(c)
|
||||
return c.json(await svc(c).updateLambdaEventSourceMapping(cloud, c.req.param('mappingId'), {
|
||||
batchSize: typeof input.batchSize === 'number' ? input.batchSize : undefined,
|
||||
enabled: typeof input.enabled === 'boolean' ? input.enabled : undefined,
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
app.delete('/:cloud/services/serverless/event-source-mappings/:mappingId', async (c) => {
|
||||
const cloud = c.req.param('cloud') as CloudProvider
|
||||
if (cloud !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => { await svc(c).deleteLambdaEventSourceMapping(cloud, c.req.param('mappingId')); return c.json({ok: true}) })
|
||||
})
|
||||
|
||||
app.get('/:cloud/services/:service/resources/:id/collections', async (c) => {
|
||||
const target = childTarget(c)
|
||||
if (!target) return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
|
||||
Reference in New Issue
Block a user