func (e *Environment) Set(val string) error {
	newEnvironment := Environment(strings.ToLower(val))
	if !isValidEnvironment(newEnvironment) {
		return errInvalidEnvironment
	}
	*e = newEnvironment
	return nil
}
Set validates and sets the Environment value
package realm
import (
	"fmt"
	"strconv"
	"strings"
	"github.com/10gen/realm-cli/internal/utils/flags"
	"github.com/AlecAivazis/survey/v2/core"
)
var (
	DefaultAppConfigVersion = AppConfigVersion20210101
)
type AppConfigVersion int
func (cv AppConfigVersion) String() string { return strconv.Itoa(int(cv)) }
func (cv AppConfigVersion) Type() string { return flags.TypeInt }
func (cv *AppConfigVersion) Set(val string) error {
	v, err := strconv.Atoi(val)
	if err != nil {
		return err
	}
	newConfigVersion := AppConfigVersion(v)
	if !isValidConfigVersion(newConfigVersion) {
		return errInvalidConfigVersion
	}
	*cv = newConfigVersion
	return nil
}
const (
	AppConfigVersionZero     AppConfigVersion = 0
	AppConfigVersion20210101 AppConfigVersion = 20210101
	AppConfigVersion20200603 AppConfigVersion = 20200603
	AppConfigVersion20180301 AppConfigVersion = 20180301
)
func isValidConfigVersion(cv AppConfigVersion) bool {
	switch cv {
	case
		AppConfigVersionZero,  
		AppConfigVersion20180301,
		AppConfigVersion20200603,
		AppConfigVersion20210101:
		return true
	}
	return false
}
var (
	ConfigVersionValues = []string{
		AppConfigVersion20180301.String(),
		AppConfigVersion20200603.String(),
		AppConfigVersion20210101.String(),
	}
	DeploymentModelValues = []string{
		DeploymentModelGlobal.String(),
		DeploymentModelLocal.String(),
	}
	LocationValues = []string{
		LocationVirginia.String(),
		LocationOregon.String(),
		LocationFrankfurt.String(),
		LocationIreland.String(),
		LocationSydney.String(),
		LocationMumbai.String(),
		LocationSingapore.String(),
	}
	EnvironmentValues = []string{
		EnvironmentDevelopment.String(),
		EnvironmentTesting.String(),
		EnvironmentQA.String(),
		EnvironmentProduction.String(),
	}
	errInvalidConfigVersion   = fmt.Errorf("unsupported config version, use one of [%s] instead", strings.Join(ConfigVersionValues, ", "))
	errInvalidDeploymentModel = fmt.Errorf("unsupported deployment model, use one of [%s] instead", strings.Join(DeploymentModelValues, ", "))
	errInvalidLocation        = fmt.Errorf("unsupported location, use one of [%s] instead", strings.Join(LocationValues, ", "))
	errInvalidEnvironment     = fmt.Errorf("unsupported environment, use one of [%s] instead", strings.Join(EnvironmentValues, ", "))
)
type DeploymentModel string
func (dm DeploymentModel) String() string { return string(dm) }
func (dm DeploymentModel) Type() string { return flags.TypeString }
func (dm *DeploymentModel) Set(val string) error {
	newDeploymentModel := DeploymentModel(strings.ToUpper(val))
	if !isValidDeploymentModel(newDeploymentModel) {
		return errInvalidDeploymentModel
	}
	*dm = newDeploymentModel
	return nil
}
func (dm *DeploymentModel) WriteAnswer(name string, value interface{}) error {
	var newDeploymentModel DeploymentModel
	switch v := value.(type) {
	case core.OptionAnswer:
		newDeploymentModel = DeploymentModel(v.Value)
	}
	if !isValidDeploymentModel(newDeploymentModel) {
		return errInvalidDeploymentModel
	}
	*dm = newDeploymentModel
	return nil
}
const (
	DeploymentModelEmpty  DeploymentModel = ""
	DeploymentModelGlobal DeploymentModel = "GLOBAL"
	DeploymentModelLocal  DeploymentModel = "LOCAL"
)
func isValidDeploymentModel(dm DeploymentModel) bool {
	switch dm {
	case
		DeploymentModelEmpty,  
		DeploymentModelGlobal,
		DeploymentModelLocal:
		return true
	}
	return false
}
type Location string
func (l Location) String() string { return string(l) }
func (l Location) Type() string { return flags.TypeString }
func (l *Location) Set(val string) error {
	newLocation := Location(strings.ToUpper(val))
	if !isValidLocation(newLocation) {
		return errInvalidLocation
	}
	*l = newLocation
	return nil
}
func (l *Location) WriteAnswer(name string, value interface{}) error {
	var newLocation Location
	switch v := value.(type) {
	case core.OptionAnswer:
		newLocation = Location(v.Value)
	}
	if !isValidLocation(newLocation) {
		return errInvalidLocation
	}
	*l = newLocation
	return nil
}
const (
	LocationEmpty     Location = ""
	LocationVirginia  Location = "US-VA"
	LocationOregon    Location = "US-OR"
	LocationFrankfurt Location = "DE-FF"
	LocationIreland   Location = "IE"
	LocationSydney    Location = "AU"
	LocationMumbai    Location = "IN-MB"
	LocationSingapore Location = "SG"
)
func isValidLocation(l Location) bool {
	switch l {
	case
		LocationEmpty,  
		LocationVirginia,
		LocationOregon,
		LocationFrankfurt,
		LocationIreland,
		LocationSydney,
		LocationMumbai,
		LocationSingapore:
		return true
	}
	return false
}
type Environment string
func (e Environment) String() string { return string(e) }
func (e Environment) Type() string { return flags.TypeString }