mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
* feat(cloudformation): add AWS CloudFormation integration with 7 operations * fix(cloudformation): add pagination to list-stack-resources, describe-stacks, and describe-stack-events routes
78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import type {
|
|
CloudFormationGetTemplateParams,
|
|
CloudFormationGetTemplateResponse,
|
|
} from '@/tools/cloudformation/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const getTemplateTool: ToolConfig<
|
|
CloudFormationGetTemplateParams,
|
|
CloudFormationGetTemplateResponse
|
|
> = {
|
|
id: 'cloudformation_get_template',
|
|
name: 'CloudFormation Get Template',
|
|
description: 'Retrieve the template body for a CloudFormation stack',
|
|
version: '1.0',
|
|
|
|
params: {
|
|
awsRegion: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'AWS region (e.g., us-east-1)',
|
|
},
|
|
awsAccessKeyId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'AWS access key ID',
|
|
},
|
|
awsSecretAccessKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'AWS secret access key',
|
|
},
|
|
stackName: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Stack name or ID',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: '/api/tools/cloudformation/get-template',
|
|
method: 'POST',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
body: (params) => ({
|
|
region: params.awsRegion,
|
|
accessKeyId: params.awsAccessKeyId,
|
|
secretAccessKey: params.awsSecretAccessKey,
|
|
stackName: params.stackName,
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!response.ok) {
|
|
throw new Error(data.error || 'Failed to get CloudFormation template')
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
templateBody: data.output.templateBody,
|
|
stagesAvailable: data.output.stagesAvailable,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
templateBody: { type: 'string', description: 'The template body as a JSON or YAML string' },
|
|
stagesAvailable: { type: 'array', description: 'Available template stages' },
|
|
},
|
|
}
|