import { sdk } from '../sdk' import { sparkConfigYaml } from '../fileModels/sparkConfig.yaml' const { InputSpec, Value } = sdk const inputSpec = InputSpec.of({ spark1_host: Value.text({ name: 'Spark 1 hostname or IP', description: 'Head node. Example: ', required: true, default: null, placeholder: '', masked: false, }), spark1_user: Value.text({ name: 'Spark 1 SSH user', description: 'Usually "".', required: true, default: '', placeholder: '', masked: false, }), spark2_host: Value.text({ name: 'Spark 2 hostname or IP', description: 'Worker node. Example: ', required: true, default: null, placeholder: '', masked: false, }), spark2_user: Value.text({ name: 'Spark 2 SSH user', description: 'Usually "".', required: true, default: '', placeholder: '', masked: false, }), }) export const configureSparks = sdk.Action.withInput( 'configure-sparks', async () => ({ name: 'Configure Sparks', description: 'Set the hostnames and SSH users for your two Spark nodes.', warning: null, visibility: 'enabled', allowedStatuses: 'any', group: null, }), async () => inputSpec, async ({ effects }) => { const cfg = await sparkConfigYaml.read().once() return cfg ?? null }, async ({ effects, input }) => { await sparkConfigYaml.merge(effects, input) return null }, )