Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "vscode-azureextensionui in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'vscode-azureextensionui' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

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);
    }
}
data: undefined
        }];

        let plans: AppServicePlan[] = await AppServicePlanListStep.getPlans(wizardContext);
        const famFilter: RegExp | undefined = wizardContext.planSkuFamilyFilter;
        if (famFilter) {
            plans = plans.filter(plan => !plan.sku || !plan.sku.family || famFilter.test(plan.sku.family));
        }

        for (const plan of plans) {
            const isNewSiteLinux: boolean = wizardContext.newSiteOS === WebsiteOS.linux;
            let isPlanLinux: boolean = nonNullProp(plan, 'kind').toLowerCase().includes(WebsiteOS.linux);

            if (plan.sku && plan.sku.family === 'EP') {
                // elastic premium plans do not have the os in the kind, so we have to check the "reserved" property
                const client: WebSiteManagementClient = createAzureClient(wizardContext, WebSiteManagementClient);
                const epPlan: AppServicePlan = await client.appServicePlans.get(nonNullProp(plan, 'resourceGroup'), nonNullProp(plan, 'name'));
                isPlanLinux = !!epPlan.reserved;
            }

            // plan.kind will contain "linux" for Linux plans, but will _not_ contain "windows" for Windows plans. Thus we check "isLinux" for both cases
            if (isNewSiteLinux === isPlanLinux) {
                picks.push({
                    id: plan.id,
                    label: nonNullProp(plan, 'name'),
                    description: `${nonNullProp(plan, 'sku').name} (${plan.geoRegion})`,
                    detail: plan.resourceGroup,
                    data: plan
                });
            }
        }
