-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathUniqueNamePromptStep.ts
More file actions
34 lines (30 loc) · 1.71 KB
/
UniqueNamePromptStep.ts
File metadata and controls
34 lines (30 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { type IAppServiceWizardContext } from "@microsoft/vscode-azext-azureappservice";
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
import { localize } from "../../localize";
import { setConsumptionPlanProperties } from "./FunctionAppHostingPlanStep";
import { type IFunctionAppWizardContext } from "./IFunctionAppWizardContext";
export class ConfigureCommonNamesStep extends AzureWizardPromptStep<IAppServiceWizardContext> {
public async prompt(_context: IAppServiceWizardContext): Promise<void> {
// do nothing, will be handled in configuration
}
public shouldPrompt(_context: IAppServiceWizardContext): boolean {
// never prompt
return false;
}
public async configureBeforePrompt(context: IFunctionAppWizardContext): Promise<void> {
if (!context.advancedCreation) {
const newName: string | undefined = await context.relatedNameTask;
if (!newName) {
throw new Error(localize('noUniqueName', 'Failed to generate unique name for resources. Use advanced creation to manually enter resource names.'));
}
context.newResourceGroupName = context.newResourceGroupName || newName;
setConsumptionPlanProperties(context);
context.newStorageAccountName = newName;
context.newAppInsightsName = newName;
}
}
}