func newGCEInstance()

in tui/specials.go [261:311]


func newGCEInstance(q *Queue) {
	r := newPicker("Do you want to accept the default configuration? (Yes or No)", "", "gce-use-defaults", "", getYesOrNo(q))
	r.omitFromSettings = true
	r.list.SetShowFilter(false)
	r.list.SetShowHelp(false)
	r.list.SetShowStatusBar(false)
	r.addPostProcessor(validateGCEDefault)
	r.addContent(textStyle.Bold(true).Render("Configure a Compute Engine Instance"))
	r.addContent("\n\n")

	m := `Let's walk through configuring a Compute Engine Instance (Virtual Machine).
you can either accept a default configuration with settings that work for
trying out most use cases, or hand configure key settings.
	`

	r.addContent(m)
	q.add(&r)

	basename := q.stack.GetSetting("basename")
	name := newTextInput("Enter the name of the instance",
		fmt.Sprintf("%s-instance", basename),
		"instance-name",
		"",
	)
	q.add(&name)

	newRegion(q)
	newZone(q)
	newMachineTypeManager(q)
	newDiskImageManager(q)

	ds := newTextInput("Enter the size of the boot disk you want in GB",
		"100",
		"instance-disksize",
		"",
	)
	ds.addPostProcessor(validateInteger)
	q.add(&ds)

	dt := newPicker("Pick the type of the boot disk you want", "", "instance-disktype", gcloud.DefaultDiskType, getDiskTypes(q))
	q.add(&dt)

	dy := newYesOrNo(
		q,
		"Do you want this to be a webserver (Expose ports 80 & 443)?",
		"instance-webserver",
		false,
		validateGCEConfiguration,
	)
	q.add(&dy)
}