export async function deployStaticWebsite()

in src/commands/storageAccountActionHandlers.ts [54:98]


export async function deployStaticWebsite(context: IActionContext, target?: vscode.Uri | StorageAccountTreeItem | BlobContainerTreeItem): Promise<void> {
    context.telemetry.eventVersion = 2;
    let sourcePath: string | undefined;
    let destTreeItem: StorageAccountTreeItem | BlobContainerTreeItem | undefined;

    // Disambiguate context this was executed from
    if (target instanceof vscode.Uri) {
        // Command called from file view
        if (target.scheme === 'azurestorage') {
            context.telemetry.properties.contextValue = 'BlobContainer/FileShare';
            throw new Error('Deploying an Azure resource from the Explorer is not supported.');
        }

        sourcePath = target.fsPath;
        context.telemetry.properties.contextValue = 'Folder';
    } else {
        // Command called from command palette or from storage account/container treeItem
        destTreeItem = <StorageAccountTreeItem | BlobContainerTreeItem>target;
        context.telemetry.properties.contextValue = (destTreeItem && destTreeItem.contextValue) || 'CommandPalette';
    }

    //  Ask for source folder if needed
    if (!sourcePath) {
        sourcePath = await showWorkspaceFoldersQuickPick(localize('selectFolderToDeploy', 'Select the folder to deploy'), context, configurationSettingsKeys.deployPath);
    }

    // Ask for destination account
    const destAccountTreeItem: StorageAccountTreeItem = await selectStorageAccountTreeItemForCommand(
        destTreeItem,
        context,
        {
            mustBeWebsiteCapable: true,
            configureWebsite: true
        });

    // Get the $web container
    const destContainerTreeItem = await destAccountTreeItem.getWebsiteCapableContainer(context);
    if (!destContainerTreeItem) {
        throw new Error(`Could not find $web blob container for storage account "${destAccountTreeItem.label}"`);
    }

    await runPreDeployTask(sourcePath, context);

    return destContainerTreeItem.deployStaticWebsite(context, sourcePath);
}