Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isJavaSERequiredPortConfigured(appSettings)) {
return undefined;
}
// tslint:disable-next-line:strict-boolean-expressions
appSettings.properties = appSettings.properties || {};
const port: string = await ext.ui.showInputBox({
value: DEFAULT_PORT,
prompt: 'Configure the PORT (Application Settings) which your Java SE Web App exposes',
placeHolder: 'PORT',
validateInput: (input: string): string | undefined => {
return /^[0-9]+$/.test(input) ? undefined : 'please specify a valid port number';
}
});
if (!port) {
throw new UserCancelledError();
}
appSettings.properties[PORT_KEY] = port;
return siteClient.updateApplicationSettings(appSettings);
}
}
{
location: locationPick.location.name,
locations: [{ locationName: locationPick.location.name }],
kind: apiPick.kind,
tags: { defaultExperience: apiPick.defaultExperience }
});
// createOrUpdate always returns an empty object - so we have to get the DatabaseAccount separately
return await docDBClient.databaseAccounts.get(resourceGroupPick.resourceGroup.name, accountName);
});
}
}
}
}
throw new UserCancelledError();
}
if (baseName !== mongoExecutableFileName) {
const useAnyway: vscode.MessageItem = { title: 'Use anyway' };
const tryAgain: vscode.MessageItem = { title: 'Try again' };
let response2 = await ext.ui.showWarningMessage(
`Expected a file named "${mongoExecutableFileName}, but the selected filename is "${baseName}"`,
useAnyway,
tryAgain);
if (response2 === tryAgain) {
continue;
}
}
await vscode.workspace.getConfiguration().update(ext.settingsKeys.mongoShellPath, fsPath, vscode.ConfigurationTarget.Global);
return fsPath;
} else {
throw new UserCancelledError();
}
}
} else if (response === browse) {
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://docs.mongodb.com/manual/installation/'));
// default down to cancel error because MongoShell.create errors out if undefined is passed as the shellPath
}
throw new UserCancelledError();
}
} else {
// User has specified the path or command. Sometimes they set the folder instead of a path to the file, let's check that and auto fix
if (await fse.pathExists(shellPathSetting)) {
let stat = await fse.stat(shellPathSetting);
if (stat.isDirectory()) {
return path.join(shellPathSetting, mongoExecutableFileName);
}
return localize("azLogicApps.nameTooLong", "The name has a maximum length of 80 characters.");
} else if (!/^[0-9a-zA-Z-_.()]+$/.test(name)) {
return localize("azLogicApps.nameContainsInvalidCharacters", "The name can only contain letters, numbers, and '-', '(', ')', '_', or '.'");
} else if (!await this.isNameAvailable(name, wizardContext)) {
return localize("azLogicApps.nameAlreadyInUse", "The name is already in use.");
} else {
return undefined;
}
}
};
const workflowName = await vscode.window.showInputBox(options);
if (workflowName !== undefined) {
wizardContext.workflowName = workflowName.trim();
} else {
throw new UserCancelledError();
}
return wizardContext;
}
}
showCreatingNode(docID);
const document: RetrievedDocument = await new Promise((resolve, reject) => {
client.createDocument(this.link, body, (err, result: RetrievedDocument) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
return this.initChild(document);
}
throw new UserCancelledError();
}
public async deleteTreeItemImpl(): Promise {
const message: string = `Are you sure you want to delete database '${this.label}'?`;
const result = await vscode.window.showWarningMessage(message, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);
if (result === DialogResponses.deleteResponse) {
const db = await this.connectToDb();
await db.dropDatabase();
} else {
throw new UserCancelledError();
}
}
const locationPick = await vscode.window.showQuickPick(
getLocationQuickPicks(subscriptionNode),
{ placeHolder: "Select a location to create your Resource Group in...", ignoreFocusOut: true }
);
if (locationPick) {
return vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, async (progress) => {
progress.report({ message: `Cosmos DB: Creating resource group '${resourceGroupName}'` });
const resourceManagementClient = new ResourceManagementClient(subscriptionNode.credentials, subscriptionNode.subscription.subscriptionId);
return resourceManagementClient.resourceGroups.createOrUpdate(resourceGroupName, { location: locationPick.location.name });
});
} else {
throw new UserCancelledError();
}
} else {
throw new UserCancelledError();
}
}
return localize("azIntegrationAccounts.nameContainsInvalidCharacters", "The name can only contain letters, numbers, and '-', '(', ')', '_', or '.'");
} else if (!await this.isNameAvailable(name, wizardContext)) {
return localize("azIntegrationAccounts.nameAlreadyInUse", "The name is already in use.");
} else {
return undefined;
}
}
};
const partnerName = await vscode.window.showInputBox(options);
if (partnerName) {
wizardContext.partnerName = partnerName.trim();
return wizardContext;
}
throw new UserCancelledError();
}
public async deleteTreeItemImpl(): Promise {
const message: string = `Are you sure you want to delete collection '${this.label}' and its contents?`;
const result = await vscode.window.showWarningMessage(message, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);
if (result === DialogResponses.deleteResponse) {
const client = this.root.getDocumentClient();
await new Promise((resolve, reject) => {
client.deleteCollection(this.link, err => err ? reject(err) : resolve());
});
} else {
throw new UserCancelledError();
}
}
public async deleteTreeItemImpl(): Promise {
const message: string = `Are you sure you want to delete stored procedure '${this.label}'?`;
const result = await vscode.window.showWarningMessage(message, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);
if (result === DialogResponses.deleteResponse) {
const client = this.root.getDocumentClient();
await new Promise((resolve, reject) => {
client.deleteStoredProcedure(this.link, err => err ? reject(err) : resolve());
});
} else {
throw new UserCancelledError();
}
}
}