export async function findTreeItem(query: TreeItemQuery): Promise {
    return await callWithTelemetryAndErrorHandling('api.findTreeItem', async (context: IActionContext) => {
        context.errorHandling.suppressDisplay = true;
        context.errorHandling.rethrow = true;

        const connectionString = query.connectionString;
        let parsedCS: ParsedConnectionString;
        if (/^mongodb[^:]*:\/\//i.test(connectionString)) {
            parsedCS = await parseMongoConnectionString(connectionString);
        } else {
            parsedCS = parseDocDBConnectionString(connectionString);
        }

        const maxTime = Date.now() + 10 * 1000; // Give up searching subscriptions after 10 seconds and just attach the account

        // 1. Get result from cache if possible
        let result: DatabaseAccountTreeItem | DatabaseTreeItem | undefined = tryGetTreeItemFromCache(parsedCS);
{
                                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);
				}
export async function deleteCosmosDBAccount(node: AzureTreeItem): Promise {
    const message: string = `Are you sure you want to delete account '${node.label}' and its contents?`;
    const result = await ext.ui.showWarningMessage(message, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);
    if (result === DialogResponses.deleteResponse) {
        const client: CosmosDBManagementClient = createAzureClient(node.root, CosmosDBManagementClient);
        const resourceGroup: string = azureUtils.getResourceGroupFromId(node.fullId);
        const accountName: string = azureUtils.getAccountNameFromId(node.fullId);
        const deletingMessage: string = `Deleting account "${accountName}"...`;
        await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: deletingMessage }, async () => {
            await client.databaseAccounts.deleteMethod(resourceGroup, accountName);
        });
        // don't wait
        vscode.window.showInformationMessage(`Successfully deleted account "${accountName}".`);
    } else {
        throw new UserCancelledError();
    }
}
export async function deleteSite(client: SiteClient): Promise {
    const confirmMessage: string = localize('deleteConfirmation', 'Are you sure you want to delete "{0}"?', client.fullName);
    await ext.ui.showWarningMessage(confirmMessage, { modal: true }, DialogResponses.deleteResponse, DialogResponses.cancel);

    let plan: AppServicePlan | undefined;
    let deletePlan: boolean = false;

    if (!client.isSlot) {
        // API calls not necessary for deployment slots
        plan = await client.getAppServicePlan();
    }

    if (!client.isSlot && plan && !isNullOrUndefined(plan.numberOfSites) && plan.numberOfSites < 2) {
        const message: string = localize('deleteLastServicePlan', 'This is the last app in the App Service plan "{0}". Do you want to delete this App Service plan to prevent unexpected charges?', plan.name);
        const input: vscode.MessageItem = await ext.ui.showWarningMessage(message, { modal: true }, DialogResponses.yes, DialogResponses.no, DialogResponses.cancel);
        deletePlan = input === DialogResponses.yes;
    }

    const deleting: string = localize('Deleting', 'Deleting "{0}"...', client.fullName);
const newSiteConfig: SiteConfig = {};
        let storageConnectionString: string | undefined;
        let fileShareName: string | undefined;

        if (wizardContext.newSiteKind === AppKind.app) {
            newSiteConfig.linuxFxVersion = wizardContext.newSiteRuntime;
        } else {
            if (wizardContext.newSiteOS === 'linux') {
                if (wizardContext.useConsumptionPlan) {
                    newSiteConfig.use32BitWorkerProcess = false; // Needs to be explicitly set to false per the platform team
                } else {
                    newSiteConfig.linuxFxVersion = getFunctionAppLinuxFxVersion(nonNullProp(wizardContext, 'newSiteRuntime'));
                }
            }

            const storageClient: StorageManagementClient = createAzureClient(wizardContext, StorageManagementClient);

            const storageAccount: StorageAccount = nonNullProp(wizardContext, 'storageAccount');
            const [, storageResourceGroup] = nonNullValue(nonNullProp(storageAccount, 'id').match(/\/resourceGroups\/([^/]+)\//), 'Invalid storage account id');
            const keysResult: StorageAccountListKeysResult = await storageClient.storageAccounts.listKeys(storageResourceGroup, nonNullProp(storageAccount, 'name'));

            fileShareName = getNewFileShareName(nonNullProp(wizardContext, 'newSiteName'));

            // https://github.com/Azure/azure-sdk-for-node/issues/4706
            const endpointSuffix: string = wizardContext.environment.storageEndpointSuffix.replace(/^\./, '');

            storageConnectionString = '';
            if (keysResult.keys && keysResult.keys[0].value) {
                storageConnectionString = `DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${keysResult.keys[0].value};EndpointSuffix=${endpointSuffix}`;
            }
        }
public async execute(wizardContext: IAppServiceWizardContext, progress: Progress<{ message?: string; increment?: number }>): Promise {
        const creatingNewApp: string = wizardContext.newSiteKind === AppKind.functionapp ?
            localize('creatingNewFunctionApp', 'Creating new function app "{0}"...', wizardContext.newSiteName) :
            localize('creatingNewWebApp', 'Creating new web app "{0}"...', wizardContext.newSiteName);
        ext.outputChannel.appendLog(creatingNewApp);
        progress.report({ message: creatingNewApp });
        const client: WebSiteManagementClient = createAzureClient(wizardContext, WebSiteManagementClient);
        wizardContext.site = await client.webApps.createOrUpdate(nonNullValueAndProp(wizardContext.resourceGroup, 'name'), nonNullProp(wizardContext, 'newSiteName'), {
            name: wizardContext.newSiteName,
            kind: wizardContext.newSiteKind,
            location: nonNullValueAndProp(wizardContext.location, 'name'),
            serverFarmId: wizardContext.plan ? wizardContext.plan.id : undefined,
            clientAffinityEnabled: wizardContext.newSiteKind === AppKind.app,
            siteConfig: await this.getNewSiteConfig(wizardContext),
            reserved: wizardContext.newSiteOS === WebsiteOS.linux  // The secret property - must be set to true to make it a Linux plan. Confirmed by the team who owns this API.
        });
    }
export async function createSlot(root: ISiteTreeRoot, existingSlots: AzureTreeItem[], context: ICreateChildImplContext): Promise {
    const client: WebSiteManagementClient = createAzureClient(root, WebSiteManagementClient);
    const slotName: string = (await ext.ui.showInputBox({
        prompt: localize('enterSlotName', 'Enter a unique name for the new deployment slot'),
        validateInput: async (value: string | undefined): Promise => validateSlotName(value, client, root)
    })).trim();

    const newDeploymentSlot: Site = {
        name: slotName,
        kind: root.client.kind,
        location: root.client.location,
        serverFarmId: root.client.serverFarmId,
        siteConfig: {
            appSettings: [] // neccesary to have clean appSettings; by default it copies the production's slot
        }
    };

    const configurationSource: SiteClient | undefined = await chooseConfigurationSource(root, existingSlots);

Is your System Free of Underlying Vulnerabilities?
Find Out Now