Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function create (params) {
const [drainTargetType, drainTargetURL] = params.args;
const { alias, username, password, 'api-key': apiKey } = params.options;
const drainTargetCredentials = { username, password };
const drainTargetConfig = { apiKey };
const { app_id: appId } = await AppConfig.getAppData(alias).toPromise();
const body = createDrainBody(appId, drainTargetURL, drainTargetType, drainTargetCredentials, drainTargetConfig);
await createDrain({ appId }, body).then(sendToApi);
Logger.println('Your drain has been successfully saved');
}