func (i *InstanceBeta) WaitForSerialOutput(match string, failureMatches []string, port int64, interval, timeout time.Duration) error {
	return WaitForSerialOutput(match, failureMatches, port, interval, timeout, i.Project, i.Zone, i.Name, i.Client)
}
WaitForSerialOutput waits to a string match on a serial port.
package gcp
import (
	"context"
	"fmt"
	"strings"
	"time"
	apiBeta "google.golang.org/api/compute/v0.beta"
	api "google.golang.org/api/compute/v1"
	daisyCompute "github.com/GoogleCloudPlatform/compute-image-tools/daisy/compute"
)
type Instance struct {
	*api.Instance
	Client        daisyCompute.Client
	Project, Zone string
	IsWindows     bool
}
type InstanceBeta struct {
	*apiBeta.Instance
	Client        daisyCompute.Client
	Project, Zone string
	IsWindows     bool
}
func (i *Instance) Cleanup() error {
	return i.Client.DeleteInstance(i.Project, i.Zone, i.Name)
}
func (i *Instance) RestartWithScriptCode(script string) error {
	err := i.Client.StopInstance(i.Project, i.Zone, i.Name)
	if err != nil {
		return err
	}
	return i.StartWithScriptCode(script, nil)
}
func (i *Instance) StartWithScriptCode(script string, instanceMetadata map[string]string) error {
	if instanceMetadata == nil {
		instanceMetadata = make(map[string]string)
	}
	if i.IsWindows {
		instanceMetadata["windows-startup-script-ps1"] = script
	} else {
		instanceMetadata["startup-script"] = script
	}
	var metadataItems []*api.MetadataItems
	for k, v := range instanceMetadata {
		metadataItems = append(metadataItems, BuildInstanceMetadataItem(k, v))
	}
	err := i.Client.SetInstanceMetadata(i.Project, i.Zone,
		i.Name, &api.Metadata{Items: metadataItems, Fingerprint: i.Metadata.Fingerprint})
	if err != nil {
		return err
	}
	if err = i.Client.StartInstance(i.Project, i.Zone, i.Name); err != nil {
		return err
	}
	return nil
}
func (i *Instance) WaitForSerialOutput(match string, failureMatches []string, port int64, interval, timeout time.Duration) error {
	return WaitForSerialOutput(match, failureMatches, port, interval, timeout, i.Project, i.Zone, i.Name, i.Client)
}