export async function runNewAgreementWizard()

in src/wizard/integration-account/agreements/createAgreementWizard.ts [31:76]


export async function runNewAgreementWizard(integrationAccount: IntegrationAccount, node: IAzureNode, showCreatingNode: (label: string) => void): Promise<IAzureTreeItem> {
    // Prompt the user for a agreement type and agreement name.
    const promptSteps: Array<AzureWizardPromptStep<IAgreementWizardContext>> = [
        new AgreementTypeStep(),
        new AgreementNameStep(),
        new HostPartnerStep(),
        new HostIdentityStep(),
        new GuestPartnerStep(),
        new GuestIdentityStep()
    ];

    // Create the new Agreement.
    const executeSteps: Array<AzureWizardExecuteStep<IAgreementWizardContext>> = [
        new AgreementCreateStep()
    ];

    // Initialize the wizard context.
    let wizardContext: IAgreementWizardContext = {
        credentials: node.credentials,
        integrationAccountName: integrationAccount.name!,
        resourceGroup: {
            location: integrationAccount.location!,
            name: integrationAccount.id!.split("/").slice(-5, -4)[0]
        },
        subscriptionDisplayName: node.subscriptionDisplayName,
        subscriptionId: node.subscriptionId
    };

    // Create a new instance of an Azure wizard for creating Agreements.
    const wizard = new AzureWizard<IAgreementWizardContext>(promptSteps, executeSteps, wizardContext);

    // Create a fake action context until https://github.com/Microsoft/vscode-azuretools/issues/120 is fixed.
    const actionContext = { measurements: {}, properties: {} } as IActionContext;

    // Prompt the user for information required to create a new Agreements.
    wizardContext = await wizard.prompt(actionContext);

    // Show a "Creating..." message in the tree view.
    showCreatingNode(wizardContext.agreementName!);

    // Execute the necessary steps to create a new Agreement.
    wizardContext = await wizard.execute(actionContext);

    // Return a new Agreement tree item to add to the tree view.
    return wizardContext.agreement!;
}