func PromptForConfigurationDetails()

in input.go [15:59]


func PromptForConfigurationDetails(idpAccount *cfg.IDPAccount) error {

	providers := MFAsByProvider.Names()

	var err error

	idpAccount.Provider, err = prompter.ChooseWithDefault("Please choose a provider:", idpAccount.Provider, providers)
	if err != nil {
		return errors.Wrap(err, "error selecting provider file")
	}

	mfas := MFAsByProvider.Mfas(idpAccount.Provider)

	// only prompt for MFA if there is more than one option
	if len(mfas) > 1 {

		idpAccount.MFA, err = prompter.ChooseWithDefault("Please choose an MFA", idpAccount.MFA, mfas)
		if err != nil {
			return errors.Wrap(err, "error selecting mfa")
		}

	} else {
		idpAccount.MFA = mfas[0]
	}

	idpAccount.Profile = prompter.String("AlibabaCloud CLI Profile", idpAccount.Profile)

	idpAccount.URL = prompter.String("URL", idpAccount.URL)
	idpAccount.Username = prompter.String("Username", idpAccount.Username)

	switch idpAccount.Provider {
	case "OneLogin":
		idpAccount.AppID = prompter.String("App ID", idpAccount.AppID)
		log.Println("")
		idpAccount.Subdomain = prompter.String("Subdomain", idpAccount.Subdomain)
		log.Println("")
	case "F5APM":
		idpAccount.ResourceID = prompter.String("Resource ID", idpAccount.ResourceID)
	case "AzureAD":
		idpAccount.AppID = prompter.String("App ID", idpAccount.AppID)
		log.Println("")
	}

	return nil
}